blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
721
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
57
| license_type
stringclasses 2
values | repo_name
stringlengths 5
91
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 321
values | visit_date
timestamp[ns]date 2016-08-12 09:31:09
2023-09-06 10:45:07
| revision_date
timestamp[ns]date 2010-09-28 14:01:40
2023-09-06 06:22:19
| committer_date
timestamp[ns]date 2010-09-28 14:01:40
2023-09-06 06:22:19
| github_id
int64 426
681M
| star_events_count
int64 101
243k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 23
values | gha_event_created_at
timestamp[ns]date 2012-06-28 18:51:49
2023-09-14 21:59:16
⌀ | gha_created_at
timestamp[ns]date 2008-02-11 22:55:26
2023-08-10 11:14:58
⌀ | gha_language
stringclasses 147
values | src_encoding
stringclasses 26
values | language
stringclasses 2
values | is_vendor
bool 2
classes | is_generated
bool 2
classes | length_bytes
int64 6
10.2M
| extension
stringclasses 115
values | filename
stringlengths 3
113
| content
stringlengths 6
10.2M
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1a986b30719e17c3d544eef11b57761fe2631c9f
|
39568e19301a7a112398be542154950af25591de
|
/sw/device/silicon_creator/lib/chip_info.h
|
3cb3fa6299d3be279dcc88461e5d6caccf9806ad
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
lowRISC/opentitan
|
493995bc7cf7cb3aee486a5203af3fd62bba3bfc
|
51f6017b8425b14d5a4aa9abace8fe5a25ef08c8
|
refs/heads/master
| 2023-08-31T22:05:09.425796
| 2023-08-14T14:52:15
| 2023-08-31T20:31:13
| 204,516,692
| 2,077
| 634
|
Apache-2.0
| 2023-09-14T21:16:21
| 2019-08-26T16:30:16
|
SystemVerilog
|
UTF-8
|
C
| false
| false
| 1,697
|
h
|
chip_info.h
|
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
#ifndef OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_CHIP_INFO_H_
#define OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_CHIP_INFO_H_
#include <stdint.h>
#include "sw/device/lib/base/macros.h"
/**
* A truncated commit hash from the open-source OpenTitan repo that can be
* used to reproduce the ROM binary.
*/
typedef struct chip_info_scm_revision {
/**
* Least significant word of the truncated commit hash.
*/
uint32_t scm_revision_low;
/**
* Most significant word of the truncated commit hash.
*/
uint32_t scm_revision_high;
} chip_info_scm_revision_t;
typedef struct chip_info {
/**
* Truncated commit hash.
*/
chip_info_scm_revision_t scm_revision;
/**
* Chip info format version.
*
* The chip info struct is placed at the end of the ROM. Placing this field at
* the end of the struct places the version word at the last addressable ROM
* address, which gives later boot stages a fixed address to look for this
* field. See `sw/device/silicon_creator/rom/rom.ld` for details.
*/
uint32_t version;
} chip_info_t;
OT_ASSERT_MEMBER_OFFSET(chip_info_t, scm_revision, 0);
OT_ASSERT_MEMBER_OFFSET(chip_info_t, version, 8);
OT_ASSERT_SIZE(chip_info_t, 12);
enum {
/**
* Chip info format version 1 value.
*/
kChipInfoVersion1 = 0x4efecea6,
};
/**
* Extern declaration for the `kChipInfo` instance placed at the end of ROM.
*
* The actual definition is in an auto-generated file.
*/
extern const chip_info_t kChipInfo;
#endif // OPENTITAN_SW_DEVICE_SILICON_CREATOR_LIB_CHIP_INFO_H_
|
e69ac2539bf8623ff128f0f9d35b623132783f72
|
376e1818d427b5e4d32fa6dd6c7b71e9fd88afdb
|
/net/socks4/patches/patch-rftp_domacro.c
|
81bc461eca3f15649f81496c2f97406cce8f6753
|
[] |
no_license
|
NetBSD/pkgsrc
|
a0732c023519650ef821ab89c23ab6ab59e25bdb
|
d042034ec4896cc5b47ed6f2e5b8802d9bc5c556
|
refs/heads/trunk
| 2023-09-01T07:40:12.138283
| 2023-09-01T05:25:19
| 2023-09-01T05:25:19
| 88,439,572
| 321
| 138
| null | 2023-07-12T22:34:14
| 2017-04-16T20:04:15
| null |
UTF-8
|
C
| false
| false
| 365
|
c
|
patch-rftp_domacro.c
|
$NetBSD: patch-rftp_domacro.c,v 1.1 2013/03/02 18:29:48 joerg Exp $
--- rftp/domacro.c.orig 1994-08-22 19:56:34.000000000 +0000
+++ rftp/domacro.c
@@ -49,9 +49,7 @@ static char sccsid[] = "@(#)domacro.c 1.
# endif
#endif
-domacro(argc, argv)
- int argc;
- char *argv[];
+void domacro(int argc, char *argv[])
{
register int i, j;
register char *cp1, *cp2;
|
042ca9b48fad8ac6d8682541942311a157794d90
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/sysutils/lxtask/files/patch-src__xfce-taskmanager-linux.c
|
46a81b29646a46c1452dc1d06228f6441844c9bd
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 1,733
|
c
|
patch-src__xfce-taskmanager-linux.c
|
--- src/xfce-taskmanager-linux.c.orig 2019-01-13 21:25:38 UTC
+++ src/xfce-taskmanager-linux.c
@@ -30,6 +30,8 @@
#include "xfce-taskmanager-linux.h"
/* #include <sys/sysinfo.h> */
+#define page_size ( sysconf(_SC_PAGESIZE) )
+
void get_task_details(pid_t pid,struct task *task)
{
int fd;
@@ -41,7 +43,7 @@ void get_task_details(pid_t pid,struct task *task)
task->checked=FALSE;
task->size=0;
- sprintf(line,"/proc/%d/statm",(int)pid);
+ sprintf(line,"/compat/linux/proc/%d/statm",(int)pid);
fd=open(line,O_RDONLY);
if(fd==-1) return;
ret = read(fd,line,255);
@@ -57,7 +59,7 @@ void get_task_details(pid_t pid,struct task *task)
task->size = t_size * page_size;
task->rss = t_rss * page_size;
- sprintf(line,"/proc/%d/stat",(gint)pid);
+ sprintf(line,"/compat/linux/proc/%d/stat",(gint)pid);
fd=open(line,O_RDONLY);
if(fd!=-1)
{
@@ -98,7 +100,7 @@ void get_task_details(pid_t pid,struct task *task)
if(show_full_path)
{
FILE *fp;
- sprintf(line,"/proc/%d/cmdline",(int)pid);
+ sprintf(line,"/compat/linux/proc/%d/cmdline",(int)pid);
fp=fopen(line,"r");
if(fp)
{
@@ -124,7 +126,7 @@ void get_task_details(pid_t pid,struct task *task)
else if(len>=15)
{
FILE *fp;
- sprintf(line,"/proc/%d/cmdline",(int)pid);
+ sprintf(line,"/compat/linux/proc/%d/cmdline",(int)pid);
fp=fopen(line,"r");
if(fp)
{
@@ -169,7 +171,7 @@ void get_task_details(pid_t pid,struct task *task)
task->time_percentage = 0;
task->ppid = ppid;
- sprintf(line,"/proc/%d/task",(int)pid);
+ sprintf(line,"/compat/linux/proc/%d/task",(int)pid);
/* SF bug #843: /proc/%d/stat owned by UID instead of EUID */
if (stat(line,&st) < 0)
fstat(fd,&st);
|
607f05afbfc08ddb00de28aeebf0203a65987bdb
|
2b4867ce106d3068b67f2244019247df9cf6f341
|
/tests/runner-tests/decls/function/5.c
|
c69cd27a248c748df8f08a989e00475bbc4a7c1e
|
[
"BSD-3-Clause"
] |
permissive
|
jyn514/saltwater
|
d22b29ac40a4e3deb6128d904759d9183f081ab4
|
097c72d30e325de57fbed8a506431754a0560374
|
refs/heads/master
| 2023-05-09T05:44:43.147928
| 2021-06-03T02:53:32
| 2021-06-03T02:53:32
| 190,940,981
| 131
| 25
|
BSD-3-Clause
| 2021-04-07T22:58:39
| 2019-06-08T22:26:45
|
Rust
|
UTF-8
|
C
| false
| false
| 26
|
c
|
5.c
|
// fail
int f(..., void);
|
13b37d5659642c8c38d2a87915f8f151e5a02891
|
c7c73566784a7896100e993606e1bd8fdd0ea94e
|
/panda/src/express/pta_uchar.h
|
38fb46a98be1b1483849d6968ec1c2e1b679973c
|
[
"BSD-3-Clause",
"BSD-2-Clause"
] |
permissive
|
panda3d/panda3d
|
c3f94df2206ff7cfe4a3b370777a56fb11a07926
|
160ba090a5e80068f61f34fc3d6f49dbb6ad52c5
|
refs/heads/master
| 2023-08-21T13:23:16.904756
| 2021-04-11T22:55:33
| 2023-08-06T06:09:32
| 13,212,165
| 4,417
| 1,072
|
NOASSERTION
| 2023-09-09T19:26:14
| 2013-09-30T10:20:25
|
C++
|
UTF-8
|
C
| false
| false
| 1,389
|
h
|
pta_uchar.h
|
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file pta_uchar.h
* @author drose
* @date 2000-05-10
*/
#ifndef PTA_UCHAR_H
#define PTA_UCHAR_H
#include "pandabase.h"
#include "pointerToArray.h"
#include "vector_uchar.h"
/**
* A pta of uchars. This class is defined once here, and exported to
* PANDA_EXPRESS.DLL; other packages that want to use a pta of this type
* (whether they need to export it or not) should include this header file,
* rather than defining the pta again.
*/
#if !defined(__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7
// GCC 4.6 has a weird bug related to this type.
#else
EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_EXPRESS, EXPTP_PANDA_EXPRESS, PointerToBase<ReferenceCountedVector<unsigned char> >)
EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_EXPRESS, EXPTP_PANDA_EXPRESS, PointerToArrayBase<unsigned char>)
EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_EXPRESS, EXPTP_PANDA_EXPRESS, PointerToArray<unsigned char>)
EXPORT_TEMPLATE_CLASS(EXPCL_PANDA_EXPRESS, EXPTP_PANDA_EXPRESS, ConstPointerToArray<unsigned char>)
#endif
typedef PointerToArray<unsigned char> PTA_uchar;
typedef ConstPointerToArray<unsigned char> CPTA_uchar;
#endif
|
bba5cb8eb8e83c8e147df83b1fb944d6fafe99fc
|
88ae8695987ada722184307301e221e1ba3cc2fa
|
/third_party/ffmpeg/libavdevice/iec61883.c
|
7223ba2e646729e9b6e917d2f48046a37eda0dcc
|
[
"BSD-3-Clause",
"LGPL-2.1-only",
"LGPL-3.0-only",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"GPL-2.0-only",
"LGPL-2.1-or-later",
"GPL-3.0-or-later",
"LGPL-3.0-or-later",
"IJG",
"LicenseRef-scancode-other-permissive",
"MIT",
"GPL-2.0-or-later",
"Apache-2.0",
"GPL-3.0-only"
] |
permissive
|
iridium-browser/iridium-browser
|
71d9c5ff76e014e6900b825f67389ab0ccd01329
|
5ee297f53dc7f8e70183031cff62f37b0f19d25f
|
refs/heads/master
| 2023-08-03T16:44:16.844552
| 2023-07-20T15:17:00
| 2023-07-23T16:09:30
| 220,016,632
| 341
| 40
|
BSD-3-Clause
| 2021-08-13T13:54:45
| 2019-11-06T14:32:31
| null |
UTF-8
|
C
| false
| false
| 16,211
|
c
|
iec61883.c
|
/*
* Copyright (c) 2012 Georg Lippitsch <georg.lippitsch@gmx.at>
*
* This file is part of FFmpeg.
*
* FFmpeg 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 2.1 of the License, or (at your option) any later version.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* libiec61883 interface
*/
#include "config_components.h"
#include <poll.h>
#include <libraw1394/raw1394.h>
#include <libavc1394/avc1394.h>
#include <libavc1394/rom1394.h>
#include <libiec61883/iec61883.h>
#include "libavformat/dv.h"
#include "libavformat/mpegts.h"
#include "libavutil/opt.h"
#include "avdevice.h"
#define THREADS HAVE_PTHREADS
#if THREADS
#include <pthread.h>
#endif
#define MOTDCT_SPEC_ID 0x00005068
#define IEC61883_AUTO 0
#define IEC61883_DV 1
#define IEC61883_HDV 2
/**
* For DV, one packet corresponds exactly to one frame.
* For HDV, these are MPEG2 transport stream packets.
* The queue is implemented as linked list.
*/
typedef struct DVPacket {
uint8_t *buf; ///< actual buffer data
int len; ///< size of buffer allocated
struct DVPacket *next; ///< next DVPacket
} DVPacket;
struct iec61883_data {
AVClass *class;
raw1394handle_t raw1394; ///< handle for libraw1394
iec61883_dv_fb_t iec61883_dv; ///< handle for libiec61883 when used with DV
iec61883_mpeg2_t iec61883_mpeg2; ///< handle for libiec61883 when used with HDV
DVDemuxContext *dv_demux; ///< generic DV muxing/demuxing context
MpegTSContext *mpeg_demux; ///< generic HDV muxing/demuxing context
DVPacket *queue_first; ///< first element of packet queue
DVPacket *queue_last; ///< last element of packet queue
char *device_guid; ///< to select one of multiple DV devices
int packets; ///< Number of packets queued
int max_packets; ///< Max. number of packets in queue
int bandwidth; ///< returned by libiec61883
int channel; ///< returned by libiec61883
int input_port; ///< returned by libiec61883
int type; ///< Stream type, to distinguish DV/HDV
int node; ///< returned by libiec61883
int output_port; ///< returned by libiec61883
int thread_loop; ///< Condition for thread while-loop
int receiving; ///< True as soon data from device available
int receive_error; ///< Set in receive task in case of error
int eof; ///< True as soon as no more data available
struct pollfd raw1394_poll; ///< to poll for new data from libraw1394
/** Parse function for DV/HDV differs, so this is set before packets arrive */
int (*parse_queue)(struct iec61883_data *dv, AVPacket *pkt);
#if THREADS
pthread_t receive_task_thread;
pthread_mutex_t mutex;
pthread_cond_t cond;
#endif
};
static int iec61883_callback(unsigned char *data, int length,
int complete, void *callback_data)
{
struct iec61883_data *dv = callback_data;
DVPacket *packet;
int ret;
#if THREADS
pthread_mutex_lock(&dv->mutex);
#endif
if (dv->packets >= dv->max_packets) {
av_log(NULL, AV_LOG_ERROR, "DV packet queue overrun, dropping.\n");
ret = 0;
goto exit;
}
packet = av_mallocz(sizeof(*packet));
if (!packet) {
ret = -1;
goto exit;
}
packet->buf = av_malloc(length + AV_INPUT_BUFFER_PADDING_SIZE);
if (!packet->buf) {
av_free(packet);
ret = -1;
goto exit;
}
packet->len = length;
memcpy(packet->buf, data, length);
memset(packet->buf + length, 0, AV_INPUT_BUFFER_PADDING_SIZE);
if (dv->queue_first) {
dv->queue_last->next = packet;
dv->queue_last = packet;
} else {
dv->queue_first = packet;
dv->queue_last = packet;
}
dv->packets++;
ret = 0;
exit:
#if THREADS
pthread_cond_broadcast(&dv->cond);
pthread_mutex_unlock(&dv->mutex);
#endif
return ret;
}
static void *iec61883_receive_task(void *opaque)
{
struct iec61883_data *dv = (struct iec61883_data *)opaque;
int result;
#if THREADS
while (dv->thread_loop)
#endif
{
while ((result = poll(&dv->raw1394_poll, 1, 200)) < 0) {
if (!(errno == EAGAIN || errno == EINTR)) {
av_log(NULL, AV_LOG_ERROR, "Raw1394 poll error occurred.\n");
dv->receive_error = AVERROR(EIO);
return NULL;
}
}
if (result > 0 && ((dv->raw1394_poll.revents & POLLIN)
|| (dv->raw1394_poll.revents & POLLPRI))) {
dv->receiving = 1;
raw1394_loop_iterate(dv->raw1394);
} else if (dv->receiving) {
av_log(NULL, AV_LOG_ERROR, "No more input data available\n");
#if THREADS
pthread_mutex_lock(&dv->mutex);
dv->eof = 1;
pthread_cond_broadcast(&dv->cond);
pthread_mutex_unlock(&dv->mutex);
#else
dv->eof = 1;
#endif
return NULL;
}
}
return NULL;
}
static int iec61883_parse_queue_dv(struct iec61883_data *dv, AVPacket *pkt)
{
DVPacket *packet;
int size;
size = avpriv_dv_get_packet(dv->dv_demux, pkt);
if (size > 0)
return size;
packet = dv->queue_first;
if (!packet)
return -1;
size = avpriv_dv_produce_packet(dv->dv_demux, pkt,
packet->buf, packet->len, -1);
dv->queue_first = packet->next;
if (size < 0)
av_free(packet->buf);
av_free(packet);
dv->packets--;
if (size < 0)
return -1;
if (av_packet_from_data(pkt, pkt->data, pkt->size) < 0) {
av_freep(&pkt->data);
av_packet_unref(pkt);
return -1;
}
return size;
}
static int iec61883_parse_queue_hdv(struct iec61883_data *dv, AVPacket *pkt)
{
#if CONFIG_MPEGTS_DEMUXER
DVPacket *packet;
int size;
while (dv->queue_first) {
packet = dv->queue_first;
size = avpriv_mpegts_parse_packet(dv->mpeg_demux, pkt, packet->buf,
packet->len);
dv->queue_first = packet->next;
av_freep(&packet->buf);
av_freep(&packet);
dv->packets--;
if (size > 0)
return size;
}
#endif
return -1;
}
static int iec61883_read_header(AVFormatContext *context)
{
struct iec61883_data *dv = context->priv_data;
struct raw1394_portinfo pinf[16];
rom1394_directory rom_dir;
char *endptr;
int inport;
int nb_ports;
int port = -1;
int response;
int i, j = 0;
uint64_t guid = 0;
dv->input_port = -1;
dv->output_port = -1;
dv->channel = -1;
dv->raw1394 = raw1394_new_handle();
if (!dv->raw1394) {
av_log(context, AV_LOG_ERROR, "Failed to open IEEE1394 interface.\n");
return AVERROR(EIO);
}
if ((nb_ports = raw1394_get_port_info(dv->raw1394, pinf, 16)) < 0) {
av_log(context, AV_LOG_ERROR, "Failed to get number of IEEE1394 ports.\n");
goto fail;
}
inport = strtol(context->url, &endptr, 10);
if (endptr != context->url && *endptr == '\0') {
av_log(context, AV_LOG_INFO, "Selecting IEEE1394 port: %d\n", inport);
j = inport;
nb_ports = inport + 1;
} else if (strcmp(context->url, "auto")) {
av_log(context, AV_LOG_ERROR, "Invalid input \"%s\", you should specify "
"\"auto\" for auto-detection, or the port number.\n", context->url);
goto fail;
}
if (dv->device_guid) {
if (sscanf(dv->device_guid, "%"SCNu64, &guid) != 1) {
av_log(context, AV_LOG_INFO, "Invalid dvguid parameter: %s\n",
dv->device_guid);
goto fail;
}
}
for (; j < nb_ports && port==-1; ++j) {
raw1394_destroy_handle(dv->raw1394);
if (!(dv->raw1394 = raw1394_new_handle_on_port(j))) {
av_log(context, AV_LOG_ERROR, "Failed setting IEEE1394 port.\n");
goto fail;
}
for (i=0; i<raw1394_get_nodecount(dv->raw1394); ++i) {
/* Select device explicitly by GUID */
if (guid > 1) {
if (guid == rom1394_get_guid(dv->raw1394, i)) {
dv->node = i;
port = j;
break;
}
} else {
/* Select first AV/C tape recorder player node */
if (rom1394_get_directory(dv->raw1394, i, &rom_dir) < 0)
continue;
if (((rom1394_get_node_type(&rom_dir) == ROM1394_NODE_TYPE_AVC) &&
avc1394_check_subunit_type(dv->raw1394, i, AVC1394_SUBUNIT_TYPE_VCR)) ||
(rom_dir.unit_spec_id == MOTDCT_SPEC_ID)) {
rom1394_free_directory(&rom_dir);
dv->node = i;
port = j;
break;
}
rom1394_free_directory(&rom_dir);
}
}
}
if (port == -1) {
av_log(context, AV_LOG_ERROR, "No AV/C devices found.\n");
goto fail;
}
/* Provide bus sanity for multiple connections */
iec61883_cmp_normalize_output(dv->raw1394, 0xffc0 | dv->node);
/* Find out if device is DV or HDV */
if (dv->type == IEC61883_AUTO) {
response = avc1394_transaction(dv->raw1394, dv->node,
AVC1394_CTYPE_STATUS |
AVC1394_SUBUNIT_TYPE_TAPE_RECORDER |
AVC1394_SUBUNIT_ID_0 |
AVC1394_VCR_COMMAND_OUTPUT_SIGNAL_MODE |
0xFF, 2);
response = AVC1394_GET_OPERAND0(response);
dv->type = (response == 0x10 || response == 0x90 || response == 0x1A || response == 0x9A) ?
IEC61883_HDV : IEC61883_DV;
}
/* Connect to device, and do initialization */
dv->channel = iec61883_cmp_connect(dv->raw1394, dv->node, &dv->output_port,
raw1394_get_local_id(dv->raw1394),
&dv->input_port, &dv->bandwidth);
if (dv->channel < 0)
dv->channel = 63;
if (!dv->max_packets)
dv->max_packets = 100;
if (CONFIG_MPEGTS_DEMUXER && dv->type == IEC61883_HDV) {
/* Init HDV receive */
avformat_new_stream(context, NULL);
dv->mpeg_demux = avpriv_mpegts_parse_open(context);
if (!dv->mpeg_demux)
goto fail;
dv->parse_queue = iec61883_parse_queue_hdv;
dv->iec61883_mpeg2 = iec61883_mpeg2_recv_init(dv->raw1394,
(iec61883_mpeg2_recv_t)iec61883_callback,
dv);
dv->max_packets *= 766;
} else {
/* Init DV receive */
dv->dv_demux = avpriv_dv_init_demux(context);
if (!dv->dv_demux)
goto fail;
dv->parse_queue = iec61883_parse_queue_dv;
dv->iec61883_dv = iec61883_dv_fb_init(dv->raw1394, iec61883_callback, dv);
}
dv->raw1394_poll.fd = raw1394_get_fd(dv->raw1394);
dv->raw1394_poll.events = POLLIN | POLLERR | POLLHUP | POLLPRI;
/* Actually start receiving */
if (dv->type == IEC61883_HDV)
iec61883_mpeg2_recv_start(dv->iec61883_mpeg2, dv->channel);
else
iec61883_dv_fb_start(dv->iec61883_dv, dv->channel);
#if THREADS
dv->thread_loop = 1;
if (pthread_mutex_init(&dv->mutex, NULL))
goto fail;
if (pthread_cond_init(&dv->cond, NULL))
goto fail;
if (pthread_create(&dv->receive_task_thread, NULL, iec61883_receive_task, dv))
goto fail;
#endif
return 0;
fail:
raw1394_destroy_handle(dv->raw1394);
return AVERROR(EIO);
}
static int iec61883_read_packet(AVFormatContext *context, AVPacket *pkt)
{
struct iec61883_data *dv = context->priv_data;
int size;
/**
* Try to parse frames from queue
*/
#if THREADS
pthread_mutex_lock(&dv->mutex);
while ((size = dv->parse_queue(dv, pkt)) == -1)
if (!dv->eof)
pthread_cond_wait(&dv->cond, &dv->mutex);
else
break;
pthread_mutex_unlock(&dv->mutex);
#else
int result;
while ((size = dv->parse_queue(dv, pkt)) == -1) {
iec61883_receive_task((void *)dv);
if (dv->receive_error)
return dv->receive_error;
}
#endif
return size;
}
static int iec61883_close(AVFormatContext *context)
{
struct iec61883_data *dv = context->priv_data;
#if THREADS
dv->thread_loop = 0;
pthread_join(dv->receive_task_thread, NULL);
pthread_cond_destroy(&dv->cond);
pthread_mutex_destroy(&dv->mutex);
#endif
if (CONFIG_MPEGTS_DEMUXER && dv->type == IEC61883_HDV) {
iec61883_mpeg2_recv_stop(dv->iec61883_mpeg2);
iec61883_mpeg2_close(dv->iec61883_mpeg2);
avpriv_mpegts_parse_close(dv->mpeg_demux);
} else {
iec61883_dv_fb_stop(dv->iec61883_dv);
iec61883_dv_fb_close(dv->iec61883_dv);
av_freep(&dv->dv_demux);
}
while (dv->queue_first) {
DVPacket *packet = dv->queue_first;
dv->queue_first = packet->next;
av_freep(&packet->buf);
av_freep(&packet);
}
iec61883_cmp_disconnect(dv->raw1394, dv->node, dv->output_port,
raw1394_get_local_id(dv->raw1394),
dv->input_port, dv->channel, dv->bandwidth);
raw1394_destroy_handle(dv->raw1394);
return 0;
}
static const AVOption options[] = {
{ "dvtype", "override autodetection of DV/HDV", offsetof(struct iec61883_data, type), AV_OPT_TYPE_INT, {.i64 = IEC61883_AUTO}, IEC61883_AUTO, IEC61883_HDV, AV_OPT_FLAG_DECODING_PARAM, "dvtype" },
{ "auto", "auto detect DV/HDV", 0, AV_OPT_TYPE_CONST, {.i64 = IEC61883_AUTO}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "dvtype" },
{ "dv", "force device being treated as DV device", 0, AV_OPT_TYPE_CONST, {.i64 = IEC61883_DV}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "dvtype" },
{ "hdv" , "force device being treated as HDV device", 0, AV_OPT_TYPE_CONST, {.i64 = IEC61883_HDV}, 0, 0, AV_OPT_FLAG_DECODING_PARAM, "dvtype" },
{ "dvbuffer", "set queue buffer size (in packets)", offsetof(struct iec61883_data, max_packets), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
{ "dvguid", "select one of multiple DV devices by its GUID", offsetof(struct iec61883_data, device_guid), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0, AV_OPT_FLAG_DECODING_PARAM },
{ NULL },
};
static const AVClass iec61883_class = {
.class_name = "iec61883 indev",
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
.category = AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT,
};
const AVInputFormat ff_iec61883_demuxer = {
.name = "iec61883",
.long_name = NULL_IF_CONFIG_SMALL("libiec61883 (new DV1394) A/V input device"),
.priv_data_size = sizeof(struct iec61883_data),
.read_header = iec61883_read_header,
.read_packet = iec61883_read_packet,
.read_close = iec61883_close,
.flags = AVFMT_NOFILE,
.priv_class = &iec61883_class,
};
|
ec268fbf5e5b8ce3ff85f4bdf19c3fdb0b8151df
|
55540f3e86f1d5d86ef6b5d295a63518e274efe3
|
/components/platform/soc/bl808/bl808_std/BSP_Common/ili9881c/bsp_ili9881c.c
|
421afdab7501d9b5c742a37cd1f18d7682508234
|
[
"Apache-2.0"
] |
permissive
|
bouffalolab/bl_iot_sdk
|
bc5eaf036b70f8c65dd389439062b169f8d09daa
|
b90664de0bd4c1897a9f1f5d9e360a9631d38b34
|
refs/heads/master
| 2023-08-31T03:38:03.369853
| 2023-08-16T08:50:33
| 2023-08-18T09:13:27
| 307,347,250
| 244
| 101
|
Apache-2.0
| 2023-08-28T06:29:02
| 2020-10-26T11:16:30
|
C
|
UTF-8
|
C
| false
| false
| 15,269
|
c
|
bsp_ili9881c.c
|
/*
* Copyright (c) 2016-2023 Bouffalolab.
*
* This file is part of
* *** Bouffalolab Software Dev Kit ***
* (see www.bouffalolab.com).
*
* 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. Neither the name of Bouffalo Lab 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.
*/
#include "bsp_ili9881c.h"
#include "hal_dsi.h"
/** @addtogroup BSP_COMMON
* @{
*/
/** @addtogroup ILI9881C
* @{
*/
/** @defgroup ILI9881C_Private_Macros
* @{
*/
/*@} end of group ILI9881C_Private_Macros */
/** @defgroup ILI9881C_Private_Types
* @{
*/
#define u8 uint8_t
#define u16 uint16_t
enum ili9881c_op {
ILI9881C_SWITCH_PAGE,
ILI9881C_COMMAND,
};
struct ili9881c_instr {
enum ili9881c_op op;
union arg {
struct cmd {
u8 cmd;
u8 data;
} cmd;
u8 page;
} arg;
};
struct ili9881c_desc {
const struct ili9881c_instr *init;
const size_t init_length;
};
struct ili9881c_dev {
const mipi_dsi_device_t *dsi;
const struct ili9881c_desc *desc;
};
#define ILI9881C_SWITCH_PAGE_INSTR(_page) \
{ \
.op = ILI9881C_SWITCH_PAGE, \
.arg = { \
.page = (_page), \
}, \
}
#define ILI9881C_COMMAND_INSTR(_cmd, _data) \
{ \
.op = ILI9881C_COMMAND, \
.arg = { \
.cmd = { \
.cmd = (_cmd), \
.data = (_data), \
}, \
}, \
}
/*@} end of group ILI9881C_Private_Types */
/** @defgroup ILI9881C_Private_Variables
* @{
*/
static const struct ili9881c_instr lhr050h41_init[] = {
ILI9881C_SWITCH_PAGE_INSTR(3),
ILI9881C_COMMAND_INSTR(0x01, 0x00),
ILI9881C_COMMAND_INSTR(0x02, 0x00),
ILI9881C_COMMAND_INSTR(0x03, 0x72),
ILI9881C_COMMAND_INSTR(0x04, 0x00),
ILI9881C_COMMAND_INSTR(0x05, 0x00),
ILI9881C_COMMAND_INSTR(0x06, 0x09),
ILI9881C_COMMAND_INSTR(0x07, 0x00),
ILI9881C_COMMAND_INSTR(0x08, 0x00),
ILI9881C_COMMAND_INSTR(0x09, 0x01),
ILI9881C_COMMAND_INSTR(0x0a, 0x00),
ILI9881C_COMMAND_INSTR(0x0b, 0x00),
ILI9881C_COMMAND_INSTR(0x0c, 0x01),
ILI9881C_COMMAND_INSTR(0x0d, 0x00),
ILI9881C_COMMAND_INSTR(0x0e, 0x00),
ILI9881C_COMMAND_INSTR(0x0f, 0x00),
ILI9881C_COMMAND_INSTR(0x10, 0x00),
ILI9881C_COMMAND_INSTR(0x11, 0x00),
ILI9881C_COMMAND_INSTR(0x12, 0x00),
ILI9881C_COMMAND_INSTR(0x13, 0x00),
ILI9881C_COMMAND_INSTR(0x14, 0x00),
ILI9881C_COMMAND_INSTR(0x15, 0x00),
ILI9881C_COMMAND_INSTR(0x16, 0x00),
ILI9881C_COMMAND_INSTR(0x17, 0x00),
ILI9881C_COMMAND_INSTR(0x18, 0x00),
ILI9881C_COMMAND_INSTR(0x19, 0x00),
ILI9881C_COMMAND_INSTR(0x1a, 0x00),
ILI9881C_COMMAND_INSTR(0x1b, 0x00),
ILI9881C_COMMAND_INSTR(0x1c, 0x00),
ILI9881C_COMMAND_INSTR(0x1d, 0x00),
ILI9881C_COMMAND_INSTR(0x1e, 0x40),
ILI9881C_COMMAND_INSTR(0x1f, 0x80),
ILI9881C_COMMAND_INSTR(0x20, 0x05),
ILI9881C_COMMAND_INSTR(0x21, 0x02),
ILI9881C_COMMAND_INSTR(0x22, 0x00),
ILI9881C_COMMAND_INSTR(0x23, 0x00),
ILI9881C_COMMAND_INSTR(0x24, 0x00),
ILI9881C_COMMAND_INSTR(0x25, 0x00),
ILI9881C_COMMAND_INSTR(0x26, 0x00),
ILI9881C_COMMAND_INSTR(0x27, 0x00),
ILI9881C_COMMAND_INSTR(0x28, 0x33),
ILI9881C_COMMAND_INSTR(0x29, 0x02),
ILI9881C_COMMAND_INSTR(0x2a, 0x00),
ILI9881C_COMMAND_INSTR(0x2b, 0x00),
ILI9881C_COMMAND_INSTR(0x2c, 0x00),
ILI9881C_COMMAND_INSTR(0x2d, 0x00),
ILI9881C_COMMAND_INSTR(0x2e, 0x00),
ILI9881C_COMMAND_INSTR(0x2f, 0x00),
ILI9881C_COMMAND_INSTR(0x30, 0x00),
ILI9881C_COMMAND_INSTR(0x31, 0x00),
ILI9881C_COMMAND_INSTR(0x32, 0x00),
ILI9881C_COMMAND_INSTR(0x33, 0x00),
ILI9881C_COMMAND_INSTR(0x34, 0x04),
ILI9881C_COMMAND_INSTR(0x35, 0x00),
ILI9881C_COMMAND_INSTR(0x36, 0x00),
ILI9881C_COMMAND_INSTR(0x37, 0x00),
ILI9881C_COMMAND_INSTR(0x38, 0x3C),
ILI9881C_COMMAND_INSTR(0x39, 0x00),
ILI9881C_COMMAND_INSTR(0x3a, 0x40),
ILI9881C_COMMAND_INSTR(0x3b, 0x40),
ILI9881C_COMMAND_INSTR(0x3c, 0x00),
ILI9881C_COMMAND_INSTR(0x3d, 0x00),
ILI9881C_COMMAND_INSTR(0x3e, 0x00),
ILI9881C_COMMAND_INSTR(0x3f, 0x00),
ILI9881C_COMMAND_INSTR(0x40, 0x00),
ILI9881C_COMMAND_INSTR(0x41, 0x00),
ILI9881C_COMMAND_INSTR(0x42, 0x00),
ILI9881C_COMMAND_INSTR(0x43, 0x00),
ILI9881C_COMMAND_INSTR(0x44, 0x00),
ILI9881C_COMMAND_INSTR(0x50, 0x01),
ILI9881C_COMMAND_INSTR(0x51, 0x23),
ILI9881C_COMMAND_INSTR(0x52, 0x45),
ILI9881C_COMMAND_INSTR(0x53, 0x67),
ILI9881C_COMMAND_INSTR(0x54, 0x89),
ILI9881C_COMMAND_INSTR(0x55, 0xab),
ILI9881C_COMMAND_INSTR(0x56, 0x01),
ILI9881C_COMMAND_INSTR(0x57, 0x23),
ILI9881C_COMMAND_INSTR(0x58, 0x45),
ILI9881C_COMMAND_INSTR(0x59, 0x67),
ILI9881C_COMMAND_INSTR(0x5a, 0x89),
ILI9881C_COMMAND_INSTR(0x5b, 0xab),
ILI9881C_COMMAND_INSTR(0x5c, 0xcd),
ILI9881C_COMMAND_INSTR(0x5d, 0xef),
ILI9881C_COMMAND_INSTR(0x5e, 0x11),
ILI9881C_COMMAND_INSTR(0x5f, 0x01),
ILI9881C_COMMAND_INSTR(0x60, 0x00),
ILI9881C_COMMAND_INSTR(0x61, 0x15),
ILI9881C_COMMAND_INSTR(0x62, 0x14),
ILI9881C_COMMAND_INSTR(0x63, 0x0e),
ILI9881C_COMMAND_INSTR(0x64, 0x0f),
ILI9881C_COMMAND_INSTR(0x65, 0x0c),
ILI9881C_COMMAND_INSTR(0x66, 0x0d),
ILI9881C_COMMAND_INSTR(0x67, 0x06),
ILI9881C_COMMAND_INSTR(0x68, 0x02),
ILI9881C_COMMAND_INSTR(0x69, 0x07),
ILI9881C_COMMAND_INSTR(0x6a, 0x02),
ILI9881C_COMMAND_INSTR(0x6b, 0x02),
ILI9881C_COMMAND_INSTR(0x6c, 0x02),
ILI9881C_COMMAND_INSTR(0x6d, 0x02),
ILI9881C_COMMAND_INSTR(0x6e, 0x02),
ILI9881C_COMMAND_INSTR(0x6f, 0x02),
ILI9881C_COMMAND_INSTR(0x70, 0x02),
ILI9881C_COMMAND_INSTR(0x71, 0x02),
ILI9881C_COMMAND_INSTR(0x72, 0x02),
ILI9881C_COMMAND_INSTR(0x73, 0x02),
ILI9881C_COMMAND_INSTR(0x74, 0x02),
ILI9881C_COMMAND_INSTR(0x75, 0x01),
ILI9881C_COMMAND_INSTR(0x76, 0x00),
ILI9881C_COMMAND_INSTR(0x77, 0x14),
ILI9881C_COMMAND_INSTR(0x78, 0x15),
ILI9881C_COMMAND_INSTR(0x79, 0x0e),
ILI9881C_COMMAND_INSTR(0x7a, 0x0f),
ILI9881C_COMMAND_INSTR(0x7b, 0x0c),
ILI9881C_COMMAND_INSTR(0x7c, 0x0d),
ILI9881C_COMMAND_INSTR(0x7d, 0x06),
ILI9881C_COMMAND_INSTR(0x7e, 0x02),
ILI9881C_COMMAND_INSTR(0x7f, 0x07),
ILI9881C_COMMAND_INSTR(0x80, 0x02),
ILI9881C_COMMAND_INSTR(0x81, 0x02),
//ILI9881C_COMMAND_INSTR(0x82, 0x0F),
ILI9881C_COMMAND_INSTR(0x83, 0x02),
ILI9881C_COMMAND_INSTR(0x84, 0x02),
ILI9881C_COMMAND_INSTR(0x85, 0x02),
ILI9881C_COMMAND_INSTR(0x86, 0x02),
ILI9881C_COMMAND_INSTR(0x87, 0x02),
ILI9881C_COMMAND_INSTR(0x88, 0x02),
ILI9881C_COMMAND_INSTR(0x89, 0x02),
ILI9881C_COMMAND_INSTR(0x8A, 0x02),
ILI9881C_SWITCH_PAGE_INSTR(4),
ILI9881C_COMMAND_INSTR(0x6C, 0x15),
ILI9881C_COMMAND_INSTR(0x6E, 0x2a),
ILI9881C_COMMAND_INSTR(0x6F, 0x33),
ILI9881C_COMMAND_INSTR(0x3A, 0x94),
ILI9881C_COMMAND_INSTR(0x8D, 0x15),
ILI9881C_COMMAND_INSTR(0x87, 0xBA),
ILI9881C_COMMAND_INSTR(0x26, 0x76),
#if(DSI_ILI9881C_BSIT_MODE)
ILI9881C_COMMAND_INSTR(0x2d, 0xff),
ILI9881C_COMMAND_INSTR(0x2f, 0x01),
#else
ILI9881C_COMMAND_INSTR(0x2d, 0x03),
ILI9881C_COMMAND_INSTR(0x2f, 0x00),
#endif
ILI9881C_COMMAND_INSTR(0xB2, 0xD1),
ILI9881C_COMMAND_INSTR(0xB5, 0x06),
ILI9881C_SWITCH_PAGE_INSTR(1),
ILI9881C_COMMAND_INSTR(0x22, 0x0a),
#if(DSI_LANE_NUMBER_USE == 4)
ILI9881C_COMMAND_INSTR(0x25, 0x0a),
ILI9881C_COMMAND_INSTR(0x26, 0x08),
ILI9881C_COMMAND_INSTR(0x27, 0x25),
ILI9881C_COMMAND_INSTR(0x53, 0xa5),
ILI9881C_COMMAND_INSTR(0x55, 0xA2),
#elif(DSI_LANE_NUMBER_USE == 2)
ILI9881C_COMMAND_INSTR(0x53, 0xa1),
ILI9881C_COMMAND_INSTR(0x55, 0xA1),
#endif
ILI9881C_COMMAND_INSTR(0x31, 0x00),
ILI9881C_COMMAND_INSTR(0x50, 0xb7),
ILI9881C_COMMAND_INSTR(0x51, 0xb7),
ILI9881C_COMMAND_INSTR(0x60, 0x22),
ILI9881C_COMMAND_INSTR(0x61, 0x00),
ILI9881C_COMMAND_INSTR(0x62, 0x19),
ILI9881C_COMMAND_INSTR(0x63, 0x10),
ILI9881C_COMMAND_INSTR(0xA0, 0x08),
ILI9881C_COMMAND_INSTR(0xA1, 0x17),
ILI9881C_COMMAND_INSTR(0xA2, 0x1e),
ILI9881C_COMMAND_INSTR(0xA3, 0x0e),
ILI9881C_COMMAND_INSTR(0xA4, 0x13),
ILI9881C_COMMAND_INSTR(0xA5, 0x24),
ILI9881C_COMMAND_INSTR(0xA6, 0x1b),
ILI9881C_COMMAND_INSTR(0xA7, 0x1b),
ILI9881C_COMMAND_INSTR(0xA8, 0x53),
ILI9881C_COMMAND_INSTR(0xA9, 0x1b),
ILI9881C_COMMAND_INSTR(0xAA, 0x28),
ILI9881C_COMMAND_INSTR(0xAB, 0x45),
ILI9881C_COMMAND_INSTR(0xAC, 0x1a),
ILI9881C_COMMAND_INSTR(0xAD, 0x1a),
ILI9881C_COMMAND_INSTR(0xAE, 0x50),
ILI9881C_COMMAND_INSTR(0xAF, 0x21),
ILI9881C_COMMAND_INSTR(0xB0, 0x2c),
ILI9881C_COMMAND_INSTR(0xB1, 0x3b),
ILI9881C_COMMAND_INSTR(0xB2, 0x63),
ILI9881C_COMMAND_INSTR(0xB3, 0x39),
#if(DSI_LANE_NUMBER_USE == 2)
ILI9881C_COMMAND_INSTR(0xB7, 0x03),
#endif
ILI9881C_COMMAND_INSTR(0xC0, 0x08),
ILI9881C_COMMAND_INSTR(0xC1, 0x0c),
ILI9881C_COMMAND_INSTR(0xC2, 0x17),
ILI9881C_COMMAND_INSTR(0xC3, 0x0f),
ILI9881C_COMMAND_INSTR(0xC4, 0x0b),
ILI9881C_COMMAND_INSTR(0xC5, 0x1c),
ILI9881C_COMMAND_INSTR(0xC6, 0x10),
ILI9881C_COMMAND_INSTR(0xC7, 0x16),
ILI9881C_COMMAND_INSTR(0xC8, 0x5b),
ILI9881C_COMMAND_INSTR(0xC9, 0x1a),
ILI9881C_COMMAND_INSTR(0xCA, 0x26),
ILI9881C_COMMAND_INSTR(0xCB, 0x55),
ILI9881C_COMMAND_INSTR(0xCC, 0x1d),
ILI9881C_COMMAND_INSTR(0xCD, 0x1e),
ILI9881C_COMMAND_INSTR(0xCE, 0x52),
ILI9881C_COMMAND_INSTR(0xCF, 0x26),
ILI9881C_COMMAND_INSTR(0xD0, 0x29),
ILI9881C_COMMAND_INSTR(0xD1, 0x45),
ILI9881C_COMMAND_INSTR(0xD2, 0x63),
ILI9881C_COMMAND_INSTR(0xD3, 0x39),
};
static const struct ili9881c_desc lhr050h41_desc = {
.init = lhr050h41_init,
.init_length = sizeof(lhr050h41_init) / sizeof(lhr050h41_init[0]),
};
#if 0
/* embedded device not use this */
const struct mipi_dsi_host_ops ops =
{
.attach = NULL,
.detach = NULL,
.transfer = NULL,
};
static struct mipi_dsi_host host =
{
//.dev=NULL,
.ops = &ops,
};
#endif
static const mipi_dsi_device_t dsi_device = {
//.dev=NULL,
//.host=&host,
.name = { "Ili9881c" },
.channel = 0,
.lanes = DSI_LANE_NUMBER_USE,
.format = MIPI_DSI_DATA_FMT_RGB888,
.mode_flags = (MIPI_DSI_MODE_LPM),
.hs_rate = 500,
.lp_rate = 8,
};
static struct ili9881c_dev ili9881c = {
.dsi = &dsi_device,
.desc = &lhr050h41_desc,
};
/*@} end of group ILI9881C_Private_Variables */
/** @defgroup ILI9881C_Global_Variables
* @{
*/
/*@} end of group ILI9881C_Global_Variables */
/** @defgroup ILI9881C_Private_Fun_Declaration
* @{
*/
/*@} end of group ILI9881C_Private_Fun_Declaration */
/** @defgroup ILI9881C_Private_Functions
* @{
*/
/*@} end of group ILI9881C_Private_Functions */
/** @defgroup ILI9881C_Public_Functions
* @{
*/
/*
* The panel seems to accept some private DCS commands that map
* directly to registers.
*
* It is organised by page, with each page having its own set of
* registers, and the first page looks like it's holding the standard
* DCS commands.
*
* So before any attempt at sending a command or data, we have to be
* sure if we're in the right page or not.
*/
static int ili9881c_switch_page(struct ili9881c_dev *dev, u8 page)
{
u8 buf[4] = { 0xff, 0x98, 0x81, page };
int ret;
ret = mipi_dsi_dcs_write_buffer(dev->dsi, buf, sizeof(buf));
if (ret < 0) {
return ret;
}
return 0;
}
static int ili9881c_send_cmd_data(struct ili9881c_dev *dev, u8 cmd, u8 data)
{
u8 buf[2] = { cmd, data };
int ret;
ret = mipi_dsi_dcs_write_buffer(dev->dsi, buf, sizeof(buf));
if (ret < 0) {
return ret;
}
return 0;
}
static int ili9881c_prepare(struct ili9881c_dev *dev)
{
unsigned int i;
int ret;
mipi_dsi_controller_init(dev->dsi);
ili9881c_switch_page(dev, 0);
mipi_dsi_dcs_enter_sleep_mode(&dsi_device);
bflb_platform_delay_ms(100);
mipi_dsi_dcs_soft_reset(&dsi_device);
bflb_platform_delay_ms(200);
for (i = 0; i < dev->desc->init_length; i++) {
const struct ili9881c_instr *instr = &dev->desc->init[i];
if (instr->op == ILI9881C_SWITCH_PAGE) {
ret = ili9881c_switch_page(dev, instr->arg.page);
} else if (instr->op == ILI9881C_COMMAND)
ret = ili9881c_send_cmd_data(dev, instr->arg.cmd.cmd,
instr->arg.cmd.data);
if (ret) {
return ret;
}
}
ret = ili9881c_switch_page(dev, 0);
if (ret) {
return ret;
}
ret = mipi_dsi_dcs_set_tear_on(dev->dsi, MIPI_DSI_DCS_TEAR_MODE_VBLANK);
if (ret) {
return ret;
}
ret = mipi_dsi_dcs_exit_sleep_mode(dev->dsi);
if (ret) {
return ret;
}
return 0;
}
static int ili9881c_enable(struct ili9881c_dev *dev)
{
mipi_dsi_dcs_set_display_on(dev->dsi);
return 0;
}
static int ili9881c_disable(struct ili9881c_dev *dev)
{
return mipi_dsi_dcs_set_display_off(dev->dsi);
}
static int ili9881c_unprepare(struct ili9881c_dev *dev)
{
mipi_dsi_dcs_enter_sleep_mode(dev->dsi);
return 0;
}
int display_prepare(void)
{
return ili9881c_prepare(&ili9881c);
}
int display_enable(void)
{
return ili9881c_enable(&ili9881c);
}
int display_disable(void)
{
return ili9881c_disable(&ili9881c);
}
int display_unprepare(void)
{
return ili9881c_unprepare(&ili9881c);
}
/*@} end of group ILI9881C_Public_Functions */
/*@} end of group ILI9881C */
/*@} end of group BSP_COMMON */
|
a75a9d0fe886360ddb9ede8ce8f9203a0fba84e5
|
2376f587d9ecf892b2e6af0ba8f35a387b75160d
|
/autosrc/rtpp_timed_task_fin.c
|
42b00599e856353235ec251aa7313789277f408b
|
[
"BSD-2-Clause"
] |
permissive
|
sippy/rtpproxy
|
605939c4afef8cdbb78e09d8fbe1deef80a3828d
|
a7f1b1e3617ca8179f7ff6619d5920ecc615bd20
|
refs/heads/master
| 2023-08-27T21:37:48.239135
| 2023-07-24T20:33:48
| 2023-07-24T22:01:48
| 20,834,852
| 396
| 122
|
BSD-2-Clause
| 2023-01-20T00:39:46
| 2014-06-14T15:22:11
|
Makefile
|
UTF-8
|
C
| false
| false
| 1,693
|
c
|
rtpp_timed_task_fin.c
|
/* Auto-generated by genfincode.sh - DO NOT EDIT! */
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#define RTPP_FINCODE
#include "rtpp_types.h"
#include "rtpp_debug.h"
#include "rtpp_timed_task.h"
#include "rtpp_timed_task_fin.h"
#if defined(RTPP_DEBUG)
static void rtpp_timed_task_cancel_fin(void *pub) {
fprintf(stderr, "Method rtpp_timed_task@%p::cancel (rtpp_timed_task_cancel) is invoked after destruction\x0a", pub);
RTPP_AUTOTRAP();
}
void rtpp_timed_task_fin(struct rtpp_timed_task *pub) {
RTPP_DBG_ASSERT(pub->cancel != (rtpp_timed_task_cancel_t)NULL);
RTPP_DBG_ASSERT(pub->cancel != (rtpp_timed_task_cancel_t)&rtpp_timed_task_cancel_fin);
pub->cancel = (rtpp_timed_task_cancel_t)&rtpp_timed_task_cancel_fin;
}
#endif /* RTPP_DEBUG */
#if defined(RTPP_FINTEST)
#include <assert.h>
#include <stddef.h>
#include "rtpp_mallocs.h"
#include "rtpp_refcnt.h"
#include "rtpp_linker_set.h"
#define CALL_TFIN(pub, fn) ((void (*)(typeof(pub)))((pub)->fn))(pub)
void
rtpp_timed_task_fintest()
{
int naborts_s;
struct {
struct rtpp_timed_task pub;
} *tp;
naborts_s = _naborts;
tp = rtpp_rzmalloc(sizeof(*tp), offsetof(typeof(*tp), pub.rcnt));
assert(tp != NULL);
assert(tp->pub.rcnt != NULL);
tp->pub.cancel = (rtpp_timed_task_cancel_t)((void *)0x1);
CALL_SMETHOD(tp->pub.rcnt, attach, (rtpp_refcnt_dtor_t)&rtpp_timed_task_fin,
&tp->pub);
RTPP_OBJ_DECREF(&(tp->pub));
CALL_TFIN(&tp->pub, cancel);
assert((_naborts - naborts_s) == 1);
free(tp);
}
const static void *_rtpp_timed_task_ftp = (void *)&rtpp_timed_task_fintest;
DATA_SET(rtpp_fintests, _rtpp_timed_task_ftp);
#endif /* RTPP_FINTEST */
|
e357b671da3d490b8797748369164fa5db146f71
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/arch/sh/include/asm/linkage.h
|
3565a4f4009f7f6ba84bff2f6ce25aa46d284588
|
[
"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
| 115
|
h
|
linkage.h
|
#ifndef __ASM_LINKAGE_H
#define __ASM_LINKAGE_H
#define __ALIGN .balign 4
#define __ALIGN_STR ".balign 4"
#endif
|
193505aa4806ece7ad429d9971ddb52148e17be1
|
edf4c0c2c7c4b44a2c9d8f0ae97cff6959559beb
|
/kernel/socket.h
|
2a0f113e0ce5eda4d0e6468fc194e34cd8f68ffc
|
[
"MIT"
] |
permissive
|
brenns10/sos
|
ba32d3d0d384e6cd70ad5e2e75d3b9919de05f12
|
a33facb06432912441a6aef622c2f0f31290bfb1
|
refs/heads/master
| 2022-10-09T16:32:00.035354
| 2022-10-07T06:26:38
| 2022-10-07T06:26:38
| 146,952,495
| 111
| 11
| null | null | null | null |
UTF-8
|
C
| false
| false
| 1,196
|
h
|
socket.h
|
#pragma once
#include <stdint.h>
#include "kernel.h"
#include "list.h"
#include "net.h"
#include "packets.h"
#include "sys/socket.h"
#include "wait.h"
struct socket;
struct sockops {
int (*connect)(struct socket *socket, const struct sockaddr *address,
socklen_t address_len);
int (*bind)(struct socket *socket, const struct sockaddr *address,
socklen_t address_len);
int (*send)(struct socket *socket, const void *buffer, size_t length,
int flags);
int (*recv)(struct socket *socket, void *buffer, size_t length,
int flags);
int (*close)(struct socket *socket);
struct list_head list;
uint32_t proto;
};
struct socket {
int fildes;
struct process *proc;
struct list_head sockets;
struct sockops *ops;
struct {
int sk_bound : 1;
int sk_connected : 1;
int sk_open : 1;
} flags;
struct sockaddr_in src;
struct sockaddr_in dst;
struct list_head recvq;
struct waitlist recvwait;
};
int socket_socket(int domain, int type, int protocol);
void socket_register_proto(struct sockops *ops);
void socket_destroy(struct socket *sock);
struct socket *socket_get_by_fd(struct process *proc, int fd);
void socket_init(void);
|
f670425d64e6aa8ea1a293b194477fd177185f1f
|
bc475d1e6ff23f81167d7a15919f284728033c8a
|
/bindings/js/minify.c
|
4c7d8cfdca58de7a97465193833484a833087957
|
[
"MIT"
] |
permissive
|
tdewolff/minify
|
f1a36b068d295312e4d8e7f138469293f990a74c
|
d979084f173570a86ea0319fa30651da6275bcc2
|
refs/heads/master
| 2023-09-05T07:02:16.533025
| 2023-09-04T08:47:19
| 2023-09-04T08:47:19
| 20,015,012
| 3,700
| 309
|
MIT
| 2023-09-12T19:44:10
| 2014-05-21T09:03:48
|
Go
|
UTF-8
|
C
| false
| false
| 8,156
|
c
|
minify.c
|
#include <node_api.h>
#include <stdlib.h>
#include "minify.h"
napi_status get_string(napi_env env, napi_value v, char **s, size_t *size) {
napi_status status;
napi_valuetype type;
status = napi_typeof(env, v, &type);
if (status != napi_ok) {
return status;
} else if (type != napi_string) {
return (napi_status)napi_string_expected;
}
size_t len, len_read;
status = napi_get_value_string_utf8(env, v, NULL, 0, &len);
if (status != napi_ok) {
return status;
}
*s = (char *)malloc(len+1);
status = napi_get_value_string_utf8(env, v, *s, len+1, &len_read);
if (status != napi_ok) {
free(*s);
return status;
} else if (len != len_read) {
free(*s);
return napi_generic_failure;
}
if (size != NULL) {
*size = len;
}
return napi_ok;
}
void free_char_array(char **array, uint32_t length) {
for (uint32_t i = 0; i < length; i++) {
free(array[i]);
}
free(array);
}
napi_value config(napi_env env, napi_callback_info info) {
napi_status status;
size_t argc = 1;
napi_value argv[1];
status = napi_get_cb_info(env, info, &argc, argv, NULL, NULL);
if (status != napi_ok) {
return NULL;
} else if (argc < 1) {
napi_throw_type_error(env, NULL, "expected config argument");
return NULL;
}
napi_valuetype type;
status = napi_typeof(env, argv[0], &type);
if (status != napi_ok) {
return NULL;
} else if (type != napi_object) {
napi_throw_type_error(env, NULL, "config must be an object");
return NULL;
}
napi_value properties;
status = napi_get_all_property_names(env, argv[0], napi_key_own_only, napi_key_enumerable, napi_key_numbers_to_strings, &properties);
if (status != napi_ok) {
return NULL;
}
uint32_t length;
status = napi_get_array_length(env, properties, &length);
if (status != napi_ok) {
return NULL;
}
char **keys = (char **)malloc(length * sizeof(char *));
char **vals = (char **)malloc(length * sizeof(char *));
for (uint32_t i = 0; i < length; i++) {
napi_value nkey, nval;
status = napi_get_element(env, properties, i, &nkey);
if (status != napi_ok) {
free_char_array(vals, i);
free_char_array(keys, i);
return NULL;
}
status = napi_get_property(env, argv[0], nkey, &nval);
if (status != napi_ok) {
free_char_array(vals, i);
free_char_array(keys, i);
return NULL;
}
status = get_string(env, nkey, &keys[i], NULL);
if (status == napi_string_expected) {
free_char_array(vals, i);
free_char_array(keys, i);
napi_throw_type_error(env, NULL, "config keys must be strings");
return NULL;
} else if (status != napi_ok) {
free_char_array(vals, i);
free_char_array(keys, i);
return NULL;
}
status = napi_typeof(env, nval, &type);
if (status != napi_ok) {
free_char_array(vals, i);
free_char_array(keys, i+1);
return NULL;
} else if (type == napi_boolean || type == napi_number) {
status = napi_coerce_to_string(env, nval, &nval);
} else if (type != napi_string) {
free_char_array(vals, i);
free_char_array(keys, i+1);
napi_throw_type_error(env, NULL, "config values must be strings, integers, or booleans");
return NULL;
}
status = get_string(env, nval, &vals[i], NULL);
if (status != napi_ok) {
free_char_array(vals, i);
free_char_array(keys, i+1);
return NULL;
}
}
char *error = minifyConfig(keys, vals, length);
free_char_array(vals, length);
free_char_array(keys, length);
if (error != NULL) {
napi_throw_error(env, NULL, error);
free(error);
return NULL;
}
return NULL;
}
napi_value string(napi_env env, napi_callback_info info) {
napi_status status;
size_t argc = 2;
napi_value argv[2];
status = napi_get_cb_info(env, info, &argc, argv, NULL, NULL);
if (status != napi_ok) {
return NULL;
} else if (argc < 2) {
napi_throw_type_error(env, NULL, "expected mediatype and input arguments");
return NULL;
}
char *mediatype, *input;
size_t input_length;
status = get_string(env, argv[0], &mediatype, NULL);
if (status == napi_string_expected) {
napi_throw_type_error(env, NULL, "mediatype must be a string");
return NULL;
} else if (status != napi_ok) {
return NULL;
}
status = get_string(env, argv[1], &input, &input_length);
if (status == napi_string_expected) {
free(mediatype);
napi_throw_type_error(env, NULL, "input must be a string");
return NULL;
} else if (status != napi_ok) {
free(mediatype);
return NULL;
}
char *output = (char *)malloc(input_length);
long long output_length;
char *error = minifyString(mediatype, input, input_length, output, &output_length);
free(input);
free(mediatype);
if (error != NULL) {
napi_throw_error(env, NULL, error);
free(error);
free(output);
return NULL;
}
napi_value ret;
status = napi_create_string_utf8(env, output, output_length, &ret);
free(output);
if (status != napi_ok) {
return NULL;
}
return ret;
}
napi_value file(napi_env env, napi_callback_info info) {
napi_status status;
size_t argc = 3;
napi_value argv[3];
status = napi_get_cb_info(env, info, &argc, argv, NULL, NULL);
if (status != napi_ok) {
return NULL;
} else if (argc < 3) {
napi_throw_type_error(env, NULL, "expected mediatype, input, and output arguments");
return NULL;
}
char *mediatype, *input, *output;
status = get_string(env, argv[0], &mediatype, NULL);
if (status == napi_string_expected) {
napi_throw_type_error(env, NULL, "mediatype must be a string");
return NULL;
} else if (status != napi_ok) {
return NULL;
}
status = get_string(env, argv[1], &input, NULL);
if (status == napi_string_expected) {
free(mediatype);
napi_throw_type_error(env, NULL, "input must be a string");
return NULL;
} else if (status != napi_ok) {
free(mediatype);
return NULL;
}
status = get_string(env, argv[2], &output, NULL);
if (status == napi_string_expected) {
free(input);
free(mediatype);
napi_throw_type_error(env, NULL, "output must be a string");
return NULL;
} else if (status != napi_ok) {
free(input);
free(mediatype);
return NULL;
}
char *error = minifyFile(mediatype, input, output);
free(output);
free(input);
free(mediatype);
if (error != NULL) {
napi_throw_error(env, NULL, error);
free(error);
return NULL;
}
return NULL;
}
napi_value init(napi_env env, napi_value exports) {
napi_status status;
napi_value fnConfig, fnString, fnFile;
status = napi_create_function(env, NULL, 0, config, NULL, &fnConfig);
if (status != napi_ok) {
return NULL;
}
status = napi_set_named_property(env, exports, "config", fnConfig);
if (status != napi_ok) {
return NULL;
}
status = napi_create_function(env, NULL, 0, string, NULL, &fnString);
if (status != napi_ok) {
return NULL;
}
status = napi_set_named_property(env, exports, "string", fnString);
if (status != napi_ok) {
return NULL;
}
status = napi_create_function(env, NULL, 0, file, NULL, &fnFile);
if (status != napi_ok) {
return NULL;
}
status = napi_set_named_property(env, exports, "file", fnFile);
if (status != napi_ok) {
return NULL;
}
return exports;
}
NAPI_MODULE_INIT() {
return init(env, exports);
}
|
d15b830532d2c37e9edd3072432a51f53f0a47e1
|
2182f6491025ada9a1466b5033b0b18e1c27f774
|
/kernel.c
|
f5fa2088b30b678e144696df2360fd1304cda80d
|
[
"MIT"
] |
permissive
|
jech/babeld
|
b57e75d173a0dc4dc2e197b5fd5d07db9829ea48
|
3d61ea1e843e2c5f9706c74d1adad4e1d24d44b9
|
refs/heads/master
| 2023-09-06T01:05:51.319978
| 2023-07-26T13:24:39
| 2023-07-26T13:24:39
| 2,145,286
| 333
| 93
|
MIT
| 2023-07-19T01:55:00
| 2011-08-02T21:40:59
|
C
|
UTF-8
|
C
| false
| false
| 3,432
|
c
|
kernel.c
|
/*
Copyright 2007, 2008 by Grégoire Henry, Julien Cristau and Juliusz Chroboczek
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 <sys/utsname.h>
#include <sys/time.h>
#include <sys/param.h>
#include <time.h>
#include "babeld.h"
#ifdef __linux
#include "kernel_netlink.c"
#else
#include "kernel_socket.c"
#endif
/* Like gettimeofday, but returns monotonic time. If POSIX clocks are not
available, falls back to gettimeofday but enforces monotonicity. */
int
gettime(struct timeval *tv)
{
int rc;
static time_t offset = 0, previous = 0;
#if defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0 && defined(CLOCK_MONOTONIC)
static int have_posix_clocks = -1;
if(UNLIKELY(have_posix_clocks < 0)) {
struct timespec ts;
rc = clock_gettime(CLOCK_MONOTONIC, &ts);
if(rc < 0) {
have_posix_clocks = 0;
} else {
have_posix_clocks = 1;
}
}
if(have_posix_clocks) {
struct timespec ts;
int rc;
rc = clock_gettime(CLOCK_MONOTONIC, &ts);
if(rc < 0)
return rc;
tv->tv_sec = ts.tv_sec;
tv->tv_usec = ts.tv_nsec / 1000;
return rc;
}
#endif
rc = gettimeofday(tv, NULL);
if(rc < 0)
return rc;
tv->tv_sec += offset;
if(UNLIKELY(previous > tv->tv_sec)) {
offset += previous - tv->tv_sec;
tv->tv_sec = previous;
}
previous = tv->tv_sec;
return rc;
}
/* If /dev/urandom doesn't exist, this will fail with ENOENT, which the
caller will deal with gracefully. */
int
read_random_bytes(void *buf, int len)
{
int fd, rc;
fd = open("/dev/urandom", O_RDONLY);
if(fd < 0) {
errno = ENOSYS;
return -1;
}
rc = read(fd, buf, len);
if(rc < len)
rc = -1;
close(fd);
return rc;
}
int
add_import_table(int table)
{
if(table < 0 || table > 0xFFFF) return -1;
if(import_table_count > MAX_IMPORT_TABLES - 1) return -2;
import_tables[import_table_count++] = table;
return 0;
}
int
kernel_older_than(const char *sysname, int version, int sub_version)
{
struct utsname un;
int rc;
int v = 0;
int sub_v = 0;
rc = uname(&un);
if(rc < 0)
return -1;
if(strcmp(sysname, un.sysname) != 0)
return -1;
rc = sscanf(un.release, "%d.%d", &v, &sub_v);
if(rc < 2)
return -1;
return (v < version || (v == version && sub_v < sub_version));
}
|
0925a31d2e6c0022aebbac2fe34a1da1cfad682f
|
8380b5eb12e24692e97480bfa8939a199d067bce
|
/Trochilus/base/include/eventwaiter/EventWaiterData.h
|
904eaf0bd5875b33fa99a679afa2a99a159a7b13
|
[
"LicenseRef-scancode-warranty-disclaimer"
] |
no_license
|
RamadhanAmizudin/malware
|
788ee745b5bb23b980005c2af08f6cb8763981c2
|
62d0035db6bc9aa279b7c60250d439825ae65e41
|
refs/heads/master
| 2023-02-05T13:37:18.909646
| 2023-01-26T08:43:18
| 2023-01-26T08:43:18
| 53,407,812
| 873
| 291
| null | 2023-01-26T08:43:19
| 2016-03-08T11:44:21
|
C++
|
UTF-8
|
C
| false
| false
| 92
|
h
|
EventWaiterData.h
|
#pragma once
typedef BOOL (*FnEventNotifyCallback)(LPCTSTR eventname, LPVOID lpParameter);
|
f652a3169182bcd2e3c4c39ca5f8d55627753b6a
|
fdbb74a95924e2677466614f6ab6e2bb13b2a95a
|
/libc/nt/dll.h
|
77f27cb677b5ba0c4b62ec1bcfb1f96d9f6cb156
|
[
"ISC"
] |
permissive
|
jart/cosmopolitan
|
fb11b5658939023977060a7c6c71a74093d9cb44
|
0d748ad58e1063dd1f8560f18a0c75293b9415b7
|
refs/heads/master
| 2023-09-06T09:17:29.303607
| 2023-09-02T03:49:13
| 2023-09-02T03:50:18
| 272,457,606
| 11,887
| 435
|
ISC
| 2023-09-14T17:47:58
| 2020-06-15T14:16:13
|
C
|
UTF-8
|
C
| false
| false
| 4,067
|
h
|
dll.h
|
#ifndef COSMOPOLITAN_LIBC_NT_DLL_H_
#define COSMOPOLITAN_LIBC_NT_DLL_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/* ░░░░
▒▒▒░░░▒▒▒▒▒▒▒▓▓▓░
▒▒▒▒░░░▒▒▒▒▒▒▓▓▓▓▓▓░
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓░
▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▒ ▒▒▒▓▓█
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
░▒▒▒░░░░▒▒▒▒▒▒▓▓▓▓▓▓ █▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓░ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
▒▒▒▒░░░▒▒▒▒▒▒▒▓▓▓▓▓▓ ▒▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▒
▒▒▒▒▓▓ ▓▒▒▓▓▓▓ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
▒▓ ▓▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓
░░░░░░░░░░░▒▒▒▒ ▓▓▓▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓█
▒▒░░░░░░░░░░▒▒▒▒▒▓▓▓ ▓▓▓▓▓▒▒▒▒▒▒▒▒▒▒▓▓▓
░▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓░ ░▓███▓
▒▒░░░░░░░░░░▒▒▒▒▒▓▓░ ▒▓▓▓▒▒▒ ░▒▒▒▓ ████████████
▒▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▒▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒░ ░███
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ███
▒▒░░░░░░░░░░▒▒▒▒▒▒▓▓ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ▓██
▒░░░░░░░░░░░▒▒▒▒▒▓▓ ▓▓▓▓▒▒▒▒▒▒▒▒░░░▒▒▒▒▒▓ ▓██
▒▒░░░▒▒▒░░░▒▒░▒▒▒▓▓▒ ▒▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▒ ███
░▒▓ ░▓▓▓▓▒▒▒▒▒▒▒▒░░░░▒▒▒▒▓ ▓██
╔────────────────────────────────────────────────────────────────▀▀▀─────────│─╗
│ cosmopolitan § new technology » dynamic link libraries ─╬─│┼
╚────────────────────────────────────────────────────────────────────────────│*/
int64_t LoadLibrary(const char16_t *lpLibFileName);
int64_t LoadLibraryEx(const char16_t *lpLibFileName, int64_t hFile,
uint32_t dwFlags);
uint32_t GetModuleFileNameA(int64_t hModule, char *lpFilename, uint32_t nSize);
intptr_t GetModuleHandle(const char *opt_lpModuleName);
intptr_t GetModuleHandleW(const char16_t *opt_lpModuleName);
void *GetProcAddress(int64_t hModule, const char *lpProcName);
int32_t FreeResource(int64_t hResData);
intptr_t LockResource(int64_t hResData);
int32_t FreeLibrary(int64_t hLibModule);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_NT_DLL_H_ */
|
0b16ff0546fcdd247593d455d6aea20ad282c52f
|
e8b04bef9aa1ac8e2c109dd315f133c8f4d28ae6
|
/projects/robots/gctronic/e-puck/controllers/e-puck2_server/play_melody.c
|
a57fbb38338fa35e097f03daf6586b17bfba7379
|
[
"Apache-2.0"
] |
permissive
|
cyberbotics/webots
|
f075dacf4067e8dcebbfd89e8690df8525f6d745
|
8aba6eaae76989facf3442305c8089d3cc366bcf
|
refs/heads/master
| 2023-08-31T09:41:13.205940
| 2023-08-18T10:48:30
| 2023-08-18T10:48:30
| 156,228,018
| 2,495
| 1,525
|
Apache-2.0
| 2023-08-28T16:30:33
| 2018-11-05T14:09:10
|
C++
|
UTF-8
|
C
| false
| false
| 15,748
|
c
|
play_melody.c
|
/*
File : play_melody.c
Author : Eliot Ferragni, adapted by Olivier Michel
Date : 25 january 2019
REV 1.1
Functions and defines to play little melodies on the speaker
Adapted from the code written by Dipto Pratyaksa
Taken from https://www.princetronics.com/supermariothemesong/
*/
#include "play_melody.h"
#include <stddef.h>
// Mission Impossible
static const uint16_t mission_impossible_melody[] = {NOTE_G4, 0, 0, NOTE_G4, 0, 0, NOTE_AS4, 0, NOTE_C5, 0,
NOTE_G4, 0, 0, NOTE_G4, 0, 0, NOTE_F4, 0, NOTE_FS4, 0,
NOTE_G4, 0, 0, NOTE_G4, 0, 0, NOTE_AS4, 0, NOTE_C5, 0,
NOTE_G4, 0, 0, NOTE_G4, 0, 0, NOTE_F4, 0, NOTE_FS4, 0,
NOTE_AS5, NOTE_G5, NOTE_D5, 0, 0, 0, 0, 0, 0, 0,
NOTE_AS5, NOTE_G5, NOTE_CS5, 0, 0, 0, 0, 0, 0, 0,
NOTE_AS5, NOTE_G5, NOTE_C5, 0, 0, 0, 0, 0, 0, 0,
NOTE_AS4, NOTE_C5, 0, 0, 0, 0, 0, 0, 0, 0};
static const float mission_impossible_tempo[] = {
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12};
// We are the champions
static const uint16_t champions_melody[] = {
NOTE_F5, NOTE_E5, NOTE_F5, NOTE_E5, NOTE_C5, 0, NOTE_A4, NOTE_D5, NOTE_A4, NOTE_A3, 0, NOTE_G3,
0, NOTE_F3, 0, 0, NOTE_G3, NOTE_C5, NOTE_F5, NOTE_G5, NOTE_A5, NOTE_C6, NOTE_A5, NOTE_D5,
NOTE_E5, NOTE_D5, 0, NOTE_D4, NOTE_C4, NOTE_AS3, NOTE_A3, 0, 0, NOTE_D5, NOTE_C5, NOTE_D5,
NOTE_C5, NOTE_AS4, NOTE_AS5, NOTE_A5, NOTE_AS5, NOTE_A5, NOTE_G5, NOTE_A5, NOTE_F5, NOTE_AS5, NOTE_A5, NOTE_F5,
NOTE_AS5, NOTE_GS5, NOTE_F5, NOTE_AS5, NOTE_GS5, NOTE_F5, 0, NOTE_DS5, NOTE_C5, NOTE_F5};
static const float champions_tempo[] = {2.25, 9, 9, 4.5, 4.5, 9, 9, 4.5, 4.5, 18, 18, 18, 18, 4.5, 18,
18, 4.5, 9, 2.25, 9, 9, 4.5, 4.5, 9, 9, 4.5, 9, 9, 9, 9,
4.5, 4.5, 4.5, 3, 4.5, 9, 3, 3, 3, 4.5, 9, 3, 3, 3, 4.5,
9, 3, 4.5, 9, 3, 4.5, 9, 3, 3, 2.25, 9, 9, 2.25};
static const uint16_t russia_melody[] = {0, 0, NOTE_AS4, NOTE_DS5, NOTE_AS4, NOTE_C5, NOTE_D5, NOTE_G4,
NOTE_C5, NOTE_AS4, NOTE_GS4, NOTE_AS4, NOTE_DS4, NOTE_DS4, NOTE_F4, NOTE_F4,
NOTE_G4, NOTE_GS4, NOTE_GS4, NOTE_AS4, NOTE_C5, NOTE_D5, NOTE_DS5, NOTE_F5};
static const float russia_tempo[] = {9, 9, 9, 3, 4.5, 9, 3, 3, 3, 4.5, 9, 3, 4.5, 9, 3, 4.5, 9, 3, 4.5, 9, 3, 4.5, 9, 1.5};
// Mario main theme
static const uint16_t mario_melody[] = {
NOTE_E5, NOTE_E5, 0, NOTE_E5, 0, NOTE_C5, NOTE_E5, 0, NOTE_G5, 0, 0, 0, NOTE_G4,
0, 0, 0, NOTE_C5, 0, 0, NOTE_G4, 0, 0, NOTE_E4, 0, 0, NOTE_A4,
0, NOTE_B4, 0, NOTE_AS4, NOTE_A4, 0, NOTE_G4, NOTE_E5, NOTE_G5, NOTE_A5, 0, NOTE_F5, NOTE_G5,
0, NOTE_E5, 0, NOTE_C5, NOTE_D5, NOTE_B4, 0, 0, NOTE_C5, 0, 0, NOTE_G4, 0,
0, NOTE_E4, 0, 0, NOTE_A4, 0, NOTE_B4, 0, NOTE_AS4, NOTE_A4, 0, NOTE_G4, NOTE_E5,
NOTE_G5, NOTE_A5, 0, NOTE_F5, NOTE_G5, 0, NOTE_E5, 0, NOTE_C5, NOTE_D5, NOTE_B4, 0, 0};
static const float mario_tempo[] = {
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 9, 9, 9, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 9, 9, 9, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
};
// Underworld
static const uint16_t underworld_melody[] = {
NOTE_C4, NOTE_C5, NOTE_A3, NOTE_A4, NOTE_AS3, NOTE_AS4, 0, 0, NOTE_C4, NOTE_C5, NOTE_A3, NOTE_A4,
NOTE_AS3, NOTE_AS4, 0, 0, NOTE_F3, NOTE_F4, NOTE_D3, NOTE_D4, NOTE_DS3, NOTE_DS4, 0, 0,
NOTE_F3, NOTE_F4, NOTE_D3, NOTE_D4, NOTE_DS3, NOTE_DS4, 0, 0, NOTE_DS4, NOTE_CS4, NOTE_D4, NOTE_CS4,
NOTE_DS4, NOTE_D4, NOTE_GS3, NOTE_G3, NOTE_CS4, NOTE_C4, NOTE_FS4, NOTE_F4, NOTE_E3, NOTE_AS4, NOTE_A4, NOTE_GS4,
NOTE_DS4, NOTE_B3, NOTE_AS3, NOTE_A3, NOTE_GS3, 0, 0, 0};
static const float underworld_tempo[] = {12, 12, 12, 12, 12, 12, 6, 3, 12, 12, 12, 12, 12, 12, 6, 3, 12, 12, 12,
12, 12, 12, 6, 3, 12, 12, 12, 12, 12, 12, 6, 6, 18, 18, 18, 6, 6, 6,
6, 6, 6, 18, 18, 18, 18, 18, 18, 10, 10, 10, 10, 10, 10, 3, 3, 3};
// mario start
static const uint16_t mario_start_melody[] = {NOTE_C5, NOTE_E5, NOTE_G5, NOTE_C5, NOTE_E5, NOTE_G5, NOTE_E5,
0, NOTE_C5, NOTE_DS5, NOTE_FS5, NOTE_C5, NOTE_DS5, NOTE_FS5,
NOTE_DS5, 0, NOTE_D5, NOTE_F5, NOTE_AS5, NOTE_D5, NOTE_F5,
NOTE_AS5, NOTE_AS5, NOTE_AS5, NOTE_AS5, NOTE_C6, 0};
static const float mario_start_tempo[] = {16, 16, 16, 16, 16, 16, 12, 12, 16, 16, 16, 16, 16, 16,
12, 12, 16, 16, 16, 16, 16, 16, 19, 19, 19, 10, 10};
// Mario death
static const uint16_t mario_death_melody[] = {NOTE_B3, NOTE_F4, 0, NOTE_F4, NOTE_F4, NOTE_E4,
NOTE_D4, NOTE_C4, NOTE_E3, 0, NOTE_E3, NOTE_C3};
static const float mario_death_tempo[] = {12, 12, 12, 12, 9, 9, 9, 12, 12, 16, 12, 12};
// Mario flag pole
static const uint16_t mario_flagpole[] = {NOTE_G2, NOTE_C3, NOTE_E3, NOTE_G3, NOTE_C4, NOTE_E4, NOTE_G4,
NOTE_E4, NOTE_GS2, NOTE_C3, NOTE_DS3, NOTE_GS3, NOTE_C4, NOTE_DS4,
NOTE_GS4, NOTE_DS4, NOTE_AS2, NOTE_D3, NOTE_F3, NOTE_AS3, NOTE_D4,
NOTE_F4, NOTE_AS4, NOTE_B4, NOTE_B4, NOTE_B4, NOTE_C5};
static const float mario_flagpole_tempo[] = {15, 15, 15, 15, 15, 15, 4.5, 4.5, 15, 15, 15, 15, 15, 15,
4.5, 4.5, 15, 15, 15, 15, 15, 15, 4.5, 15, 15, 15, 3};
// Walking
static const uint16_t walking_melody[] = {NOTE_F3, NOTE_A3, NOTE_C3, NOTE_E3, NOTE_F3, NOTE_A3, NOTE_C3, NOTE_D3, NOTE_E3};
static const float walking_melody_tempo[] = {6, 9, 6, 9, 6, 9, 12, 12, 12};
// Pirates of the Caribbean main theme
static const uint16_t pirate_melody[] = {
NOTE_E4, NOTE_G4, NOTE_A4, NOTE_A4, 0, NOTE_A4, NOTE_B4, NOTE_C5, NOTE_C5, 0, NOTE_C5, NOTE_D5, NOTE_B4, NOTE_B4, 0, NOTE_A4,
NOTE_G4, NOTE_A4, 0, NOTE_E4, NOTE_G4, NOTE_A4, NOTE_A4, 0, NOTE_A4, NOTE_B4, NOTE_C5, NOTE_C5, 0, NOTE_C5, NOTE_D5, NOTE_B4,
NOTE_B4, 0, NOTE_A4, NOTE_G4, NOTE_A4, 0, NOTE_E4, NOTE_G4, NOTE_A4, NOTE_A4, 0, NOTE_A4, NOTE_C5, NOTE_D5, NOTE_D5, 0,
NOTE_D5, NOTE_E5, NOTE_F5, NOTE_F5, 0, NOTE_E5, NOTE_D5, NOTE_E5, NOTE_A4, 0, NOTE_A4, NOTE_B4, NOTE_C5, NOTE_C5, 0, NOTE_D5,
NOTE_E5, NOTE_A4, 0, NOTE_A4, NOTE_C5, NOTE_B4, NOTE_B4, 0, NOTE_C5, NOTE_A4, NOTE_B4, 0, NOTE_A4, NOTE_A4,
// Repeat of first part
NOTE_A4, NOTE_B4, NOTE_C5, NOTE_C5, 0, NOTE_C5, NOTE_D5, NOTE_B4, NOTE_B4, 0, NOTE_A4, NOTE_G4, NOTE_A4, 0, NOTE_E4, NOTE_G4,
NOTE_A4, NOTE_A4, 0, NOTE_A4, NOTE_B4, NOTE_C5, NOTE_C5, 0, NOTE_C5, NOTE_D5, NOTE_B4, NOTE_B4, 0, NOTE_A4, NOTE_G4, NOTE_A4,
0, NOTE_E4, NOTE_G4, NOTE_A4, NOTE_A4, 0, NOTE_A4, NOTE_C5, NOTE_D5, NOTE_D5, 0, NOTE_D5, NOTE_E5, NOTE_F5, NOTE_F5, 0,
NOTE_E5, NOTE_D5, NOTE_E5, NOTE_A4, 0, NOTE_A4, NOTE_B4, NOTE_C5, NOTE_C5, 0, NOTE_D5, NOTE_E5, NOTE_A4, 0, NOTE_A4, NOTE_C5,
NOTE_B4, NOTE_B4, 0, NOTE_C5, NOTE_A4, NOTE_B4, 0,
// End of Repeat
NOTE_E5, 0, 0, NOTE_F5, 0, 0, NOTE_E5, NOTE_E5, 0, NOTE_G5, 0, NOTE_E5, NOTE_D5, 0, 0, NOTE_D5, 0, 0, NOTE_C5, 0, 0, NOTE_B4,
NOTE_C5, 0, NOTE_B4, 0, NOTE_A4, NOTE_E5, 0, 0, NOTE_F5, 0, 0, NOTE_E5, NOTE_E5, 0, NOTE_G5, 0, NOTE_E5, NOTE_D5, 0, 0,
NOTE_D5, 0, 0, NOTE_C5, 0, 0, NOTE_B4, NOTE_C5, 0, NOTE_B4, 0, NOTE_A4};
static const float pirate_tempo[] = {
10, 10, 5, 10, 10, 10, 10, 5, 10, 10, 10, 10, 5, 10, 10, 10, 10, 3, 10, 10, 10, 5, 10, 10, 10, 10, 5, 10, 10, 10, 10, 5, 10,
10, 10, 10, 3, 10, 10, 10, 5, 10, 10, 10, 10, 5, 10, 10, 10, 10, 5, 10, 10, 10, 10, 3, 10, 10, 10, 10, 5, 10, 10, 5, 10, 5,
10, 10, 10, 5, 10, 10, 10, 10, 3, 3, 5, 10,
// Repeat of First Part
10, 10, 5, 10, 10, 10, 10, 5, 10, 10, 10, 10, 3, 10, 10, 10, 5, 10, 10, 10, 10, 5, 10, 10, 10, 10, 5, 10, 10, 10, 10, 3, 10,
10, 10, 5, 10, 10, 10, 10, 5, 10, 10, 10, 10, 5, 10, 10, 10, 10, 10, 10, 10, 10, 10, 5, 10, 10, 5, 10, 10, 10, 10, 10, 5, 10,
10, 10, 10, 3, 3,
// End of Repeat
5, 10, 5, 5, 10, 5, 10, 10, 10, 10, 10, 10, 10, 10, 5, 5, 10, 5, 5, 10, 5, 10, 10, 10, 10, 10, 2, 5, 10, 5, 5, 10, 5, 10, 10,
10, 10, 10, 10, 10, 10, 5, 5, 10, 5, 5, 10, 5, 10, 10, 10, 10, 10, 2};
// Simpson main theme
static const uint16_t simpson_melody[] = {NOTE_D3, 0, 0, NOTE_E3, 0, NOTE_FS3, 0, NOTE_A3, NOTE_G3,
0, 0, NOTE_E3, 0, NOTE_C3, 0, NOTE_A2, NOTE_FS2, NOTE_FS2,
NOTE_FS2, NOTE_G2, 0, NOTE_FS3, NOTE_FS3, NOTE_FS3, NOTE_G3, NOTE_AS3, 0,
0, NOTE_B3, 0, 0, 0, 0, 0};
static const float simpson_tempo[] = {12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12};
// Star Wars
static const uint16_t starwars_melody[] = {NOTE_A4, NOTE_A4, NOTE_A4, NOTE_F4, NOTE_C5, NOTE_A4, NOTE_F4, NOTE_C5, NOTE_A4, 0,
NOTE_E5, NOTE_E5, NOTE_E5, NOTE_F5, NOTE_C5, NOTE_GS4, NOTE_F4, NOTE_C5, NOTE_A4};
static const float starwars_tempo[] = {3.6, 3.6, 3.6, 4.8, 12, 3.6, 4.8, 12, 3.6, 2, 3.6, 3.6, 3.6, 4.8, 12, 3.6, 4.8, 12, 3.6};
// Sandstorms
static const uint16_t sandstorms_melody[] = {
NOTE_B4, NOTE_B4, NOTE_B4, NOTE_B4, NOTE_B4, 0, NOTE_B4, NOTE_B4, NOTE_B4, NOTE_B4, NOTE_B4, NOTE_B4, NOTE_B4,
0, NOTE_E5, NOTE_E5, NOTE_E5, NOTE_E5, NOTE_E5, NOTE_E5, NOTE_E5, 0, NOTE_D5, NOTE_D5, NOTE_D5, NOTE_D5,
NOTE_D5, NOTE_D5, NOTE_D5, 0, NOTE_A4, NOTE_A4, NOTE_B4, NOTE_B4, NOTE_B4, NOTE_B4, NOTE_B4, 0, NOTE_B4,
NOTE_B4, NOTE_B4, NOTE_B4, NOTE_B4, NOTE_B4, NOTE_B4, 0, NOTE_E5, NOTE_E5, NOTE_B4, NOTE_B4, NOTE_B4, NOTE_B4,
NOTE_B4, 0, NOTE_B4, NOTE_B4, NOTE_B4, NOTE_B4, NOTE_B4, NOTE_B4, NOTE_B4, 0};
static const float sandstorms_tempo[] = {24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24};
// seven nation army by White Stripes
static const uint16_t seven_nation_army_melody[] = {0, NOTE_D4, NOTE_D4, 0, NOTE_F4, 0, NOTE_D4, 0, NOTE_C4, NOTE_AS3, NOTE_A3,
0, NOTE_D4, NOTE_D4, 0, NOTE_F4, 0, NOTE_D4, 0, NOTE_C4, NOTE_AS3, NOTE_A3,
0, NOTE_D4, NOTE_D4, 0, NOTE_F4, 0, NOTE_D4, 0, NOTE_C4, NOTE_AS3, NOTE_A3,
0};
static const float seven_nation_army_tempo[] = {12, 3, 20, 20, 20, 9, 20, 9, 9, 2.2, 2.2, 70, 3, 20, 20, 20, 9,
20, 9, 9, 2.2, 2.2, 70, 3, 20, 20, 20, 9, 20, 9, 9, 2.2, 2.2, 70};
static const melody_t melodies[NB_SONGS] = {
{.notes = mission_impossible_melody,
.tempo = mission_impossible_tempo,
.length = sizeof(mission_impossible_melody) / sizeof(uint16_t)},
{.notes = champions_melody, .tempo = champions_tempo, .length = sizeof(champions_melody) / sizeof(uint16_t)},
{.notes = russia_melody, .tempo = russia_tempo, .length = sizeof(russia_melody) / sizeof(uint16_t)},
{.notes = mario_melody, .tempo = mario_tempo, .length = sizeof(mario_melody) / sizeof(uint16_t)},
{.notes = underworld_melody, .tempo = underworld_tempo, .length = sizeof(underworld_melody) / sizeof(uint16_t)},
{.notes = mario_start_melody, .tempo = mario_start_tempo, .length = sizeof(mario_start_melody) / sizeof(uint16_t)},
{.notes = mario_death_melody, .tempo = mario_death_tempo, .length = sizeof(mario_death_melody) / sizeof(uint16_t)},
{.notes = mario_flagpole, .tempo = mario_flagpole_tempo, .length = sizeof(mario_flagpole) / sizeof(uint16_t)},
{.notes = walking_melody, .tempo = walking_melody_tempo, .length = sizeof(walking_melody) / sizeof(uint16_t)},
{.notes = pirate_melody, .tempo = pirate_tempo, .length = sizeof(pirate_melody) / sizeof(uint16_t)},
{.notes = simpson_melody, .tempo = simpson_tempo, .length = sizeof(simpson_melody) / sizeof(uint16_t)},
{.notes = starwars_melody, .tempo = starwars_tempo, .length = sizeof(starwars_melody) / sizeof(uint16_t)},
{.notes = sandstorms_melody, .tempo = sandstorms_tempo, .length = sizeof(sandstorms_melody) / sizeof(uint16_t)},
{.notes = seven_nation_army_melody,
.tempo = seven_nation_army_tempo,
.length = sizeof(seven_nation_army_melody) / sizeof(uint16_t)}};
static WbDeviceTag speaker = 0;
static double volume = 1.0;
static melody_t *melody = NULL;
static uint16_t melody_step = 0;
static double melody_time = 0;
static double next_tone = 0;
static double next_silence = 0;
static void reset() {
melody = NULL;
melody_step = 0;
melody_time = 0;
next_tone = 0;
next_silence = 0;
}
void play_melody_set_song(song_selection_t choice) {
reset();
melody = &melodies[choice];
}
void play_melody_set_melody(melody_t *m) {
reset();
melody = m;
}
void play_melody_set_speaker(WbDeviceTag s) {
speaker = s;
}
void play_melody_stop() {
wb_speaker_stop(speaker, NULL);
reset();
}
void play_melody_step(double tempo) {
if (melody == NULL)
return;
if (melody_time >= next_tone) {
const uint16_t note = melody->notes[melody_step];
const double pitch = (double)note / (double)NOTE_A4;
// to calculate the note duration, take one second
// divided by the note type.
// e.g. quarter note = 1000 / 4, eighth note = 1000/8, etc.
const uint16_t duration = 1000 / melody->tempo[melody_step];
next_silence = melody_time + duration;
// to distinguish the notes, set a minimum time between them.
// the note's duration + 30% seems to work well:
next_tone = melody_time + 1.3 * duration;
wb_speaker_play_sound(speaker, speaker, "sounds/440Hz.wav", volume, pitch, 0, true);
melody_step++;
} else if (melody_time >= next_silence) {
wb_speaker_stop(speaker, NULL);
next_silence = 0;
if (melody_step == melody->length)
reset();
}
melody_time += tempo;
}
|
186a84d3b22ac8953b47ef9f83a0f510a2448b90
|
c0bfd93cd7f26a271268e504959256f1e02c6806
|
/components/libsodium/port/randombytes_esp8266.c
|
1023def69c1edba61893e43b68748a8f5eba077a
|
[
"Apache-2.0"
] |
permissive
|
espressif/ESP8266_RTOS_SDK
|
606f396e92d2675d9854f0fabd88587fbbbaf267
|
af0cdc36fa2600033d0a09301c754008cf1503c1
|
refs/heads/master
| 2023-08-24T22:40:15.373553
| 2023-05-06T02:04:24
| 2023-05-06T02:04:24
| 27,584,181
| 3,163
| 1,749
|
Apache-2.0
| 2023-08-09T10:48:13
| 2014-12-05T09:27:12
|
C
|
UTF-8
|
C
| false
| false
| 1,516
|
c
|
randombytes_esp8266.c
|
// Copyright 2017 Espressif Systems (Shanghai) PTE LTD
//
// 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 "randombytes_default.h"
#include "esp_system.h"
static void randombytes_esp8266_random_buf(void * const buf, const size_t size)
{
uint8_t *p = (uint8_t *)buf;
for (size_t i = 0; i < size; i++) {
p[i] = esp_random();
}
}
static const char *randombytes_esp8266_implementation_name(void)
{
return "esp8266";
}
/*
Plug the ESP8266 hardware RNG into libsodium's custom RNG support, as per
https://download.libsodium.org/doc/advanced/custom_rng.html
Note that this RNG is selected by default (see randombytes_default.h), so there
is no need to call randombytes_set_implementation().
*/
const struct randombytes_implementation randombytes_esp8266_implementation = {
.implementation_name = randombytes_esp8266_implementation_name,
.random = esp_random,
.stir = NULL,
.uniform = NULL,
.buf = randombytes_esp8266_random_buf,
.close = NULL,
};
|
bb922c914e72d893b7edb182d80f7182c7cee360
|
c41923647d26f644969fa93e1f958928f0c51a40
|
/src_darwin/addr_any.h
|
de54dde2d2cf2e6bbb448ad753eda291f21dece7
|
[
"MIT"
] |
permissive
|
coolxv/cpp-stub
|
43fc9ac76f07542196cb58e335d2b3d8ea9b2c2f
|
41c1a8e5526706cefa14f7c2b709127b3ab1b5bb
|
refs/heads/master
| 2023-09-01T13:34:32.083194
| 2023-08-21T16:46:10
| 2023-08-21T16:46:10
| 101,992,269
| 215
| 77
|
MIT
| 2021-12-16T07:30:45
| 2017-08-31T11:08:31
|
C++
|
UTF-8
|
C
| false
| false
| 56
|
h
|
addr_any.h
|
#ifndef __ADDR_ANY_H__
#define __ADDR_ANY_H__
#endif
|
0c250fa7e2b2ad6e81a0726788680109f2fd88f7
|
d38ed5f31d74a79a054ed55dd9123a8d615283b9
|
/third_party/libgit2/include/git2/oid.h
|
7e071bac7d12599412ea807bd76501b33b20ace2
|
[
"Apache-2.0",
"GPL-2.0-only",
"LicenseRef-scancode-public-domain",
"GCC-exception-2.0",
"LGPL-2.0-or-later",
"Zlib",
"LGPL-2.1-or-later",
"LGPL-2.1-only",
"ISC",
"MIT"
] |
permissive
|
chigraph/chigraph
|
8ff76a14337da29fa2b2a84d5c35f2eac4156c6e
|
6981bdd6763db54edfe284c1f7d223193584c69a
|
refs/heads/master
| 2022-12-21T13:46:57.273039
| 2022-12-17T18:41:19
| 2022-12-17T18:41:19
| 60,776,831
| 364
| 65
|
Apache-2.0
| 2019-12-13T14:46:43
| 2016-06-09T13:27:37
|
C++
|
UTF-8
|
C
| false
| false
| 8,280
|
h
|
oid.h
|
/*
* Copyright (C) the libgit2 contributors. All rights reserved.
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_git_oid_h__
#define INCLUDE_git_oid_h__
#include "common.h"
#include "types.h"
/**
* @file git2/oid.h
* @brief Git object id routines
* @defgroup git_oid Git object id routines
* @ingroup Git
* @{
*/
GIT_BEGIN_DECL
/** Size (in bytes) of a raw/binary oid */
#define GIT_OID_RAWSZ 20
/** Size (in bytes) of a hex formatted oid */
#define GIT_OID_HEXSZ (GIT_OID_RAWSZ * 2)
/** Minimum length (in number of hex characters,
* i.e. packets of 4 bits) of an oid prefix */
#define GIT_OID_MINPREFIXLEN 4
/** Unique identity of any object (commit, tree, blob, tag). */
typedef struct git_oid {
/** raw binary formatted id */
unsigned char id[GIT_OID_RAWSZ];
} git_oid;
/**
* Parse a hex formatted object id into a git_oid.
*
* @param out oid structure the result is written into.
* @param str input hex string; must be pointing at the start of
* the hex sequence and have at least the number of bytes
* needed for an oid encoded in hex (40 bytes).
* @return 0 or an error code
*/
GIT_EXTERN(int) git_oid_fromstr(git_oid *out, const char *str);
/**
* Parse a hex formatted null-terminated string into a git_oid.
*
* @param out oid structure the result is written into.
* @param str input hex string; must be null-terminated.
* @return 0 or an error code
*/
GIT_EXTERN(int) git_oid_fromstrp(git_oid *out, const char *str);
/**
* Parse N characters of a hex formatted object id into a git_oid.
*
* If N is odd, the last byte's high nibble will be read in and the
* low nibble set to zero.
*
* @param out oid structure the result is written into.
* @param str input hex string of at least size `length`
* @param length length of the input string
* @return 0 or an error code
*/
GIT_EXTERN(int) git_oid_fromstrn(git_oid *out, const char *str, size_t length);
/**
* Copy an already raw oid into a git_oid structure.
*
* @param out oid structure the result is written into.
* @param raw the raw input bytes to be copied.
*/
GIT_EXTERN(void) git_oid_fromraw(git_oid *out, const unsigned char *raw);
/**
* Format a git_oid into a hex string.
*
* @param out output hex string; must be pointing at the start of
* the hex sequence and have at least the number of bytes
* needed for an oid encoded in hex (40 bytes). Only the
* oid digits are written; a '\\0' terminator must be added
* by the caller if it is required.
* @param id oid structure to format.
*/
GIT_EXTERN(void) git_oid_fmt(char *out, const git_oid *id);
/**
* Format a git_oid into a partial hex string.
*
* @param out output hex string; you say how many bytes to write.
* If the number of bytes is > GIT_OID_HEXSZ, extra bytes
* will be zeroed; if not, a '\0' terminator is NOT added.
* @param n number of characters to write into out string
* @param id oid structure to format.
*/
GIT_EXTERN(void) git_oid_nfmt(char *out, size_t n, const git_oid *id);
/**
* Format a git_oid into a loose-object path string.
*
* The resulting string is "aa/...", where "aa" is the first two
* hex digits of the oid and "..." is the remaining 38 digits.
*
* @param out output hex string; must be pointing at the start of
* the hex sequence and have at least the number of bytes
* needed for an oid encoded in hex (41 bytes). Only the
* oid digits are written; a '\\0' terminator must be added
* by the caller if it is required.
* @param id oid structure to format.
*/
GIT_EXTERN(void) git_oid_pathfmt(char *out, const git_oid *id);
/**
* Format a git_oid into a statically allocated c-string.
*
* The c-string is owned by the library and should not be freed
* by the user. If libgit2 is built with thread support, the string
* will be stored in TLS (i.e. one buffer per thread) to allow for
* concurrent calls of the function.
*
* @param oid The oid structure to format
* @return the c-string
*/
GIT_EXTERN(char *) git_oid_tostr_s(const git_oid *oid);
/**
* Format a git_oid into a buffer as a hex format c-string.
*
* If the buffer is smaller than GIT_OID_HEXSZ+1, then the resulting
* oid c-string will be truncated to n-1 characters (but will still be
* NUL-byte terminated).
*
* If there are any input parameter errors (out == NULL, n == 0, oid ==
* NULL), then a pointer to an empty string is returned, so that the
* return value can always be printed.
*
* @param out the buffer into which the oid string is output.
* @param n the size of the out buffer.
* @param id the oid structure to format.
* @return the out buffer pointer, assuming no input parameter
* errors, otherwise a pointer to an empty string.
*/
GIT_EXTERN(char *) git_oid_tostr(char *out, size_t n, const git_oid *id);
/**
* Copy an oid from one structure to another.
*
* @param out oid structure the result is written into.
* @param src oid structure to copy from.
*/
GIT_EXTERN(void) git_oid_cpy(git_oid *out, const git_oid *src);
/**
* Compare two oid structures.
*
* @param a first oid structure.
* @param b second oid structure.
* @return <0, 0, >0 if a < b, a == b, a > b.
*/
GIT_EXTERN(int) git_oid_cmp(const git_oid *a, const git_oid *b);
/**
* Compare two oid structures for equality
*
* @param a first oid structure.
* @param b second oid structure.
* @return true if equal, false otherwise
*/
GIT_EXTERN(int) git_oid_equal(const git_oid *a, const git_oid *b);
/**
* Compare the first 'len' hexadecimal characters (packets of 4 bits)
* of two oid structures.
*
* @param a first oid structure.
* @param b second oid structure.
* @param len the number of hex chars to compare
* @return 0 in case of a match
*/
GIT_EXTERN(int) git_oid_ncmp(const git_oid *a, const git_oid *b, size_t len);
/**
* Check if an oid equals an hex formatted object id.
*
* @param id oid structure.
* @param str input hex string of an object id.
* @return 0 in case of a match, -1 otherwise.
*/
GIT_EXTERN(int) git_oid_streq(const git_oid *id, const char *str);
/**
* Compare an oid to an hex formatted object id.
*
* @param id oid structure.
* @param str input hex string of an object id.
* @return -1 if str is not valid, <0 if id sorts before str,
* 0 if id matches str, >0 if id sorts after str.
*/
GIT_EXTERN(int) git_oid_strcmp(const git_oid *id, const char *str);
/**
* Check is an oid is all zeros.
*
* @return 1 if all zeros, 0 otherwise.
*/
GIT_EXTERN(int) git_oid_iszero(const git_oid *id);
/**
* OID Shortener object
*/
typedef struct git_oid_shorten git_oid_shorten;
/**
* Create a new OID shortener.
*
* The OID shortener is used to process a list of OIDs
* in text form and return the shortest length that would
* uniquely identify all of them.
*
* E.g. look at the result of `git log --abbrev`.
*
* @param min_length The minimal length for all identifiers,
* which will be used even if shorter OIDs would still
* be unique.
* @return a `git_oid_shorten` instance, NULL if OOM
*/
GIT_EXTERN(git_oid_shorten *) git_oid_shorten_new(size_t min_length);
/**
* Add a new OID to set of shortened OIDs and calculate
* the minimal length to uniquely identify all the OIDs in
* the set.
*
* The OID is expected to be a 40-char hexadecimal string.
* The OID is owned by the user and will not be modified
* or freed.
*
* For performance reasons, there is a hard-limit of how many
* OIDs can be added to a single set (around ~32000, assuming
* a mostly randomized distribution), which should be enough
* for any kind of program, and keeps the algorithm fast and
* memory-efficient.
*
* Attempting to add more than those OIDs will result in a
* GIT_ERROR_INVALID error
*
* @param os a `git_oid_shorten` instance
* @param text_id an OID in text form
* @return the minimal length to uniquely identify all OIDs
* added so far to the set; or an error code (<0) if an
* error occurs.
*/
GIT_EXTERN(int) git_oid_shorten_add(git_oid_shorten *os, const char *text_id);
/**
* Free an OID shortener instance
*
* @param os a `git_oid_shorten` instance
*/
GIT_EXTERN(void) git_oid_shorten_free(git_oid_shorten *os);
/** @} */
GIT_END_DECL
#endif
|
4fc5c4ba9d59eeda736065ff8eb5eddcb201f26f
|
ac2f43c8e0d9649a7f063c59b3dffdfed9fd7ed7
|
/common/recipes-core/ipmid/files/sensor.h
|
5d8c11aa8e42bd28d1573a5480f2b6b1900d6179
|
[] |
no_license
|
facebook/openbmc
|
bef10604ced226288600f55248b7f1be9945aea4
|
32777c66a8410d767eae15baabf71c61a0bef13c
|
refs/heads/helium
| 2023-08-17T03:13:54.729494
| 2023-08-16T23:24:18
| 2023-08-16T23:24:18
| 31,917,712
| 684
| 331
| null | 2023-07-25T21:19:08
| 2015-03-09T19:18:35
|
C
|
UTF-8
|
C
| false
| false
| 3,342
|
h
|
sensor.h
|
/*
*
* Copyright 2014-present Facebook. All Rights Reserved.
*
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __SENSOR_H__
#define __SENSOR_H__
#include "timestamp.h"
#define IANA_ID_SIZE 3
#define SENSOR_STR_SIZE 16
#define SENSOR_OEM_DATA_SIZE 56
// Threshold Sensor Descriptor
typedef struct {
unsigned char owner;
unsigned char lun;
unsigned char sensor_num;
unsigned char ent_id;
unsigned char ent_inst;
unsigned char sensor_init;
unsigned char sensor_caps;
unsigned char sensor_type;
unsigned char evt_read_type;
unsigned char lt_read_mask[2];
unsigned char ut_read_mask[2];
unsigned char set_thresh_mask[2];
unsigned char sensor_units1;
unsigned char sensor_units2;
unsigned char sensor_units3;
unsigned char linear;
unsigned char m_val;
unsigned char m_tolerance;
unsigned char b_val;
unsigned char b_accuracy;
unsigned char accuracy_dir;
unsigned char rb_exp;
unsigned char analog_flags;
unsigned char nominal;
unsigned char normal_max;
unsigned char normal_min;
unsigned char max_reading;
unsigned char min_reading;
unsigned char unr_thresh;
unsigned char uc_thresh;
unsigned char unc_thresh;
unsigned char lnr_thresh;
unsigned char lc_thresh;
unsigned char lnc_thresh;
unsigned char pos_hyst;
unsigned char neg_hyst;
unsigned char oem;
unsigned char str_type_len;
char str[SENSOR_STR_SIZE];
} sensor_thresh_t;
// Discrete Sensor Descriptor
typedef struct {
unsigned char owner;
unsigned char lun;
unsigned char sensor_num;
unsigned char ent_id;
unsigned char ent_inst;
unsigned char sensor_init;
unsigned char sensor_caps;
unsigned char sensor_type;
unsigned char evt_read_type;
unsigned char assert_evt_mask[2];
unsigned char deassert_evt_mask[2];
unsigned char read_evt_mask[2];
unsigned char oem;
unsigned char str_type_len;
char str[SENSOR_STR_SIZE];
} sensor_disc_t;
// Mgmt. Controller Sensor Descriptor
typedef struct {
unsigned char slave_addr;
unsigned char chan_no;
unsigned char pwr_state_init;
unsigned char dev_caps;
unsigned char ent_id;
unsigned char ent_inst;
unsigned char oem;
unsigned char str_type_len;
char str[SENSOR_STR_SIZE];
} sensor_mgmt_t;
// OEM type Sensor Descriptor
typedef struct {
unsigned char mfr_id[IANA_ID_SIZE];
unsigned char oem_data[SENSOR_OEM_DATA_SIZE];
} sensor_oem_t;
void plat_sensor_mgmt_info(int *num, sensor_mgmt_t **p_sensor);
void plat_sensor_disc_info(int *num, sensor_disc_t **p_sensor);
void plat_sensor_thresh_info(int *num, sensor_thresh_t **p_sensor);
void plat_sensor_oem_info(int *num, sensor_oem_t **p_sensor);
int plat_sensor_init(void);
#endif /* __SENSOR_H__ */
|
6cafa29e7a898663f62512e2881cd1b3fd2e4e5a
|
f7dc806f341ef5dbb0e11252a4693003a66853d5
|
/thirdparty/libwebp/src/utils/huffman_encode_utils.c
|
585db91951841660ec5ab69a3ad1a32d0286844d
|
[
"LicenseRef-scancode-free-unknown",
"MIT",
"CC-BY-4.0",
"OFL-1.1",
"Bison-exception-2.2",
"CC0-1.0",
"LicenseRef-scancode-nvidia-2002",
"LicenseRef-scancode-other-permissive",
"GPL-3.0-only",
"LicenseRef-scancode-unknown-license-reference",
"Unlicense",
"BSL-1.0",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unicode",
"BSD-2-Clause",
"FTL",
"GPL-3.0-or-later",
"Bitstream-Vera",
"Zlib",
"MPL-2.0",
"MIT-Modern-Variant",
"JSON",
"Libpng"
] |
permissive
|
godotengine/godot
|
8a2419750f4851d1426a8f3bcb52cac5c86f23c2
|
970be7afdc111ccc7459d7ef3560de70e6d08c80
|
refs/heads/master
| 2023-08-21T14:37:00.262883
| 2023-08-21T06:26:15
| 2023-08-21T06:26:15
| 15,634,981
| 68,852
| 18,388
|
MIT
| 2023-09-14T21:42:16
| 2014-01-04T16:05:36
|
C++
|
UTF-8
|
C
| false
| false
| 13,521
|
c
|
huffman_encode_utils.c
|
// Copyright 2011 Google Inc. All Rights Reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the COPYING 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.
// -----------------------------------------------------------------------------
//
// Author: Jyrki Alakuijala (jyrki@google.com)
//
// Entropy encoding (Huffman) for webp lossless.
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "src/utils/huffman_encode_utils.h"
#include "src/utils/utils.h"
#include "src/webp/format_constants.h"
// -----------------------------------------------------------------------------
// Util function to optimize the symbol map for RLE coding
// Heuristics for selecting the stride ranges to collapse.
static int ValuesShouldBeCollapsedToStrideAverage(int a, int b) {
return abs(a - b) < 4;
}
// Change the population counts in a way that the consequent
// Huffman tree compression, especially its RLE-part, give smaller output.
static void OptimizeHuffmanForRle(int length, uint8_t* const good_for_rle,
uint32_t* const counts) {
// 1) Let's make the Huffman code more compatible with rle encoding.
int i;
for (; length >= 0; --length) {
if (length == 0) {
return; // All zeros.
}
if (counts[length - 1] != 0) {
// Now counts[0..length - 1] does not have trailing zeros.
break;
}
}
// 2) Let's mark all population counts that already can be encoded
// with an rle code.
{
// Let's not spoil any of the existing good rle codes.
// Mark any seq of 0's that is longer as 5 as a good_for_rle.
// Mark any seq of non-0's that is longer as 7 as a good_for_rle.
uint32_t symbol = counts[0];
int stride = 0;
for (i = 0; i < length + 1; ++i) {
if (i == length || counts[i] != symbol) {
if ((symbol == 0 && stride >= 5) ||
(symbol != 0 && stride >= 7)) {
int k;
for (k = 0; k < stride; ++k) {
good_for_rle[i - k - 1] = 1;
}
}
stride = 1;
if (i != length) {
symbol = counts[i];
}
} else {
++stride;
}
}
}
// 3) Let's replace those population counts that lead to more rle codes.
{
uint32_t stride = 0;
uint32_t limit = counts[0];
uint32_t sum = 0;
for (i = 0; i < length + 1; ++i) {
if (i == length || good_for_rle[i] ||
(i != 0 && good_for_rle[i - 1]) ||
!ValuesShouldBeCollapsedToStrideAverage(counts[i], limit)) {
if (stride >= 4 || (stride >= 3 && sum == 0)) {
uint32_t k;
// The stride must end, collapse what we have, if we have enough (4).
uint32_t count = (sum + stride / 2) / stride;
if (count < 1) {
count = 1;
}
if (sum == 0) {
// Don't make an all zeros stride to be upgraded to ones.
count = 0;
}
for (k = 0; k < stride; ++k) {
// We don't want to change value at counts[i],
// that is already belonging to the next stride. Thus - 1.
counts[i - k - 1] = count;
}
}
stride = 0;
sum = 0;
if (i < length - 3) {
// All interesting strides have a count of at least 4,
// at least when non-zeros.
limit = (counts[i] + counts[i + 1] +
counts[i + 2] + counts[i + 3] + 2) / 4;
} else if (i < length) {
limit = counts[i];
} else {
limit = 0;
}
}
++stride;
if (i != length) {
sum += counts[i];
if (stride >= 4) {
limit = (sum + stride / 2) / stride;
}
}
}
}
}
// A comparer function for two Huffman trees: sorts first by 'total count'
// (more comes first), and then by 'value' (more comes first).
static int CompareHuffmanTrees(const void* ptr1, const void* ptr2) {
const HuffmanTree* const t1 = (const HuffmanTree*)ptr1;
const HuffmanTree* const t2 = (const HuffmanTree*)ptr2;
if (t1->total_count_ > t2->total_count_) {
return -1;
} else if (t1->total_count_ < t2->total_count_) {
return 1;
} else {
assert(t1->value_ != t2->value_);
return (t1->value_ < t2->value_) ? -1 : 1;
}
}
static void SetBitDepths(const HuffmanTree* const tree,
const HuffmanTree* const pool,
uint8_t* const bit_depths, int level) {
if (tree->pool_index_left_ >= 0) {
SetBitDepths(&pool[tree->pool_index_left_], pool, bit_depths, level + 1);
SetBitDepths(&pool[tree->pool_index_right_], pool, bit_depths, level + 1);
} else {
bit_depths[tree->value_] = level;
}
}
// Create an optimal Huffman tree.
//
// (data,length): population counts.
// tree_limit: maximum bit depth (inclusive) of the codes.
// bit_depths[]: how many bits are used for the symbol.
//
// Returns 0 when an error has occurred.
//
// The catch here is that the tree cannot be arbitrarily deep
//
// count_limit is the value that is to be faked as the minimum value
// and this minimum value is raised until the tree matches the
// maximum length requirement.
//
// This algorithm is not of excellent performance for very long data blocks,
// especially when population counts are longer than 2**tree_limit, but
// we are not planning to use this with extremely long blocks.
//
// See https://en.wikipedia.org/wiki/Huffman_coding
static void GenerateOptimalTree(const uint32_t* const histogram,
int histogram_size,
HuffmanTree* tree, int tree_depth_limit,
uint8_t* const bit_depths) {
uint32_t count_min;
HuffmanTree* tree_pool;
int tree_size_orig = 0;
int i;
for (i = 0; i < histogram_size; ++i) {
if (histogram[i] != 0) {
++tree_size_orig;
}
}
if (tree_size_orig == 0) { // pretty optimal already!
return;
}
tree_pool = tree + tree_size_orig;
// For block sizes with less than 64k symbols we never need to do a
// second iteration of this loop.
// If we actually start running inside this loop a lot, we would perhaps
// be better off with the Katajainen algorithm.
assert(tree_size_orig <= (1 << (tree_depth_limit - 1)));
for (count_min = 1; ; count_min *= 2) {
int tree_size = tree_size_orig;
// We need to pack the Huffman tree in tree_depth_limit bits.
// So, we try by faking histogram entries to be at least 'count_min'.
int idx = 0;
int j;
for (j = 0; j < histogram_size; ++j) {
if (histogram[j] != 0) {
const uint32_t count =
(histogram[j] < count_min) ? count_min : histogram[j];
tree[idx].total_count_ = count;
tree[idx].value_ = j;
tree[idx].pool_index_left_ = -1;
tree[idx].pool_index_right_ = -1;
++idx;
}
}
// Build the Huffman tree.
qsort(tree, tree_size, sizeof(*tree), CompareHuffmanTrees);
if (tree_size > 1) { // Normal case.
int tree_pool_size = 0;
while (tree_size > 1) { // Finish when we have only one root.
uint32_t count;
tree_pool[tree_pool_size++] = tree[tree_size - 1];
tree_pool[tree_pool_size++] = tree[tree_size - 2];
count = tree_pool[tree_pool_size - 1].total_count_ +
tree_pool[tree_pool_size - 2].total_count_;
tree_size -= 2;
{
// Search for the insertion point.
int k;
for (k = 0; k < tree_size; ++k) {
if (tree[k].total_count_ <= count) {
break;
}
}
memmove(tree + (k + 1), tree + k, (tree_size - k) * sizeof(*tree));
tree[k].total_count_ = count;
tree[k].value_ = -1;
tree[k].pool_index_left_ = tree_pool_size - 1;
tree[k].pool_index_right_ = tree_pool_size - 2;
tree_size = tree_size + 1;
}
}
SetBitDepths(&tree[0], tree_pool, bit_depths, 0);
} else if (tree_size == 1) { // Trivial case: only one element.
bit_depths[tree[0].value_] = 1;
}
{
// Test if this Huffman tree satisfies our 'tree_depth_limit' criteria.
int max_depth = bit_depths[0];
for (j = 1; j < histogram_size; ++j) {
if (max_depth < bit_depths[j]) {
max_depth = bit_depths[j];
}
}
if (max_depth <= tree_depth_limit) {
break;
}
}
}
}
// -----------------------------------------------------------------------------
// Coding of the Huffman tree values
static HuffmanTreeToken* CodeRepeatedValues(int repetitions,
HuffmanTreeToken* tokens,
int value, int prev_value) {
assert(value <= MAX_ALLOWED_CODE_LENGTH);
if (value != prev_value) {
tokens->code = value;
tokens->extra_bits = 0;
++tokens;
--repetitions;
}
while (repetitions >= 1) {
if (repetitions < 3) {
int i;
for (i = 0; i < repetitions; ++i) {
tokens->code = value;
tokens->extra_bits = 0;
++tokens;
}
break;
} else if (repetitions < 7) {
tokens->code = 16;
tokens->extra_bits = repetitions - 3;
++tokens;
break;
} else {
tokens->code = 16;
tokens->extra_bits = 3;
++tokens;
repetitions -= 6;
}
}
return tokens;
}
static HuffmanTreeToken* CodeRepeatedZeros(int repetitions,
HuffmanTreeToken* tokens) {
while (repetitions >= 1) {
if (repetitions < 3) {
int i;
for (i = 0; i < repetitions; ++i) {
tokens->code = 0; // 0-value
tokens->extra_bits = 0;
++tokens;
}
break;
} else if (repetitions < 11) {
tokens->code = 17;
tokens->extra_bits = repetitions - 3;
++tokens;
break;
} else if (repetitions < 139) {
tokens->code = 18;
tokens->extra_bits = repetitions - 11;
++tokens;
break;
} else {
tokens->code = 18;
tokens->extra_bits = 0x7f; // 138 repeated 0s
++tokens;
repetitions -= 138;
}
}
return tokens;
}
int VP8LCreateCompressedHuffmanTree(const HuffmanTreeCode* const tree,
HuffmanTreeToken* tokens, int max_tokens) {
HuffmanTreeToken* const starting_token = tokens;
HuffmanTreeToken* const ending_token = tokens + max_tokens;
const int depth_size = tree->num_symbols;
int prev_value = 8; // 8 is the initial value for rle.
int i = 0;
assert(tokens != NULL);
while (i < depth_size) {
const int value = tree->code_lengths[i];
int k = i + 1;
int runs;
while (k < depth_size && tree->code_lengths[k] == value) ++k;
runs = k - i;
if (value == 0) {
tokens = CodeRepeatedZeros(runs, tokens);
} else {
tokens = CodeRepeatedValues(runs, tokens, value, prev_value);
prev_value = value;
}
i += runs;
assert(tokens <= ending_token);
}
(void)ending_token; // suppress 'unused variable' warning
return (int)(tokens - starting_token);
}
// -----------------------------------------------------------------------------
// Pre-reversed 4-bit values.
static const uint8_t kReversedBits[16] = {
0x0, 0x8, 0x4, 0xc, 0x2, 0xa, 0x6, 0xe,
0x1, 0x9, 0x5, 0xd, 0x3, 0xb, 0x7, 0xf
};
static uint32_t ReverseBits(int num_bits, uint32_t bits) {
uint32_t retval = 0;
int i = 0;
while (i < num_bits) {
i += 4;
retval |= kReversedBits[bits & 0xf] << (MAX_ALLOWED_CODE_LENGTH + 1 - i);
bits >>= 4;
}
retval >>= (MAX_ALLOWED_CODE_LENGTH + 1 - num_bits);
return retval;
}
// Get the actual bit values for a tree of bit depths.
static void ConvertBitDepthsToSymbols(HuffmanTreeCode* const tree) {
// 0 bit-depth means that the symbol does not exist.
int i;
int len;
uint32_t next_code[MAX_ALLOWED_CODE_LENGTH + 1];
int depth_count[MAX_ALLOWED_CODE_LENGTH + 1] = { 0 };
assert(tree != NULL);
len = tree->num_symbols;
for (i = 0; i < len; ++i) {
const int code_length = tree->code_lengths[i];
assert(code_length <= MAX_ALLOWED_CODE_LENGTH);
++depth_count[code_length];
}
depth_count[0] = 0; // ignore unused symbol
next_code[0] = 0;
{
uint32_t code = 0;
for (i = 1; i <= MAX_ALLOWED_CODE_LENGTH; ++i) {
code = (code + depth_count[i - 1]) << 1;
next_code[i] = code;
}
}
for (i = 0; i < len; ++i) {
const int code_length = tree->code_lengths[i];
tree->codes[i] = ReverseBits(code_length, next_code[code_length]++);
}
}
// -----------------------------------------------------------------------------
// Main entry point
void VP8LCreateHuffmanTree(uint32_t* const histogram, int tree_depth_limit,
uint8_t* const buf_rle, HuffmanTree* const huff_tree,
HuffmanTreeCode* const huff_code) {
const int num_symbols = huff_code->num_symbols;
memset(buf_rle, 0, num_symbols * sizeof(*buf_rle));
OptimizeHuffmanForRle(num_symbols, buf_rle, histogram);
GenerateOptimalTree(histogram, num_symbols, huff_tree, tree_depth_limit,
huff_code->code_lengths);
// Create the actual bit codes for the bit lengths.
ConvertBitDepthsToSymbols(huff_code);
}
|
f45bcc414171d2af89dfc8704db3744908e060fb
|
1885ce333f6980ab6aad764b3f8caf42094d9f7d
|
/test/e2e/test_input/skia/include/gpu/GrConfig.h
|
3daae6139c1f8603b81c489d34629774348c355c
|
[
"MIT"
] |
permissive
|
satya-das/cppparser
|
1dbccdeed4287c36c61edc30190c82de447e415b
|
f9a4cfac1a3af7286332056d7c661d86b6c35eb3
|
refs/heads/master
| 2023-07-06T00:55:23.382303
| 2022-10-03T19:40:05
| 2022-10-03T19:40:05
| 16,642,636
| 194
| 26
|
MIT
| 2023-06-26T13:44:32
| 2014-02-08T12:20:01
|
C++
|
UTF-8
|
C
| false
| false
| 4,744
|
h
|
GrConfig.h
|
/*
* Copyright 2010 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrConfig_DEFINED
#define GrConfig_DEFINED
#include "include/core/SkTypes.h"
///////////////////////////////////////////////////////////////////////////////
// preconfig section:
//
// All the work before including GrUserConfig.h should center around guessing
// what platform we're on, and defining low-level symbols based on that.
//
// A build environment may have already defined symbols, so we first check
// for that
//
// hack to ensure we know what sort of Apple platform we're on
#if defined(__APPLE_CPP__) || defined(__APPLE_CC__)
#include <TargetConditionals.h>
#endif
/**
* Gr defines are set to 0 or 1, rather than being undefined or defined
*/
#if !defined(GR_CACHE_STATS)
#if defined(SK_DEBUG) || defined(SK_DUMP_STATS)
#define GR_CACHE_STATS 1
#else
#define GR_CACHE_STATS 0
#endif
#endif
#if !defined(GR_GPU_STATS)
#if defined(SK_DEBUG) || defined(SK_DUMP_STATS) || defined(GR_TEST_UTILS)
#define GR_GPU_STATS 1
#else
#define GR_GPU_STATS 0
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/*
* Include stdint.h with defines that trigger declaration of C99 limit/const
* macros here before anyone else has a chance to include stdint.h without
* these.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS
#endif
#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif
#include <stdint.h>
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// postconfig section:
//
/**
* GR_STRING makes a string of X where X is expanded before conversion to a string
* if X itself contains macros.
*/
#define GR_STRING(X) GR_STRING_IMPL(X)
#define GR_STRING_IMPL(X) #X
/**
* GR_CONCAT concatenates X and Y where each is expanded before
* contanenation if either contains macros.
*/
#define GR_CONCAT(X,Y) GR_CONCAT_IMPL(X,Y)
#define GR_CONCAT_IMPL(X,Y) X##Y
/**
* Creates a string of the form "<filename>(<linenumber>) : "
*/
#define GR_FILE_AND_LINE_STR __FILE__ "(" GR_STRING(__LINE__) ") : "
/**
* Compilers have different ways of issuing warnings. This macro
* attempts to abstract them, but may need to be specialized for your
* particular compiler.
* To insert compiler warnings use "#pragma message GR_WARN(<string>)"
*/
#if defined(_MSC_VER)
#define GR_WARN(MSG) (GR_FILE_AND_LINE_STR "WARNING: " MSG)
#else//__GNUC__ - may need other defines for different compilers
#define GR_WARN(MSG) ("WARNING: " MSG)
#endif
/**
* GR_ALWAYSBREAK is an unconditional break in all builds.
*/
#if !defined(GR_ALWAYSBREAK)
#if defined(SK_BUILD_FOR_WIN)
#define GR_ALWAYSBREAK SkNO_RETURN_HINT(); __debugbreak()
#else
// TODO: do other platforms really not have continuable breakpoints?
// sign extend for 64bit architectures to be sure this is
// in the high address range
#define GR_ALWAYSBREAK SkNO_RETURN_HINT(); *((int*)(int64_t)(int32_t)0xbeefcafe) = 0;
#endif
#endif
/**
* GR_DEBUGBREAK is an unconditional break in debug builds.
*/
#if !defined(GR_DEBUGBREAK)
#ifdef SK_DEBUG
#define GR_DEBUGBREAK GR_ALWAYSBREAK
#else
#define GR_DEBUGBREAK
#endif
#endif
/**
* GR_ALWAYSASSERT is an assertion in all builds.
*/
#if !defined(GR_ALWAYSASSERT)
#define GR_ALWAYSASSERT(COND) \
do { \
if (!(COND)) { \
SkDebugf("%s %s failed\n", GR_FILE_AND_LINE_STR, #COND); \
GR_ALWAYSBREAK; \
} \
} while (false)
#endif
/**
* GR_DEBUGASSERT is an assertion in debug builds only.
*/
#if !defined(GR_DEBUGASSERT)
#ifdef SK_DEBUG
#define GR_DEBUGASSERT(COND) GR_ALWAYSASSERT(COND)
#else
#define GR_DEBUGASSERT(COND)
#endif
#endif
/**
* Prettier forms of the above macros.
*/
#define GrAlwaysAssert(COND) GR_ALWAYSASSERT(COND)
/**
* GR_STATIC_ASSERT is a compile time assertion. Depending on the platform
* it may print the message in the compiler log. Obviously, the condition must
* be evaluatable at compile time.
*/
#define GR_STATIC_ASSERT(CONDITION) static_assert(CONDITION, "bug")
#endif
|
f41a232b65242fca0f615e6115501d70b740e1a2
|
07aeb5740a8dae36edf24e2686ff67e2959758fe
|
/programs/subprojects/libutils/assert.h
|
30a3718b7706e708aff11c119fcd9ee62fa6dab5
|
[
"MIT"
] |
permissive
|
codyd51/axle
|
59e992987bb871296aeadc69fc7244798090f3b1
|
96ae8852f15ad5c0a77c621c323ba47b4a7bdc69
|
refs/heads/paging-demo
| 2023-06-08T11:31:19.429032
| 2023-05-30T06:45:30
| 2023-05-30T06:45:30
| 58,590,685
| 597
| 61
|
MIT
| 2023-02-21T06:02:34
| 2016-05-11T23:41:08
|
C
|
UTF-8
|
C
| false
| false
| 111
|
h
|
assert.h
|
#ifndef ASSERT_H
#define ASSERT_H
#include <stdbool.h>
void axle_assert(bool cond, const char* msg);
#endif
|
9e52fc4bd703f2fe43f2c6b0e54fbf581d5a386f
|
0fa1152e1e434ce9fe9e2db95f43f25675bf7d27
|
/src/drivers/distance_sensor/tfmini/tfmini_parser.h
|
dbf40a5f5d85898869e99e48ee7487c0db911ae8
|
[
"BSD-3-Clause"
] |
permissive
|
PX4/PX4-Autopilot
|
4cc90dccc9285ca4db7f595ac5a7547df02ca92e
|
3d61ab84c42ff8623bd48ff0ba74f9cf26bb402b
|
refs/heads/main
| 2023-08-30T23:58:35.398450
| 2022-03-26T01:29:03
| 2023-08-30T15:40:01
| 5,298,790
| 3,146
| 3,798
|
BSD-3-Clause
| 2023-09-14T17:22:04
| 2012-08-04T21:19:36
|
C++
|
UTF-8
|
C
| false
| false
| 2,752
|
h
|
tfmini_parser.h
|
/****************************************************************************
*
* Copyright (c) 2017-2019 PX4 Development Team. 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. Neither the name PX4 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 modified from sf0x_parser.cpp
* @author Lorenz Meier <lm@inf.ethz.ch>
* @author Chuong Nguyen <chnguye7@asu.edu>
* @author Ayush Gaud <ayush.gaud@gmail.com>
*
* Declarations of parser for the Benewake TFmini laser rangefinder series
*/
#pragma once
// Data Format for Benewake TFmini
// ===============================
// 9 bytes total per message:
// 1) 0x59
// 2) 0x59
// 3) Dist_L (low 8bit)
// 4) Dist_H (high 8bit)
// 5) Strength_L (low 8bit)
// 6) Strength_H (high 8bit)
// 7) Reserved bytes
// 8) Original signal quality degree
// 9) Checksum parity bit (low 8bit), Checksum = Byte1 + Byte2 +...+Byte8. This is only a low 8bit though
enum class TFMINI_PARSE_STATE {
STATE0_UNSYNC = 0,
STATE1_SYNC_1,
STATE1_SYNC_2,
STATE2_GOT_DIST_L,
STATE2_GOT_DIST_H,
STATE3_GOT_STRENGTH_L,
STATE3_GOT_STRENGTH_H,
STATE4_GOT_RESERVED,
STATE5_GOT_QUALITY,
STATE6_GOT_CHECKSUM
};
int tfmini_parse(char c, char *parserbuf, unsigned *parserbuf_index, TFMINI_PARSE_STATE *state, float *dist);
|
da5d7085574caaf4f220b44dc311f3c08978a995
|
83372fce92c9088ee5c1e1c13bc67385a3b02a36
|
/libsrc/common/getchar.c
|
913a4f5d64bc0b6c21d20f743a410f4017ebb86d
|
[
"Zlib"
] |
permissive
|
cc65/cc65
|
2cd1b20b61ddd0691cd4601b4da37a9200a50afb
|
16e90187e8e80c6e2fcfcc04f068ac865d2290e5
|
refs/heads/master
| 2023-09-03T17:16:46.027934
| 2023-09-02T22:30:44
| 2023-09-02T22:30:44
| 8,932,489
| 2,103
| 526
|
Zlib
| 2023-09-13T06:19:01
| 2013-03-21T15:56:48
|
C
|
UTF-8
|
C
| false
| false
| 445
|
c
|
getchar.c
|
/*
** getchar.c
**
** Ullrich von Bassewitz, 11.12.1998
*/
#include <stdio.h>
#undef getchar /* This is usually declared as a macro */
/*****************************************************************************/
/* Code */
/*****************************************************************************/
int getchar (void)
{
return fgetc (stdin);
}
|
170b33e8253a97b8371a2f6777ddde9f6f373092
|
03b2c80dbc41e904b167d504666e27d798da5447
|
/src/call_streams.c
|
d72ef31e7832f02eca51b1270e3df9e0ac0bd6db
|
[
"Unlicense"
] |
permissive
|
nptcl/npt
|
7c1570b497cdce0b8971cb445fbc04cb500232d3
|
aa714a2370ac9fa5348c2fc96159b40b9de3de07
|
refs/heads/master
| 2023-03-20T09:13:54.669118
| 2022-07-02T11:17:44
| 2022-07-02T11:17:44
| 171,985,905
| 160
| 12
|
Unlicense
| 2023-03-11T01:36:37
| 2019-02-22T03:11:34
|
C
|
UTF-8
|
C
| false
| false
| 24,653
|
c
|
call_streams.c
|
#include "bignum.h"
#include "call_streams.h"
#include "character.h"
#include "common_header.h"
#include "cons.h"
#include "cons_list.h"
#include "cons_plist.h"
#include "control_object.h"
#include "condition.h"
#include "declare.h"
#include "integer.h"
#include "object.h"
#include "pathname_object.h"
#include "pathname.h"
#include "sequence.h"
#include "stream.h"
#include "stream_common.h"
#include "stream_function.h"
#include "stream_open.h"
#include "stream_string.h"
#include "strtype.h"
#include "subtypep.h"
#include "type_parse.h"
/*
* read-byte
*/
int read_byte_common_(Execute ptr,
addr stream, addr errorp, addr value, addr *ret)
{
int check;
if (errorp == Unbound)
errorp = T;
if (value == Unbound)
value = Nil;
Return(read_byte_stream_(stream, ret, &check));
if (! check)
return 0;
/* EOF */
if (errorp != Nil) {
*ret = Nil;
return call_end_of_file_(ptr, stream);
}
return Result(ret, value);
}
/*
* write-byte
*/
int write_byte_common_(Execute ptr, addr value, addr stream)
{
Return(write_byte_stream_(stream, value));
return exitpoint_stream_(stream);
}
/*
* peek-char
*/
int peek_char_common_(Execute ptr, addr type, addr stream,
addr errorp, addr value, addr recp, addr *ret)
{
if (type == Unbound)
type = Nil;
if (stream == Unbound) {
Return(standard_input_stream_(ptr, &stream));
}
if (errorp == Unbound)
errorp = T;
if (value == Unbound)
value = Nil;
if (recp == Unbound)
recp = Nil;
return peek_char_stream_(ptr, ret,
type, stream, errorp != Nil, value, recp != Nil);
}
/*
* read-char
*/
static int call_end_of_file_recursive_(Execute ptr, addr pos, int recp)
{
return call_end_of_file_(ptr, pos);
}
int read_char_common_(Execute ptr,
addr stream, addr errorp, addr value, addr recp, addr *ret)
{
int check;
unicode c;
if (stream == Unbound) {
Return(standard_input_stream_(ptr, &stream));
}
if (errorp == Unbound)
errorp = T;
if (value == Unbound)
value = Nil;
if (recp == Unbound)
recp = Nil;
Return(input_stream_designator_(ptr, stream, &stream));
/* read-char */
Return(read_char_stream_(stream, &c, &check));
if (check) {
if (errorp != Nil)
return call_end_of_file_recursive_(ptr, stream, recp != Nil);
else
return Result(ret, value);
}
character_heap(ret, c);
return 0;
}
/*
* read-char-no-hang
*/
int read_char_no_hang_common_(Execute ptr,
addr stream, addr errorp, addr value, addr recp, addr *ret)
{
int hang, check;
unicode c;
if (stream == Unbound) {
Return(standard_input_stream_(ptr, &stream));
}
if (errorp == Unbound)
errorp = T;
if (value == Unbound)
value = Nil;
if (recp == Unbound)
recp = Nil;
Return(input_stream_designator_(ptr, stream, &stream));
/* read-char */
Return(read_hang_stream_(stream, &c, &hang, &check));
if (check) {
if (errorp != Nil)
return call_end_of_file_recursive_(ptr, stream, recp != Nil);
else
return Result(ret, value);
}
if (hang)
return Result(ret, Nil);
character_heap(ret, c);
return 0;
}
/*
* terpri
*/
int terpri_common_(Execute ptr, addr stream)
{
if (stream == Unbound) {
Return(standard_output_stream_(ptr, &stream));
}
else {
Return(output_stream_designator_(ptr, stream, &stream));
}
Return(terpri_stream_(stream));
return exitpoint_stream_(stream);
}
/*
* fresh-line
*/
int fresh_line_common_(Execute ptr, addr stream, addr *ret)
{
int check;
if (stream == Unbound) {
Return(standard_output_stream_(ptr, &stream));
}
else {
Return(output_stream_designator_(ptr, stream, &stream));
}
Return(fresh_line_stream_(stream, &check));
Return(exitpoint_stream_(stream));
return Result(ret, check? T: Nil);
}
/*
* unread-char
*/
int unread_char_common_(Execute ptr, addr pos, addr stream)
{
unicode c;
if (stream == Unbound) {
Return(standard_input_stream_(ptr, &stream));
}
else {
Return(input_stream_designator_(ptr, stream, &stream));
}
GetCharacter(pos, &c);
return unread_char_stream_(stream, c);
}
/*
* write-char
*/
int write_char_common_(Execute ptr, addr pos, addr stream)
{
unicode c;
Return(output_stream_designator_(ptr, stream, &stream));
GetCharacter(pos, &c);
Return(write_char_stream_(stream, c));
return exitpoint_stream_(stream);
}
/*
* read-line
*/
int read_line_common_(Execute ptr,
addr stream, addr errorp, addr value, addr recp,
addr *ret, addr *sec)
{
int miss;
if (stream == Unbound) {
Return(standard_input_stream_(ptr, &stream));
}
if (errorp == Unbound)
errorp = T;
if (value == Unbound)
value = Nil;
if (recp == Unbound)
recp = Nil;
Return(read_line_stream_(ptr, ret,
&miss, stream, errorp != Nil, value, recp != Nil));
*sec = miss? T: Nil;
return 0;
}
/*
* write-string
*/
int write_string_common_(Execute ptr, addr string, addr rest)
{
Return(write_string_stream_(ptr, string, rest, &string));
return exitpoint_stream_(string);
}
/*
* write-line
*/
int write_line_common_(Execute ptr, addr string, addr rest)
{
Return(write_string_stream_(ptr, string, rest, &string));
Return(terpri_stream_(string));
return exitpoint_stream_(string);
}
/*
* read-sequence
*/
int read_sequence_common_(addr var, addr stream, addr rest, addr *ret)
{
size_t start, end;
Return(length_sequence_(var, 0, &start));
Return(keyword_start_end_(start, rest, &start, &end));
return read_sequence_stream_(ret, var, stream, start, end);
}
/*
* write-sequence
*/
int write_sequence_common_(LocalRoot local, addr var, addr stream, addr rest)
{
size_t start, end;
Return(length_sequence_(var, 0, &start));
Return(keyword_start_end_(start, rest, &start, &end));
Return(write_sequence_stream_(local, var, stream, start, end));
return exitpoint_stream_(stream);
}
/*
* file-position
*/
int file_position_common_(Execute ptr, addr stream, addr pos, addr *ret)
{
int check;
addr value;
size_t size;
/* get file-position */
if (pos == Unbound) {
Return(file_position_stream_(stream, &size, &check));
if (check)
return Result(ret, Nil);
else
return Result(ret, intsizeh(size));
}
/* set start */
GetConst(KEYWORD_START, &value);
if (pos == value) {
Return(file_position_start_stream_(stream, &check));
goto return_result;
}
/* set end */
GetConst(KEYWORD_END, &value);
if (pos == value) {
Return(file_position_end_stream_(stream, &check));
goto return_result;
}
/* set index */
Return(getindex_integer_(pos, &size));
Return(file_position_set_stream_(stream, size, &check));
return_result:
return Result(ret, check? Nil: T);
}
/*
* file-string-length
*/
int file_string_length_common_(addr stream, addr pos, addr *ret)
{
int check;
unicode c;
size_t size;
if (characterp(pos)) {
GetCharacter(pos, &c);
Return(file_charlen_stream_(stream, c, &size, &check));
}
else {
Return(file_strlen_stream_(stream, pos, &size, &check));
}
if (check) {
return Result(ret, Nil);
}
else {
make_index_integer_heap(&pos, size);
return Result(ret, pos);
}
}
/*
* open
*/
static int open_common_direction_(addr value, enum Stream_Open_Direction *ret)
{
addr check;
/* default */
if (value == Unbound)
return Result(ret, Stream_Open_Direction_Input);
/* :input */
GetConst(KEYWORD_INPUT, &check);
if (value == check)
return Result(ret, Stream_Open_Direction_Input);
/* :output */
GetConst(KEYWORD_OUTPUT, &check);
if (value == check)
return Result(ret, Stream_Open_Direction_Output);
/* :io */
GetConst(KEYWORD_IO, &check);
if (value == check)
return Result(ret, Stream_Open_Direction_Io);
/* :probe */
GetConst(KEYWORD_PROBE, &check);
if (value == check)
return Result(ret, Stream_Open_Direction_Probe);
/* error */
*ret = Stream_Open_Direction_Input;
return fmte_("Invalid :direction value ~S.", value, NULL);
}
static int open_common_newest_p(addr pos)
{
addr version, x, y;
/* version == :newest */
GetVersionPathname(pos, &version);
GetConst(KEYWORD_NEWEST, &y);
if (version == y)
return 1;
/* logical-pathname.version == Nil */
GetHostPathname(pos, &x);
if (! stringp(x))
return 0;
return version == Nil;
}
static int open_common_ifexists_(addr value, addr pos, enum Stream_Open_IfExists *ret)
{
addr check;
/* default */
if (value == Unbound) {
/* binary-stream */
if (streamp(pos))
return Result(ret, Stream_Open_IfExists_Supersede);
/* pathname */
return Result(ret, open_common_newest_p(pos)?
Stream_Open_IfExists_NewVersion:
Stream_Open_IfExists_Error);
}
/* :error */
GetConst(KEYWORD_ERROR, &check);
if (value == check)
return Result(ret, Stream_Open_IfExists_Error);
/* :supersede */
GetConst(KEYWORD_SUPERSEDE, &check);
if (value == check)
return Result(ret, Stream_Open_IfExists_Supersede);
/* :append */
GetConst(KEYWORD_APPEND, &check);
if (value == check)
return Result(ret, Stream_Open_IfExists_Append);
/* :overwrite */
GetConst(KEYWORD_OVERWRITE, &check);
if (value == check)
return Result(ret, Stream_Open_IfExists_Overwrite);
/* :rename */
GetConst(KEYWORD_RENAME, &check);
if (value == check)
return Result(ret, Stream_Open_IfExists_Rename);
/* :rename-and-delete */
GetConst(KEYWORD_RENAME_AND_DELETE, &check);
if (value == check)
return Result(ret, Stream_Open_IfExists_RenameAndDelete);
/* :new-version */
GetConst(KEYWORD_NEW_VERSION, &check);
if (value == check)
return Result(ret, Stream_Open_IfExists_NewVersion);
/* nil */
if (value == Nil)
return Result(ret, Stream_Open_IfExists_Nil);
/* others */
*ret = Stream_Open_IfExists_Error;
return fmte_("Invalid :if-exists value ~S.", value, NULL);
}
static int open_common_ifdoesnot_(addr value,
enum Stream_Open_Direction direction,
enum Stream_Open_IfExists exists,
enum Stream_Open_IfDoesNot *ret)
{
addr check;
/* default */
if (value == Unbound) {
/* :input -> :error
* :overwrite -> :error
* :append -> :error
* :output -> :create
* :io -> :create
* :probe -> nil
*/
if (direction == Stream_Open_Direction_Input)
return Result(ret, Stream_Open_IfDoesNot_Error);
if (exists == Stream_Open_IfExists_Overwrite)
return Result(ret, Stream_Open_IfDoesNot_Error);
if (exists == Stream_Open_IfExists_Append)
return Result(ret, Stream_Open_IfDoesNot_Error);
if (direction == Stream_Open_Direction_Output)
return Result(ret, Stream_Open_IfDoesNot_Create);
if (direction == Stream_Open_Direction_Io)
return Result(ret, Stream_Open_IfDoesNot_Create);
if (direction == Stream_Open_Direction_Probe)
return Result(ret, Stream_Open_IfDoesNot_Nil);
*ret = Stream_Open_IfDoesNot_Error;
return fmte_("Invalid :if-does-not-exist default value.", NULL);
}
/* :error */
GetConst(KEYWORD_ERROR, &check);
if (value == check)
return Result(ret, Stream_Open_IfDoesNot_Error);
/* :create */
GetConst(KEYWORD_CREATE, &check);
if (value == check)
return Result(ret, Stream_Open_IfDoesNot_Create);
/* nil */
if (value == Nil)
return Result(ret, Stream_Open_IfDoesNot_Nil);
/* others */
*ret = Stream_Open_IfDoesNot_Error;
return fmte_("Invalid :if-does-not-exist value ~S.", value, NULL);
}
static int open_pathname_designator_(Execute ptr, addr pos, addr *ret)
{
addr value;
if (memory_stream_p(pos))
return Result(ret, pos);
if (streamp(pos)) {
GetPathnameStream(pos, &value);
if (memory_stream_p(value))
return Result(ret, value);
}
return pathname_designator_heap_(ptr, pos, ret);
}
int open_common_(Execute ptr, addr pos, addr rest, addr *ret)
{
addr value;
enum Stream_Open_Direction direction;
enum Stream_Open_Element element;
enum Stream_Open_IfExists exists;
enum Stream_Open_IfDoesNot doesnot;
enum Stream_Open_External external;
/* argument */
Return(open_pathname_designator_(ptr, pos, &pos));
if (GetKeyArgs(rest, KEYWORD_DIRECTION, &value))
value = Unbound;
Return(open_common_direction_(value, &direction));
if (GetKeyArgs(rest, KEYWORD_ELEMENT_TYPE, &value))
value = Unbound;
Return(open_element_stream_(ptr, value, &element));
if (GetKeyArgs(rest, KEYWORD_IF_EXISTS, &value))
value = Unbound;
Return(open_common_ifexists_(value, pos, &exists));
if (GetKeyArgs(rest, KEYWORD_IF_DOES_NOT_EXIST, &value))
value = Unbound;
Return(open_common_ifdoesnot_(value, direction, exists, &doesnot));
if (GetKeyArgs(rest, KEYWORD_EXTERNAL_FORMAT, &value))
value = Unbound;
Return(open_external_format_(ptr, value, &external));
if (external == Stream_Open_External_Error)
return fmte_("Invalid external-format ~S.", value, NULL);
/* result */
return open_stream_(ptr, ret, pos, direction, element, exists, doesnot, external);
}
/*
* with-open-file
*/
int with_open_file_common_(addr form, addr *ret)
{
/* (let ((var (open file . args)))
* ,@decl
* (unwind-protect
* (progn . body)
* (when var ;; valid check.
* (close var))))
*/
addr args, var, file, body, decl, root;
addr let, open, protect, progn, when, close;
/* argument */
Return_getcdr(form, &form);
if (! consp(form))
goto error;
GetCons(form, &args, &body);
if (! consp(args))
goto error;
GetCons(args, &var, &args);
if (! consp(args))
goto error;
GetCons(args, &file, &args);
Return(declare_body_form_(body, &decl, &body));
/* expand */
GetConst(COMMON_LET, &let);
GetConst(COMMON_OPEN, &open);
GetConst(COMMON_UNWIND_PROTECT, &protect);
GetConst(COMMON_PROGN, &progn);
GetConst(COMMON_WHEN, &when);
GetConst(COMMON_CLOSE, &close);
list_heap(&close, close, var, NULL);
list_heap(&when, when, var, close, NULL);
cons_heap(&progn, progn, body);
list_heap(&protect, protect, progn, when, NULL);
lista_heap(&args, open, file, args, NULL);
list_heap(&args, var, args, NULL);
conscar_heap(&args, args);
conscar_heap(&root, let);
cons_heap(&root, args, root);
while (decl != Nil) {
GetCons(decl, &var, &decl);
cons_heap(&root, var, root);
}
cons_heap(&root, protect, root);
nreverse(ret, root);
return 0;
error:
return fmte_("WITH-OPEN-FILE argument must be "
"a ((var file options*) ...) form.", form, NULL);
}
/*
* close
*/
int close_common_(Execute ptr, addr pos, addr rest, addr *ret)
{
addr abort;
if (GetKeyArgs(rest, KEYWORD_ABORT, &abort))
abort = Nil;
if (abort != Nil) {
GetConst(SYSTEM_CLOSE_ABORT, &abort);
pushspecial_control(ptr, abort, T);
}
return close_stream_(pos, ret);
}
/*
* with-open-stream
*/
int with_open_stream_common_(addr form, addr *ret)
{
/* `(let ((,var ,stream))
* ,@decl
* (unwind-protect
* (progn ,@body)
* (close ,var)))
*/
addr args, var, stream, body, decl, root;
addr let, protect, progn, close;
/* argument */
Return_getcdr(form, &form);
if (! consp(form))
goto error;
GetCons(form, &args, &body);
if (! consp(args))
goto error;
GetCons(args, &var, &args);
if (! consp(args))
goto error;
GetCons(args, &stream, &args);
if (args != Nil)
goto error;
Return(declare_body_form_(body, &decl, &body));
/* expand */
GetConst(COMMON_LET, &let);
GetConst(COMMON_UNWIND_PROTECT, &protect);
GetConst(COMMON_PROGN, &progn);
GetConst(COMMON_CLOSE, &close);
list_heap(&close, close, var, NULL);
cons_heap(&progn, progn, body);
list_heap(&protect, protect, progn, close, NULL);
list_heap(&args, var, stream, NULL);
conscar_heap(&args, args);
conscar_heap(&root, let);
cons_heap(&root, args, root);
while (decl != Nil) {
GetCons(decl, &var, &decl);
cons_heap(&root, var, root);
}
cons_heap(&root, protect, root);
nreverse(ret, root);
return 0;
error:
return fmte_("WITH-OPEN-STREAM argument must be "
"a ((var stream) ...) form.", form, NULL);
}
/*
* listen
*/
int listen_common_(Execute ptr, addr stream, addr *ret)
{
int check;
if (stream == Unbound) {
Return(standard_input_stream_(ptr, &stream));
}
Return(listen_stream_(stream, &check));
return Result(ret, check? T: Nil);
}
/*
* clear-input
*/
int clear_input_common_(Execute ptr, addr stream)
{
if (stream == Unbound) {
Return(standard_input_stream_(ptr, &stream));
}
return clear_input_stream_(stream);
}
/*
* finish-output
*/
int finish_output_common_(Execute ptr, addr stream)
{
if (stream == Unbound) {
Return(standard_output_stream_(ptr, &stream));
}
return finish_output_stream_(stream);
}
/*
* force-output
*/
int force_output_common_(Execute ptr, addr stream)
{
if (stream == Unbound) {
Return(standard_output_stream_(ptr, &stream));
}
return force_output_stream_(stream);
}
/*
* clear-output
*/
int clear_output_common_(Execute ptr, addr stream)
{
if (stream == Unbound) {
Return(standard_output_stream_(ptr, &stream));
}
return clear_output_stream_(stream);
}
/*
* make-string-input-stream
*/
int make_string_input_stream_common_(addr var, addr x, addr y, addr *ret)
{
size_t start, end;
string_length(var, &start);
Return(keyword_start_end_value_(start, x, y, &start, &end));
Return(open_input_string_stream2_(ret, var, start, end));
return 0;
}
/*
* make-string-output-stream
*/
int make_string_output_stream_common_(Execute ptr, addr rest, addr *ret)
{
int check;
addr type, pos;
if (! GetKeyArgs(rest, KEYWORD_ELEMENT_TYPE, &pos)) {
GetTypeTable(&type, Character);
Return(parse_type_(ptr, &pos, pos, Nil));
Return(subtypep_check_(ptr, pos, type, Nil, &check, NULL));
if (! check)
return fmte_(":ELEMENT-TYPE ~S must be a character type.", pos, NULL);
}
open_output_string_stream(ret, 0);
return 0;
}
/*
* get-output-stream-string
*/
int get_output_stream_string_common_(Execute ptr, addr var, addr *ret)
{
addr type;
if (getstreamtype(var) != StreamType_StringOutput) {
GetTypeTable(&type, StringStream);
return call_type_error_va_(ptr, var, type,
"The stream must be a output-string-stream.", NULL);
}
Return(string_stream_heap_(var, ret));
clear_output_string_stream(var);
return 0;
}
/*
* with-input-from-string
*/
static int with_input_from_string_noindex_common_(addr *ret,
addr var, addr string, addr start, addr end, addr body)
{
/* `(let ((,var (make-string-input-stream ,string :start ,start :end ,end)))
* ,@decl
* (unwind-protect
* (progn ,@form)
* (close ,var)))
*/
addr let, make, unwind, progn, close, decl, pos;
GetConst(COMMON_LET, &let);
GetConst(COMMON_MAKE_STRING_INPUT_STREAM, &make);
GetConst(COMMON_UNWIND_PROTECT, &unwind);
GetConst(COMMON_PROGN, &progn);
GetConst(COMMON_CLOSE, &close);
Return(declare_body_form_(body, &decl, &body));
list_heap(&close, close, var, NULL);
cons_heap(&progn, progn, body);
list_heap(&unwind, unwind, progn, close, NULL);
if (end == Unbound)
list_heap(&make, make, string, start, NULL);
else
list_heap(&make, make, string, start, end, NULL);
list_heap(&make, var, make, NULL);
conscar_heap(&make, make);
conscar_heap(&let, let);
cons_heap(&let, make, let);
while (decl != Nil) {
GetCons(decl, &pos, &decl);
cons_heap(&let, pos, let);
}
cons_heap(&let, unwind, let);
nreverse(ret, let);
return 0;
}
static int with_input_from_string_index_common_(addr *ret,
addr var, addr string, addr index, addr start, addr end, addr body)
{
/* `(let ((,var (make-string-input-stream ,string :start ,start :end ,end)))
* ,@decl
* (unwind-protect
* (progn ,@form)
* (setf ,index (lisp-system::end-input-stream ,var))
* (close ,var)))
*/
addr let, make, unwind, progn, setf, end_input, close, decl, pos;
GetConst(COMMON_LET, &let);
GetConst(COMMON_MAKE_STRING_INPUT_STREAM, &make);
GetConst(COMMON_UNWIND_PROTECT, &unwind);
GetConst(COMMON_PROGN, &progn);
GetConst(COMMON_SETF, &setf);
GetConst(SYSTEM_END_INPUT_STREAM, &end_input);
GetConst(COMMON_CLOSE, &close);
Return(declare_body_form_(body, &decl, &body));
list_heap(&close, close, var, NULL);
list_heap(&end_input, end_input, var, NULL);
list_heap(&setf, setf, index, end_input, NULL);
cons_heap(&progn, progn, body);
list_heap(&unwind, unwind, progn, setf, close, NULL);
if (end == Unbound)
list_heap(&make, make, string, start, NULL);
else
list_heap(&make, make, string, start, end, NULL);
list_heap(&make, var, make, NULL);
conscar_heap(&make, make);
conscar_heap(&let, let);
cons_heap(&let, make, let);
while (decl != Nil) {
GetCons(decl, &pos, &decl);
cons_heap(&let, pos, let);
}
cons_heap(&let, unwind, let);
nreverse(ret, let);
return 0;
}
static int with_input_from_string_key_(addr list, addr *start, addr *end, addr *index)
{
addr key, value, kstart, kend, kindex;
GetConst(KEYWORD_INDEX, &kindex);
GetConst(KEYWORD_START, &kstart);
GetConst(KEYWORD_END, &kend);
*start = *end = *index = Unbound;
while (list != Nil) {
Return_getcons(list, &key, &list);
Return_getcons(list, &value, &list);
if (key == kindex) {
if (*index == Unbound)
*index = value;
}
else if (key == kstart) {
if (*start == Unbound)
*start = value;
}
else if (key == kend) {
if (*end == Unbound)
*end = value;
}
else {
return fmte_("Invaild key argument ~S.", key, NULL);
}
}
if (*start == Unbound)
fixnum_heap(start, 0);
return 0;
}
int with_input_from_string_common_(addr form, addr *ret)
{
addr args, body, var, string, start, end, index;
/* argument */
Return_getcdr(form, &form);
if (! consp_getcons(form, &args, &body))
goto error;
if (! consp_getcons(args, &var, &args))
goto error;
if (! consp_getcons(args, &string, &args))
goto error;
/* make form */
Return(with_input_from_string_key_(args, &start, &end, &index));
if (index == Unbound) {
return with_input_from_string_noindex_common_(ret,
var, string, start, end, body);
}
else {
return with_input_from_string_index_common_(ret,
var, string, index, start, end, body);
}
error:
return fmte_("WITH-INPUT-FROM-STRING form ~S must be a "
"((var string ...) &body body).", form, NULL);
}
/*
* with-output-to-string
*/
static int with_output_to_string_normal_common_(addr *ret,
addr var, addr args, addr body)
{
/* `(let ((,var (make-string-output-stream ,@args)))
* ,@decl
* (unwind-protect
* (progn ,@body
* (get-output-stream-string ,var))
* (close ,var)))
*/
addr let, make, unwind, progn, get, close, decl, pos;
GetConst(COMMON_LET, &let);
GetConst(COMMON_MAKE_STRING_OUTPUT_STREAM, &make);
GetConst(COMMON_UNWIND_PROTECT, &unwind);
GetConst(COMMON_PROGN, &progn);
GetConst(COMMON_GET_OUTPUT_STREAM_STRING, &get);
GetConst(COMMON_CLOSE, &close);
Return(declare_body_form_(body, &decl, &body));
list_heap(&close, close, var, NULL);
list_heap(&get, get, var, NULL);
conscar_heap(&progn, progn);
while (body != Nil) {
GetCons(body, &pos, &body);
cons_heap(&progn, pos, progn);
}
cons_heap(&progn, get, progn);
nreverse(&progn, progn);
list_heap(&unwind, unwind, progn, close, NULL);
lista_heap(&make, make, args, NULL);
list_heap(&make, var, make, NULL);
conscar_heap(&make, make);
conscar_heap(&let, let);
cons_heap(&let, make, let);
while (decl != Nil) {
GetCons(decl, &pos, &decl);
cons_heap(&let, pos, let);
}
cons_heap(&let, unwind, let);
nreverse(ret, let);
return 0;
}
static int with_output_to_string_extend_common_(addr *ret,
addr var, addr string, addr args, addr body)
{
/* `(let ((,var (lisp-system::make-extend-output-stream string ,@args)))
* ,@decl
* (unwind-protect
* (progn ,@body)
* (close ,var)))
*/
addr let, make, unwind, progn, close, decl, pos;
GetConst(COMMON_LET, &let);
GetConst(SYSTEM_MAKE_EXTEND_OUTPUT_STREAM, &make);
GetConst(COMMON_UNWIND_PROTECT, &unwind);
GetConst(COMMON_PROGN, &progn);
GetConst(COMMON_CLOSE, &close);
Return(declare_body_form_(body, &decl, &body));
list_heap(&close, close, var, NULL);
cons_heap(&progn, progn, body);
list_heap(&unwind, unwind, progn, close, NULL);
lista_heap(&make, make, string, args, NULL);
list_heap(&make, var, make, NULL);
conscar_heap(&make, make);
conscar_heap(&let, let);
cons_heap(&let, make, let);
while (decl != Nil) {
GetCons(decl, &pos, &decl);
cons_heap(&let, pos, let);
}
cons_heap(&let, unwind, let);
nreverse(ret, let);
return 0;
}
int with_output_to_string_common_(addr form, addr *ret)
{
addr args, var, string, body;
/* argument */
Return_getcdr(form, &args);
if (! consp_getcons(args, &args, &body))
goto error;
if (! consp_getcons(args, &var, &args))
goto error;
if (! consp_getcons(args, &string, &args))
string = Nil;
if (string == Nil) {
Return(with_output_to_string_normal_common_(ret, var, args, body));
}
else {
Return(with_output_to_string_extend_common_(ret, var, string, args, body));
}
return 0;
error:
return fmte_("WITH-OUTPUT-TO-STRING form ~S must be a "
"((var &optional string &key element-type) &body body).", form, NULL);
}
|
e385494097d46973614fabc1d85ccd98678d4b9a
|
71349a4947f71965bc1ead26543313ddbeafd62a
|
/include/rawrtc/ice_transport.h
|
eb0827608aebd658e3c00c8b3a89269be09cd742
|
[
"BSD-2-Clause"
] |
permissive
|
rawrtc/rawrtc
|
377d131a6e0f1e76b1bdf7e452491682712ad9a5
|
e80aa9fd432e299efac5b2c84ab873f887682acc
|
refs/heads/master
| 2022-07-06T17:01:00.928300
| 2021-12-23T08:07:35
| 2021-12-23T08:07:35
| 80,470,566
| 403
| 41
|
BSD-2-Clause
| 2021-12-23T08:07:36
| 2017-01-30T22:32:38
|
C
|
UTF-8
|
C
| false
| false
| 4,211
|
h
|
ice_transport.h
|
#pragma once
#include <rawrtcc/code.h>
#include <re.h>
// Dependencies
struct rawrtc_ice_candidate;
struct rawrtc_ice_gatherer;
struct rawrtc_ice_parameters;
/*
* ICE role.
*/
enum rawrtc_ice_role {
RAWRTC_ICE_ROLE_UNKNOWN = ICE_ROLE_UNKNOWN,
RAWRTC_ICE_ROLE_CONTROLLING = ICE_ROLE_CONTROLLING,
RAWRTC_ICE_ROLE_CONTROLLED = ICE_ROLE_CONTROLLED,
};
/*
* ICE transport state.
*/
enum rawrtc_ice_transport_state {
RAWRTC_ICE_TRANSPORT_STATE_NEW,
RAWRTC_ICE_TRANSPORT_STATE_CHECKING,
RAWRTC_ICE_TRANSPORT_STATE_CONNECTED,
RAWRTC_ICE_TRANSPORT_STATE_COMPLETED,
RAWRTC_ICE_TRANSPORT_STATE_DISCONNECTED,
RAWRTC_ICE_TRANSPORT_STATE_FAILED,
RAWRTC_ICE_TRANSPORT_STATE_CLOSED,
};
/*
* ICE transport.
*/
struct rawrtc_ice_transport;
/*
* ICE transport state change handler.
*/
typedef void (*rawrtc_ice_transport_state_change_handler)(
enum rawrtc_ice_transport_state const state, void* const arg);
/*
* ICE transport pair change handler.
*/
typedef void (*rawrtc_ice_transport_candidate_pair_change_handler)(
struct rawrtc_ice_candidate* const local, // read-only
struct rawrtc_ice_candidate* const remote, // read-only
void* const arg);
/*
* Create a new ICE transport.
* `*transportp` must be unreferenced.
*/
enum rawrtc_code rawrtc_ice_transport_create(
struct rawrtc_ice_transport** const transportp, // de-referenced
struct rawrtc_ice_gatherer* const gatherer, // referenced, nullable
rawrtc_ice_transport_state_change_handler const state_change_handler, // nullable
rawrtc_ice_transport_candidate_pair_change_handler const
candidate_pair_change_handler, // nullable
void* const arg // nullable
);
/*
* Start the ICE transport.
*/
enum rawrtc_code rawrtc_ice_transport_start(
struct rawrtc_ice_transport* const transport,
struct rawrtc_ice_gatherer* const gatherer, // referenced
struct rawrtc_ice_parameters* const remote_parameters, // referenced
enum rawrtc_ice_role const role);
/*
* Stop and close the ICE transport.
*/
enum rawrtc_code rawrtc_ice_transport_stop(struct rawrtc_ice_transport* const transport);
/*
* TODO (from RTCIceTransport interface)
* rawrtc_ice_transport_get_ice_gatherer
*/
/*
* Get the current ICE role of the ICE transport.
*/
enum rawrtc_code rawrtc_ice_transport_get_role(
enum rawrtc_ice_role* const rolep, // de-referenced
struct rawrtc_ice_transport* const transport);
/*
* TODO
* rawrtc_ice_transport_get_component
*/
/*
* Get the current state of the ICE transport.
*/
enum rawrtc_code rawrtc_ice_transport_get_state(
enum rawrtc_ice_transport_state* const statep, // de-referenced
struct rawrtc_ice_transport* const transport);
/*
* rawrtc_ice_transport_get_remote_candidates
* rawrtc_ice_transport_get_selected_candidate_pair
* rawrtc_ice_transport_get_remote_parameters
* rawrtc_ice_transport_create_associated_transport (unsupported)
*/
/*
* Add a remote candidate ot the ICE transport.
* Note: 'candidate' must be NULL to inform the transport that the
* remote site finished gathering.
*/
enum rawrtc_code rawrtc_ice_transport_add_remote_candidate(
struct rawrtc_ice_transport* const transport,
struct rawrtc_ice_candidate* candidate // nullable
);
/*
* Set the remote candidates on the ICE transport overwriting all
* existing remote candidates.
*/
enum rawrtc_code rawrtc_ice_transport_set_remote_candidates(
struct rawrtc_ice_transport* const transport,
struct rawrtc_ice_candidate* const candidates[], // referenced (each item)
size_t const n_candidates);
/* TODO (from RTCIceTransport interface)
* rawrtc_ice_transport_set_state_change_handler
* rawrtc_ice_transport_set_candidate_pair_change_handler
*/
/*
* Get the corresponding name for an ICE transport state.
*/
char const* rawrtc_ice_transport_state_to_name(enum rawrtc_ice_transport_state const state);
/*
* Translate an ICE role to str.
*/
char const* rawrtc_ice_role_to_str(enum rawrtc_ice_role const role);
/*
* Translate a str to an ICE role (case-insensitive).
*/
enum rawrtc_code rawrtc_str_to_ice_role(
enum rawrtc_ice_role* const rolep, // de-referenced
char const* const str);
|
9e49a35c1f5ebc0624bddcfc85bf386112a001a7
|
7eaf54a78c9e2117247cb2ab6d3a0c20719ba700
|
/SOFTWARE/A64-TERES/linux-a64/net/rxrpc/ar-output.c
|
e1ac183d50bb18e561147fa4b9a61de80a32f767
|
[
"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
| 18,400
|
c
|
ar-output.c
|
/* RxRPC packet transmission
*
* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
*
* 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.
*/
#include <linux/net.h>
#include <linux/gfp.h>
#include <linux/skbuff.h>
#include <linux/circ_buf.h>
#include <linux/export.h>
#include <net/sock.h>
#include <net/af_rxrpc.h>
#include "ar-internal.h"
int rxrpc_resend_timeout = 4;
static int rxrpc_send_data(struct kiocb *iocb,
struct rxrpc_sock *rx,
struct rxrpc_call *call,
struct msghdr *msg, size_t len);
/*
* extract control messages from the sendmsg() control buffer
*/
static int rxrpc_sendmsg_cmsg(struct rxrpc_sock *rx, struct msghdr *msg,
unsigned long *user_call_ID,
enum rxrpc_command *command,
u32 *abort_code,
bool server)
{
struct cmsghdr *cmsg;
int len;
*command = RXRPC_CMD_SEND_DATA;
if (msg->msg_controllen == 0)
return -EINVAL;
for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) {
if (!CMSG_OK(msg, cmsg))
return -EINVAL;
len = cmsg->cmsg_len - CMSG_ALIGN(sizeof(struct cmsghdr));
_debug("CMSG %d, %d, %d",
cmsg->cmsg_level, cmsg->cmsg_type, len);
if (cmsg->cmsg_level != SOL_RXRPC)
continue;
switch (cmsg->cmsg_type) {
case RXRPC_USER_CALL_ID:
if (msg->msg_flags & MSG_CMSG_COMPAT) {
if (len != sizeof(u32))
return -EINVAL;
*user_call_ID = *(u32 *) CMSG_DATA(cmsg);
} else {
if (len != sizeof(unsigned long))
return -EINVAL;
*user_call_ID = *(unsigned long *)
CMSG_DATA(cmsg);
}
_debug("User Call ID %lx", *user_call_ID);
break;
case RXRPC_ABORT:
if (*command != RXRPC_CMD_SEND_DATA)
return -EINVAL;
*command = RXRPC_CMD_SEND_ABORT;
if (len != sizeof(*abort_code))
return -EINVAL;
*abort_code = *(unsigned int *) CMSG_DATA(cmsg);
_debug("Abort %x", *abort_code);
if (*abort_code == 0)
return -EINVAL;
break;
case RXRPC_ACCEPT:
if (*command != RXRPC_CMD_SEND_DATA)
return -EINVAL;
*command = RXRPC_CMD_ACCEPT;
if (len != 0)
return -EINVAL;
if (!server)
return -EISCONN;
break;
default:
return -EINVAL;
}
}
_leave(" = 0");
return 0;
}
/*
* abort a call, sending an ABORT packet to the peer
*/
static void rxrpc_send_abort(struct rxrpc_call *call, u32 abort_code)
{
write_lock_bh(&call->state_lock);
if (call->state <= RXRPC_CALL_COMPLETE) {
call->state = RXRPC_CALL_LOCALLY_ABORTED;
call->abort_code = abort_code;
set_bit(RXRPC_CALL_ABORT, &call->events);
del_timer_sync(&call->resend_timer);
del_timer_sync(&call->ack_timer);
clear_bit(RXRPC_CALL_RESEND_TIMER, &call->events);
clear_bit(RXRPC_CALL_ACK, &call->events);
clear_bit(RXRPC_CALL_RUN_RTIMER, &call->flags);
rxrpc_queue_call(call);
}
write_unlock_bh(&call->state_lock);
}
/*
* send a message forming part of a client call through an RxRPC socket
* - caller holds the socket locked
* - the socket may be either a client socket or a server socket
*/
int rxrpc_client_sendmsg(struct kiocb *iocb, struct rxrpc_sock *rx,
struct rxrpc_transport *trans, struct msghdr *msg,
size_t len)
{
struct rxrpc_conn_bundle *bundle;
enum rxrpc_command cmd;
struct rxrpc_call *call;
unsigned long user_call_ID = 0;
struct key *key;
__be16 service_id;
u32 abort_code = 0;
int ret;
_enter("");
ASSERT(trans != NULL);
ret = rxrpc_sendmsg_cmsg(rx, msg, &user_call_ID, &cmd, &abort_code,
false);
if (ret < 0)
return ret;
bundle = NULL;
if (trans) {
service_id = rx->service_id;
if (msg->msg_name) {
struct sockaddr_rxrpc *srx =
(struct sockaddr_rxrpc *) msg->msg_name;
service_id = htons(srx->srx_service);
}
key = rx->key;
if (key && !rx->key->payload.data)
key = NULL;
bundle = rxrpc_get_bundle(rx, trans, key, service_id,
GFP_KERNEL);
if (IS_ERR(bundle))
return PTR_ERR(bundle);
}
call = rxrpc_get_client_call(rx, trans, bundle, user_call_ID,
abort_code == 0, GFP_KERNEL);
if (trans)
rxrpc_put_bundle(trans, bundle);
if (IS_ERR(call)) {
_leave(" = %ld", PTR_ERR(call));
return PTR_ERR(call);
}
_debug("CALL %d USR %lx ST %d on CONN %p",
call->debug_id, call->user_call_ID, call->state, call->conn);
if (call->state >= RXRPC_CALL_COMPLETE) {
/* it's too late for this call */
ret = -ESHUTDOWN;
} else if (cmd == RXRPC_CMD_SEND_ABORT) {
rxrpc_send_abort(call, abort_code);
} else if (cmd != RXRPC_CMD_SEND_DATA) {
ret = -EINVAL;
} else if (call->state != RXRPC_CALL_CLIENT_SEND_REQUEST) {
/* request phase complete for this client call */
ret = -EPROTO;
} else {
ret = rxrpc_send_data(iocb, rx, call, msg, len);
}
rxrpc_put_call(call);
_leave(" = %d", ret);
return ret;
}
/**
* rxrpc_kernel_send_data - Allow a kernel service to send data on a call
* @call: The call to send data through
* @msg: The data to send
* @len: The amount of data to send
*
* Allow a kernel service to send data on a call. The call must be in an state
* appropriate to sending data. No control data should be supplied in @msg,
* nor should an address be supplied. MSG_MORE should be flagged if there's
* more data to come, otherwise this data will end the transmission phase.
*/
int rxrpc_kernel_send_data(struct rxrpc_call *call, struct msghdr *msg,
size_t len)
{
int ret;
_enter("{%d,%s},", call->debug_id, rxrpc_call_states[call->state]);
ASSERTCMP(msg->msg_name, ==, NULL);
ASSERTCMP(msg->msg_control, ==, NULL);
lock_sock(&call->socket->sk);
_debug("CALL %d USR %lx ST %d on CONN %p",
call->debug_id, call->user_call_ID, call->state, call->conn);
if (call->state >= RXRPC_CALL_COMPLETE) {
ret = -ESHUTDOWN; /* it's too late for this call */
} else if (call->state != RXRPC_CALL_CLIENT_SEND_REQUEST &&
call->state != RXRPC_CALL_SERVER_ACK_REQUEST &&
call->state != RXRPC_CALL_SERVER_SEND_REPLY) {
ret = -EPROTO; /* request phase complete for this client call */
} else {
mm_segment_t oldfs = get_fs();
set_fs(KERNEL_DS);
ret = rxrpc_send_data(NULL, call->socket, call, msg, len);
set_fs(oldfs);
}
release_sock(&call->socket->sk);
_leave(" = %d", ret);
return ret;
}
EXPORT_SYMBOL(rxrpc_kernel_send_data);
/**
* rxrpc_kernel_abort_call - Allow a kernel service to abort a call
* @call: The call to be aborted
* @abort_code: The abort code to stick into the ABORT packet
*
* Allow a kernel service to abort a call, if it's still in an abortable state.
*/
void rxrpc_kernel_abort_call(struct rxrpc_call *call, u32 abort_code)
{
_enter("{%d},%d", call->debug_id, abort_code);
lock_sock(&call->socket->sk);
_debug("CALL %d USR %lx ST %d on CONN %p",
call->debug_id, call->user_call_ID, call->state, call->conn);
if (call->state < RXRPC_CALL_COMPLETE)
rxrpc_send_abort(call, abort_code);
release_sock(&call->socket->sk);
_leave("");
}
EXPORT_SYMBOL(rxrpc_kernel_abort_call);
/*
* send a message through a server socket
* - caller holds the socket locked
*/
int rxrpc_server_sendmsg(struct kiocb *iocb, struct rxrpc_sock *rx,
struct msghdr *msg, size_t len)
{
enum rxrpc_command cmd;
struct rxrpc_call *call;
unsigned long user_call_ID = 0;
u32 abort_code = 0;
int ret;
_enter("");
ret = rxrpc_sendmsg_cmsg(rx, msg, &user_call_ID, &cmd, &abort_code,
true);
if (ret < 0)
return ret;
if (cmd == RXRPC_CMD_ACCEPT) {
call = rxrpc_accept_call(rx, user_call_ID);
if (IS_ERR(call))
return PTR_ERR(call);
rxrpc_put_call(call);
return 0;
}
call = rxrpc_find_server_call(rx, user_call_ID);
if (!call)
return -EBADSLT;
if (call->state >= RXRPC_CALL_COMPLETE) {
ret = -ESHUTDOWN;
goto out;
}
switch (cmd) {
case RXRPC_CMD_SEND_DATA:
if (call->state != RXRPC_CALL_CLIENT_SEND_REQUEST &&
call->state != RXRPC_CALL_SERVER_ACK_REQUEST &&
call->state != RXRPC_CALL_SERVER_SEND_REPLY) {
/* Tx phase not yet begun for this call */
ret = -EPROTO;
break;
}
ret = rxrpc_send_data(iocb, rx, call, msg, len);
break;
case RXRPC_CMD_SEND_ABORT:
rxrpc_send_abort(call, abort_code);
break;
default:
BUG();
}
out:
rxrpc_put_call(call);
_leave(" = %d", ret);
return ret;
}
/*
* send a packet through the transport endpoint
*/
int rxrpc_send_packet(struct rxrpc_transport *trans, struct sk_buff *skb)
{
struct kvec iov[1];
struct msghdr msg;
int ret, opt;
_enter(",{%d}", skb->len);
iov[0].iov_base = skb->head;
iov[0].iov_len = skb->len;
msg.msg_name = &trans->peer->srx.transport.sin;
msg.msg_namelen = sizeof(trans->peer->srx.transport.sin);
msg.msg_control = NULL;
msg.msg_controllen = 0;
msg.msg_flags = 0;
/* send the packet with the don't fragment bit set if we currently
* think it's small enough */
if (skb->len - sizeof(struct rxrpc_header) < trans->peer->maxdata) {
down_read(&trans->local->defrag_sem);
/* send the packet by UDP
* - returns -EMSGSIZE if UDP would have to fragment the packet
* to go out of the interface
* - in which case, we'll have processed the ICMP error
* message and update the peer record
*/
ret = kernel_sendmsg(trans->local->socket, &msg, iov, 1,
iov[0].iov_len);
up_read(&trans->local->defrag_sem);
if (ret == -EMSGSIZE)
goto send_fragmentable;
_leave(" = %d [%u]", ret, trans->peer->maxdata);
return ret;
}
send_fragmentable:
/* attempt to send this message with fragmentation enabled */
_debug("send fragment");
down_write(&trans->local->defrag_sem);
opt = IP_PMTUDISC_DONT;
ret = kernel_setsockopt(trans->local->socket, SOL_IP, IP_MTU_DISCOVER,
(char *) &opt, sizeof(opt));
if (ret == 0) {
ret = kernel_sendmsg(trans->local->socket, &msg, iov, 1,
iov[0].iov_len);
opt = IP_PMTUDISC_DO;
kernel_setsockopt(trans->local->socket, SOL_IP,
IP_MTU_DISCOVER, (char *) &opt, sizeof(opt));
}
up_write(&trans->local->defrag_sem);
_leave(" = %d [frag %u]", ret, trans->peer->maxdata);
return ret;
}
/*
* wait for space to appear in the transmit/ACK window
* - caller holds the socket locked
*/
static int rxrpc_wait_for_tx_window(struct rxrpc_sock *rx,
struct rxrpc_call *call,
long *timeo)
{
DECLARE_WAITQUEUE(myself, current);
int ret;
_enter(",{%d},%ld",
CIRC_SPACE(call->acks_head, call->acks_tail, call->acks_winsz),
*timeo);
add_wait_queue(&call->tx_waitq, &myself);
for (;;) {
set_current_state(TASK_INTERRUPTIBLE);
ret = 0;
if (CIRC_SPACE(call->acks_head, call->acks_tail,
call->acks_winsz) > 0)
break;
if (signal_pending(current)) {
ret = sock_intr_errno(*timeo);
break;
}
release_sock(&rx->sk);
*timeo = schedule_timeout(*timeo);
lock_sock(&rx->sk);
}
remove_wait_queue(&call->tx_waitq, &myself);
set_current_state(TASK_RUNNING);
_leave(" = %d", ret);
return ret;
}
/*
* attempt to schedule an instant Tx resend
*/
static inline void rxrpc_instant_resend(struct rxrpc_call *call)
{
read_lock_bh(&call->state_lock);
if (try_to_del_timer_sync(&call->resend_timer) >= 0) {
clear_bit(RXRPC_CALL_RUN_RTIMER, &call->flags);
if (call->state < RXRPC_CALL_COMPLETE &&
!test_and_set_bit(RXRPC_CALL_RESEND_TIMER, &call->events))
rxrpc_queue_call(call);
}
read_unlock_bh(&call->state_lock);
}
/*
* queue a packet for transmission, set the resend timer and attempt
* to send the packet immediately
*/
static void rxrpc_queue_packet(struct rxrpc_call *call, struct sk_buff *skb,
bool last)
{
struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
int ret;
_net("queue skb %p [%d]", skb, call->acks_head);
ASSERT(call->acks_window != NULL);
call->acks_window[call->acks_head] = (unsigned long) skb;
smp_wmb();
call->acks_head = (call->acks_head + 1) & (call->acks_winsz - 1);
if (last || call->state == RXRPC_CALL_SERVER_ACK_REQUEST) {
_debug("________awaiting reply/ACK__________");
write_lock_bh(&call->state_lock);
switch (call->state) {
case RXRPC_CALL_CLIENT_SEND_REQUEST:
call->state = RXRPC_CALL_CLIENT_AWAIT_REPLY;
break;
case RXRPC_CALL_SERVER_ACK_REQUEST:
call->state = RXRPC_CALL_SERVER_SEND_REPLY;
if (!last)
break;
case RXRPC_CALL_SERVER_SEND_REPLY:
call->state = RXRPC_CALL_SERVER_AWAIT_ACK;
break;
default:
break;
}
write_unlock_bh(&call->state_lock);
}
_proto("Tx DATA %%%u { #%u }",
ntohl(sp->hdr.serial), ntohl(sp->hdr.seq));
sp->need_resend = false;
sp->resend_at = jiffies + rxrpc_resend_timeout * HZ;
if (!test_and_set_bit(RXRPC_CALL_RUN_RTIMER, &call->flags)) {
_debug("run timer");
call->resend_timer.expires = sp->resend_at;
add_timer(&call->resend_timer);
}
/* attempt to cancel the rx-ACK timer, deferring reply transmission if
* we're ACK'ing the request phase of an incoming call */
ret = -EAGAIN;
if (try_to_del_timer_sync(&call->ack_timer) >= 0) {
/* the packet may be freed by rxrpc_process_call() before this
* returns */
ret = rxrpc_send_packet(call->conn->trans, skb);
_net("sent skb %p", skb);
} else {
_debug("failed to delete ACK timer");
}
if (ret < 0) {
_debug("need instant resend %d", ret);
sp->need_resend = true;
rxrpc_instant_resend(call);
}
_leave("");
}
/*
* send data through a socket
* - must be called in process context
* - caller holds the socket locked
*/
static int rxrpc_send_data(struct kiocb *iocb,
struct rxrpc_sock *rx,
struct rxrpc_call *call,
struct msghdr *msg, size_t len)
{
struct rxrpc_skb_priv *sp;
unsigned char __user *from;
struct sk_buff *skb;
struct iovec *iov;
struct sock *sk = &rx->sk;
long timeo;
bool more;
int ret, ioc, segment, copied;
_enter(",,,{%zu},%zu", msg->msg_iovlen, len);
timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT);
/* this should be in poll */
clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags);
if (sk->sk_err || (sk->sk_shutdown & SEND_SHUTDOWN))
return -EPIPE;
iov = msg->msg_iov;
ioc = msg->msg_iovlen - 1;
from = iov->iov_base;
segment = iov->iov_len;
iov++;
more = msg->msg_flags & MSG_MORE;
skb = call->tx_pending;
call->tx_pending = NULL;
copied = 0;
do {
int copy;
if (segment > len)
segment = len;
_debug("SEGMENT %d @%p", segment, from);
if (!skb) {
size_t size, chunk, max, space;
_debug("alloc");
if (CIRC_SPACE(call->acks_head, call->acks_tail,
call->acks_winsz) <= 0) {
ret = -EAGAIN;
if (msg->msg_flags & MSG_DONTWAIT)
goto maybe_error;
ret = rxrpc_wait_for_tx_window(rx, call,
&timeo);
if (ret < 0)
goto maybe_error;
}
max = call->conn->trans->peer->maxdata;
max -= call->conn->security_size;
max &= ~(call->conn->size_align - 1UL);
chunk = max;
if (chunk > len && !more)
chunk = len;
space = chunk + call->conn->size_align;
space &= ~(call->conn->size_align - 1UL);
size = space + call->conn->header_size;
_debug("SIZE: %zu/%zu/%zu", chunk, space, size);
/* create a buffer that we can retain until it's ACK'd */
skb = sock_alloc_send_skb(
sk, size, msg->msg_flags & MSG_DONTWAIT, &ret);
if (!skb)
goto maybe_error;
rxrpc_new_skb(skb);
_debug("ALLOC SEND %p", skb);
ASSERTCMP(skb->mark, ==, 0);
_debug("HS: %u", call->conn->header_size);
skb_reserve(skb, call->conn->header_size);
skb->len += call->conn->header_size;
sp = rxrpc_skb(skb);
sp->remain = chunk;
if (sp->remain > skb_tailroom(skb))
sp->remain = skb_tailroom(skb);
_net("skb: hr %d, tr %d, hl %d, rm %d",
skb_headroom(skb),
skb_tailroom(skb),
skb_headlen(skb),
sp->remain);
skb->ip_summed = CHECKSUM_UNNECESSARY;
}
_debug("append");
sp = rxrpc_skb(skb);
/* append next segment of data to the current buffer */
copy = skb_tailroom(skb);
ASSERTCMP(copy, >, 0);
if (copy > segment)
copy = segment;
if (copy > sp->remain)
copy = sp->remain;
_debug("add");
ret = skb_add_data(skb, from, copy);
_debug("added");
if (ret < 0)
goto efault;
sp->remain -= copy;
skb->mark += copy;
copied += copy;
len -= copy;
segment -= copy;
from += copy;
while (segment == 0 && ioc > 0) {
from = iov->iov_base;
segment = iov->iov_len;
iov++;
ioc--;
}
if (len == 0) {
segment = 0;
ioc = 0;
}
/* check for the far side aborting the call or a network error
* occurring */
if (call->state > RXRPC_CALL_COMPLETE)
goto call_aborted;
/* add the packet to the send queue if it's now full */
if (sp->remain <= 0 || (segment == 0 && !more)) {
struct rxrpc_connection *conn = call->conn;
size_t pad;
/* pad out if we're using security */
if (conn->security) {
pad = conn->security_size + skb->mark;
pad = conn->size_align - pad;
pad &= conn->size_align - 1;
_debug("pad %zu", pad);
if (pad)
memset(skb_put(skb, pad), 0, pad);
}
sp->hdr.epoch = conn->epoch;
sp->hdr.cid = call->cid;
sp->hdr.callNumber = call->call_id;
sp->hdr.seq =
htonl(atomic_inc_return(&call->sequence));
sp->hdr.serial =
htonl(atomic_inc_return(&conn->serial));
sp->hdr.type = RXRPC_PACKET_TYPE_DATA;
sp->hdr.userStatus = 0;
sp->hdr.securityIndex = conn->security_ix;
sp->hdr._rsvd = 0;
sp->hdr.serviceId = conn->service_id;
sp->hdr.flags = conn->out_clientflag;
if (len == 0 && !more)
sp->hdr.flags |= RXRPC_LAST_PACKET;
else if (CIRC_SPACE(call->acks_head, call->acks_tail,
call->acks_winsz) > 1)
sp->hdr.flags |= RXRPC_MORE_PACKETS;
ret = rxrpc_secure_packet(
call, skb, skb->mark,
skb->head + sizeof(struct rxrpc_header));
if (ret < 0)
goto out;
memcpy(skb->head, &sp->hdr,
sizeof(struct rxrpc_header));
rxrpc_queue_packet(call, skb, segment == 0 && !more);
skb = NULL;
}
} while (segment > 0);
success:
ret = copied;
out:
call->tx_pending = skb;
_leave(" = %d", ret);
return ret;
call_aborted:
rxrpc_free_skb(skb);
if (call->state == RXRPC_CALL_NETWORK_ERROR)
ret = call->conn->trans->peer->net_error;
else
ret = -ECONNABORTED;
_leave(" = %d", ret);
return ret;
maybe_error:
if (copied)
goto success;
goto out;
efault:
ret = -EFAULT;
goto out;
}
|
0aaee52841daf2abb1fd64c3c005c3efc4c09c49
|
de35b2de6b67c9ac943eec081df90f932c7a6ad6
|
/tools/console.c
|
a02a5c5a7f0ce9046df83e88bf1ee0b6c444d451
|
[
"BSD-2-Clause",
"MIT",
"BSD-3-Clause"
] |
permissive
|
hackerschoice/gsocket
|
c5525c61dc36c1b2df6450e319fdf3c4554f6bbe
|
d002e83b5f7c71412dc9af92e81279d721f7af11
|
refs/heads/master
| 2023-09-06T06:49:38.109669
| 2023-08-31T19:00:50
| 2023-08-31T19:00:50
| 296,670,766
| 1,201
| 112
|
BSD-2-Clause
| 2023-08-07T11:43:51
| 2020-09-18T16:14:22
|
C
|
UTF-8
|
C
| false
| false
| 40,798
|
c
|
console.c
|
/*
* Process console-action (ctrl keys) and console-commands and dispatch
* the action.
*
* Handle drawing of console and command line input.
*
* https://invisible-island.net/xterm/ctlseqs/ctlseqs.html
* http://ascii-table.com/ansi-escape-sequences-vt-100.php
* https://www.andreasen.org/letters/vt100.txt
* https://www.linuxquestions.org/questions/programming-9/get-cursor-position-in-c-947833/
*/
#include "common.h"
#include <wordexp.h>
#include <dirent.h>
#include "pkt_mgr.h"
#include "console.h"
#include "console_display.h"
#include "utils.h"
#define ESCAPE(string) "\033" string
// #define PTY_RESIZE_STR ESCAPE("7") ESCAPE("[r") ESCAPE("[9999;9999H") ESCAPE("[6n")
// #define PTY_RESTORE ESCAPE("8")
// #define PTY_SIZE_STR ESCAPE("[%d;%dR")
#define UIntClr(dst,bits) dst = dst & (unsigned) ~(bits)
#define GS_CONSOLE_PROMPT "#!ADM> "
#define GS_CONSOLE_PROMPT_LEN (sizeof (GS_CONSOLE_PROMPT) - 1) // without \0
// 1 less than max input so that cursor on last pos looks better
#define GS_CONSOLE_INPUT_LEN (gopt.winsize.ws_col - GS_CONSOLE_PROMPT_LEN - 1)
#define GS_CON_SB_MAX_USERLEN 8 // StatusBar Max User Len
static void console_reset(void);
static void console_start(void);
static void console_stop(void);
static int console_command(struct _peer *p, const char *cmd);
static uint8_t chr_last;
static int tty_fd = -1;
static int stdout_fd = -1;
static void console_draw(int fd, int force);
static int is_init_called;
static GS_RL_CTX rl;
static int is_console_welcome_msg;
static int is_console_cursor_needs_reset;
static const char *sb_color = "\x1B[44m\x1B[30m"; // Black on Blue
#define GS_CONSOLE_BUF_SIZE (1024)
#define GS_CONDIS_ROWS (GS_CONSOLE_ROWS - 2)
enum _gs_ut_cursor_flags {
GS_UT_CURSOR_ON = 0x01,
GS_UT_CURSOR_OFF = 0x02
};
enum _gs_ut_cursor_flags ut_cursor;
struct _console_info
{
char statusbar[512];
size_t sb_len;
int is_sb_redraw_needed;
int is_prompt_redraw_needed;
float ping_ms;
uint8_t n_users;
int load;
char user[14];
int sec_idle;
// Bytes Per Second
double last_usec;
int64_t last_pos;
double bps;
double last_bps;
float ft_last_perc;
float ft_perc; // FileTransfer percent completion
};
struct _console_info ci;
GS_CONDIS gs_condis; // ConsoleDisplay
static double
get_usec(void)
{
struct timeval tv;
gettimeofday(&tv, NULL);
return (double)tv.tv_sec * 1000000 + tv.tv_usec;
}
static void
console_init(int fd)
{
if (is_init_called)
return;
// Use YELLOW if TOR (socks) is being used
if (gopt.gs_ctx.socks_ip != 0)
sb_color = "\x1B[43m\x1B[30m"; // Black on Yellow
DEBUGF_R("prompt size %zd\n", GS_CONSOLE_PROMPT_LEN);
is_init_called = 1; // Set also if any of the calls below fail
ci.last_usec = get_usec();
GS_RL_init(&rl, gopt.winsize.ws_col - GS_CONSOLE_PROMPT_LEN);
// GS_RL_init(&rl, 10);
GS_condis_init(&gs_condis, fd, GS_CONDIS_ROWS /* 3*/);
stdout_fd = fd;
// tty_fd = fd; // mad but works 99% if tty fails
char *tty_name = ttyname(fd);
if (tty_name == NULL)
return;
tty_fd = open(tty_name, O_RDWR | O_NOCTTY);
if (tty_fd < 0)
return;
int rv;
struct termios tio;
rv = tcgetattr(tty_fd, &tio);
if (rv != 0)
return;
UIntClr(tio.c_iflag, ICRNL);
UIntClr(tio.c_lflag, (ICANON | ECHO));
tio.c_cflag |= CS8;
tio.c_cc[VMIN] = 6;
tio.c_cc[VTIME] = 1;
rv = tcsetattr(tty_fd, TCSADRAIN, &tio);
if (rv != 0)
return;
}
static ssize_t
tty_write(void *src, size_t len)
{
errno = ENOTTY;
if (tty_fd < 0)
return -1;
errno = 0;
return write(tty_fd, src, len);
}
static int is_cursor_in_console;
// For the upper tier we do not know the coordinates.
// Rely on Saved-cursor position instead.
static void
cursor_to_ut(void)
{
char buf[64];
char *end = buf + sizeof (buf);
char *ptr = buf;
// If Upper Tier disabled the cursor then do NOT show it.
if (ut_cursor == GS_UT_CURSOR_OFF)
SXPRINTF(ptr, end - ptr, "\x1B[?25l");
DEBUGF_C("cursor-restore (cursor_to_upper_tier)\n");
SXPRINTF(ptr, end - ptr, "\x1B""8"); // Restore cursor
tty_write(buf, ptr - buf);
is_cursor_in_console = 0;
}
// For the lower tier we know exactly our cordinates.
static void
cursor_to_lt(void)
{
char buf[64];
char *end = buf + sizeof (buf);
char *ptr = buf;
int row = gopt.winsize.ws_row;
int col = 1 + GS_CONSOLE_PROMPT_LEN + MIN(rl.pos, rl.visible_len);
// DEBUGF_W("Cursor to CONSOLE (Lower Tier) (%d:%df)\n", row, col);
SXPRINTF(ptr, end - ptr, "\x1B[%d;%df", row, col);
// ESC[?2004l = Reset bracketed paste mode
if (is_console_cursor_needs_reset)
{
SXPRINTF(ptr, end - ptr, "\x1B[?2004l");
is_console_cursor_needs_reset = 0;
}
// If Upper Tier disabled the cursor then show it in console
// DEBUGF_R("ut-cursor = %d\n", ut_cursor);
if (ut_cursor == GS_UT_CURSOR_OFF)
SXPRINTF(ptr, end - ptr, "\x1B[?25h");
tty_write(buf, ptr - buf);
is_cursor_in_console = 1;
}
// Add to string and increase visual counter
#define VSADDF(xptr, xend, xv, a...) do{ \
size_t n; \
n = snprintf(xptr, xend-xptr, a); \
xv += n; \
xptr += n; \
} while(0)
static void
mk_statusbar(void)
{
char *ptr = ci.statusbar;
char *end = ptr + sizeof ci.statusbar;
int row = gopt.winsize.ws_row - (GS_CONSOLE_ROWS - 1);
size_t vc = 0; // visible characters
// DEBUGF_C("mk_statusbar() called\n");
SXPRINTF(ptr, end - ptr, "\x1B[%d;1f", row);
SXPRINTF(ptr, end - ptr, "%s", sb_color);
memset(ptr, ':', end - ptr);
float ms = ci.ping_ms;
if (ms >= 1000)
VSADDF(ptr, end, vc, "[%1.01fs ]", ms / 1000);
else
VSADDF(ptr, end, vc, "[%3dms]", (int)ms);
if (ci.load >= 1000)
VSADDF(ptr, end, vc, "[Load %02.02f][User(%u) ", (float)ci.load / 100, ci.n_users);
else
VSADDF(ptr, end, vc, "[Load % 4.02f][User(%u) ", (float)ci.load / 100, ci.n_users);
// User name
VSADDF(ptr, end, vc, "%*s ", GS_CON_SB_MAX_USERLEN, ci.user);
// IDLE timer
if (ci.sec_idle < 100)
{
SXPRINTF(ptr, end - ptr, "\x1b[31m");
VSADDF(ptr, end, vc, "%2d sec", ci.sec_idle);
SXPRINTF(ptr, end - ptr, "\x1B[30m");
}
else if (ci.sec_idle / 60 < 100)
VSADDF(ptr, end, vc, "%2d min", ci.sec_idle / 60);
else
VSADDF(ptr, end, vc, "*idle*");
VSADDF(ptr, end, vc, "]");
// BYTES/sec
char buf[GS_FT_SPEEDSTR_MAXSIZE];
GS_format_bps(buf, sizeof buf, (int64_t)ci.bps, "/s");
VSADDF(ptr, end, vc, "[%s]", buf);
// Percent of FileTransfer completed [99.2%] or [ 0.4%] or [-----]
if (ci.ft_perc <= 0)
{
VSADDF(ptr, end, vc, "[-----]");
} else {
char perc[5];
snprintf(perc, sizeof perc, "%1.1f", ci.ft_perc);
VSADDF(ptr, end, vc, "[%4s%%]", perc);
}
// Fill until end
size_t v_left = gopt.winsize.ws_col - vc;
ptr += v_left + 1;
SXPRINTF(ptr, end - ptr, "\x1B[0m"); // Reset color
ci.sb_len = ptr - ci.statusbar;
ci.is_sb_redraw_needed = 1;
}
static void
update_bps(struct _peer *p)
{
double now_usec;
int64_t cur_pos;
now_usec = get_usec();
cur_pos = p->gs->bytes_read + p->gs->bytes_written;
ci.last_bps = ci.bps;
if (now_usec == ci.last_usec)
ci.bps = 0;
else
ci.bps = (cur_pos - ci.last_pos) * 1000000 / (now_usec - ci.last_usec);
// Slowly adjust BPS to make it appear less jumpy
ci.bps = ci.last_bps + (ci.bps - ci.last_bps) * 0.8;
if (ci.bps < 50)
ci.bps = 0;
ci.last_usec = now_usec;
ci.last_pos = cur_pos;
if (ci.last_bps != ci.bps)
ci.is_sb_redraw_needed += 1;
// Percentage of File Transfer
ci.ft_last_perc = ci.ft_perc;
GS_FT *ft = &p->ft;
GS_FT_stats *s = &ft->stats;
if (s->xfer_amount_scheduled == 0)
ci.ft_perc = 0;
else {
float f = ((float)(s->xfer_amount * 100)/ s->xfer_amount_scheduled);
ci.ft_perc = MIN(f, 99.9);
}
if (ci.ft_last_perc != ci.ft_perc)
ci.is_sb_redraw_needed += 1;
}
void
CONSOLE_update_pinginfo(struct _peer *p, float ms, int load, char *user, int sec_idle, uint8_t n_users)
{
int fd = p->fd_out;
ci.ping_ms = ms;
ci.load = load;
ci.n_users = n_users;
if (strlen(user) > GS_CON_SB_MAX_USERLEN)
memcpy(user + GS_CON_SB_MAX_USERLEN - 2, "..", 3);
snprintf(ci.user, sizeof ci.user, "%s", user);
ci.sec_idle = sec_idle;
mk_statusbar();
console_draw(fd, 0);
}
/*
* Called when the window size changed (sigwinch)
*/
void
CONSOLE_resize(struct _peer *p)
{
char buf[128];
char *ptr = buf;
char *end = buf + sizeof buf;
int delta;
DEBUGF_R("RESIZE to %d;%d\n", gopt.winsize.ws_col, gopt.winsize.ws_row);
if (gopt.is_console)
{
delta = gopt.winsize.ws_row - gopt.winsize_prev.ws_row;
if (delta > 0)
{
// Longer:
// Assign scrolling area. Will reset cursor to 1;1
SXPRINTF(ptr, end - ptr, "\x1b[1;%dr", gopt.winsize.ws_row - GS_CONSOLE_ROWS);
// Restore cursor to upper tier
SXPRINTF(ptr, end - ptr, "\x1B""8");
// Clear screen
SXPRINTF(ptr, end - ptr, "\x1B[J");
}
if (delta < 0)
{
// Shorter:
DEBUGF_R("Shorter. ScrollingArea to %d\n", gopt.winsize.ws_row - GS_CONSOLE_ROWS);
if (is_cursor_in_console)
{
DEBUGF_R("cursor is IN console\n");
SXPRINTF(ptr, end - ptr, "\x1B""8""\x1B[J");
SXPRINTF(ptr, end - ptr, "\x1B[%dA", 0-delta);
SXPRINTF(ptr, end - ptr, "\x1B""7");
SXPRINTF(ptr, end - ptr, "\x1b[1;%dr", gopt.winsize.ws_row - GS_CONSOLE_ROWS);
SXPRINTF(ptr, end - ptr, "\x1B""8");
} else {
DEBUGF_R("cursor is UPPER TIER\n");
SXPRINTF(ptr, end - ptr, "\x1B[%dS", 0-delta);
SXPRINTF(ptr, end - ptr, "\x1b[1;%dr", gopt.winsize.ws_row - GS_CONSOLE_ROWS);
SXPRINTF(ptr, end - ptr, "\x1B""8""\x1B[%dA", 0-delta);
}
}
// do nothing if idendical (no change)
tty_write(buf, ptr - buf);
}
GS_condis_pos(&gs_condis, (gopt.winsize.ws_row - GS_CONSOLE_ROWS) + 1 + 1, gopt.winsize.ws_col);
GS_RL_resize(&rl, GS_CONSOLE_INPUT_LEN, gopt.winsize.ws_row /*last row*/, 1 + GS_CONSOLE_PROMPT_LEN);
mk_statusbar();
console_draw(p->fd_out, 1);
}
void
CONSOLE_update_bps(struct _peer *p)
{
update_bps(p);
if (gopt.is_console == 0)
return;
// Only redraw if there was a change
if (ci.is_sb_redraw_needed)
{
mk_statusbar();
console_draw(p->fd_out, 0);
}
}
/*
* status bar (sb) is drawn (Normally black on blue background).
*/
static void
GS_sb_draw(int force)
{
if ((force == 0) && (ci.is_sb_redraw_needed == 0))
return;
ci.is_sb_redraw_needed = 0;
tty_write(ci.statusbar, ci.sb_len);
}
static void
GS_prompt_draw(int force)
{
char buf[512];
char *ptr = buf;;
char *end = buf + sizeof buf;
if ((force == 0) && (ci.is_prompt_redraw_needed == 0))
return;
ci.is_prompt_redraw_needed = 0;
ptr = buf;
SXPRINTF(ptr, end - ptr, "\x1B[%d;1f" GS_CONSOLE_PROMPT "%s", gopt.winsize.ws_row /*last*/, rl.vline);
tty_write(buf, ptr - buf);
}
/*
* Position active cursor to user input in console
*/
static void
GS_prompt_cursor(void)
{
char buf[64];
char *ptr = buf;
char *end = buf + sizeof buf;
SXPRINTF(ptr, end - ptr, "\x1B[%d;%zuf", gopt.winsize.ws_row /*last*/, 1 + GS_CONSOLE_PROMPT_LEN + MIN(rl.pos, rl.visible_len));
tty_write(buf, ptr - buf);
}
void
CONSOLE_draw(int fd)
{
console_draw(fd, 0);
}
static void
console_draw(int fd, int force)
{
if (gopt.is_console == 0)
return;
int redraw_needed = 0;
redraw_needed += ci.is_sb_redraw_needed;
redraw_needed += gs_condis.is_redraw_needed;
redraw_needed += ci.is_prompt_redraw_needed;
// DEBUGF_W("CONSOLE DRAW (force=%d, redraw_needed=%d, cursor-in-console=%d)\n", force, redraw_needed, is_cursor_in_console);
if ((force == 0) && (redraw_needed == 0))
{
// DEBUGF("nothing to draw..\n");
return;
}
if (is_cursor_in_console == 0)
{
// DEBUGF_G("saving cursor (draw)\n");
tty_write("\x1B""7", 2); // Save position (upper tier)
}
// Status Bar (Normally black on blue)
GS_sb_draw(force);
// Log messages
GS_condis_draw(&gs_condis, force);
// Prompt
GS_prompt_draw(force);
// Restore cursor position
if (is_cursor_in_console == 0)
{
tty_write("\x1B""8", 2); // Restore position (upper tier)
// DEBUGF_G("C restored...(draw)\n");
} else {
// if (redraw_needed)
GS_prompt_cursor();
}
}
/*
* Up-Arrow ^[OA or ^[[A
* Return 0 if more data is needed.
* Return 1 otherwise (set *esc if arrow received)
*/
static int ca_last;
static int
check_arrow(int *esc, uint8_t c)
{
*esc = 0;
if ((c == 0x1b) && (ca_last == 0))
{
ca_last = c;
return 0; // more data needed
}
// Not inside ^[ sequence (0x1b)
if (ca_last == 0)
return 1;
if (ca_last == 0x1b)
{
if ((c == 'O') || (c == '['))
{
ca_last = '[';
return 0;
}
ca_last = 0;
return 0; // unknonw escape (?)
}
if (ca_last == '[')
{
*esc = 1;
ca_last = 0;
return 1;
}
return 1;
}
/*
* Check for any Ctrl+E in user input.
*
* 1. any == submit=any. Send submit. Return -1
* 2. ^E + E == submit=^E . Send submit. Return -1
* 3. ^E == do not submit. Return 0
* 4. ^E + <known> == do not submit. Open console. Return 'c'
* 5. ^E + ^E == submit=^E . Send ^E + ^E. Return -2
* == behavior non-screen like:
* 6. ^E + <other> == submit=other. Send ^E + submit. Return -2
* ==> behavior screen like (see *#1* below)
* 6. ^E + <other> == do not submit. Return 0
*
* Return 0 : Caller not to process received character (more data required).
* Return -1: Caller to process character in *submit
* Return -2: not used.
* Return >0: Escaped character.
*/
int
CONSOLE_check_esc(uint8_t c, uint8_t *submit)
{
int esc;
// DEBUGF_Y("key = 0x%02x\n", c);
if (chr_last == GS_CONSOLE_ESC)
{
if (check_arrow(&esc, c) == 0)
return 0; // More data required
chr_last = c;
switch (c)
{
case 'A': // UP
if (esc == 0)
break;
if (gopt.is_console == 0)
return 0; // Ignore if no console
DEBUGF_G("^E-UP received. Calling cursor_to_ut()\n");
cursor_to_ut();
return 0;
case 'B': // DOWN
if (esc == 0)
break;
if (gopt.is_console == 0)
return 0; // Ignore if no console
// Arrow Down
cursor_to_lt();
return 0;
case GS_CONSOLE_ESC_CHR:
case GS_CONSOLE_ESC_LCHR:
DEBUGF_Y("esc-chr (last=0x%02x, this=0x%02x)\n", GS_CONSOLE_ESC, c);
*submit = GS_CONSOLE_ESC;
return -1;
case GS_CONSOLE_ESC: // ^E + ^E
DEBUGF_Y("esc\n");
*submit = GS_CONSOLE_ESC;
chr_last = 0; // reset or ^E+^E+any wont work
return -1;
}
return c; // screen-like (*#1*)
// Not reached (non-screen behavior)
// *submit = c;
// return -2;
}
chr_last = c;
if (c == GS_CONSOLE_ESC)
return 0;
*submit = c;
return -1;
}
void
CONSOLE_reset(void)
{
char buf[1024];
char *ptr = buf;
char *end = buf + sizeof (buf);
if (tty_fd < 0)
return;
DEBUGF_R("Resetting scolling area (rows %d)\n", gopt.winsize.ws_row);
if (gopt.is_console)
{
ptr = buf;
// Reset scrolling area. Will set cursor to 1;1.
// SXPRINTF(ptr, end - ptr, "\x1B[r");
SXPRINTF(ptr, end - ptr, "\x1b[1;%dr", gopt.winsize.ws_row);
/* Move cursor to last line */
SXPRINTF(ptr, end - ptr, "\x1B[9999;9999H");
/* Restore cursor */
if (write(stdout_fd, buf, ptr - buf) != ptr - buf)
ERREXIT("write()\n");
}
close(tty_fd);
tty_fd = -1;
}
struct _pat
{
char *data;
size_t len;
int type;
};
static struct _pat cls_pattern[] = {
{"\x1B[0J", 4, 1}, // Clear screen from cursor down
{"\x1B[J", 3, 1}, // Clear screen from cursor down
{"\x1B[2J", 4, 1}, // Clear entire screen
{"\x1B""c", 2, 4} // Reset terminal to initial state
};
static struct _pat sb_pattern[] = {
{"\x1B[?1049h", 8, 2}, // Switch Alternate Screen Buffer (clears screen)
{"\x1B[?1049l", 8, 3} // Switch Normal Screen Buffer (clears screen)
};
/*
* Parse output and check for a any terminal escape sequence that clears
* the screen.
*
* FIXME-PERFORMANCE: Could substitute [J and [2J and [0J with code
* that goes to last line, then clears line '[K' and then scrools up
* x line to clear the screen. That way the console would not need
* to be re-drawn on every 'clear screen' by the app.
*
* Return 0 if not found.
* cls_code = 1 => Clear screen
* cls_code = 2 => Switched to screen buffer
* cls_code = 3 => Switched to normal buffer
*
* amount => Amount of data save to process (remaining is part of an
* unfinished ansi sequence).
*/
// Parse through the ansi sequence until it is finished.
// Return length of ansi sequence or 0 if more data is required (ansi sequence hasnt finished yet)
static size_t
ansi_until_end(uint8_t *src, size_t src_sz, int *ignore)
{
uint8_t *src_end = src + src_sz;
uint8_t *src_orig = src;
// Must start with ^[
XASSERT(*src == '\x1b', "src not starting with 0x1B (0x02%c)\n", *src);
src += 1;
*ignore = 0;
while (src < src_end)
{
if (*src == '\x1B')
{
// Huh? An ESC inside an ESC sequence?
*ignore = 1;
return src - src_orig;
}
if (src > src_orig + 16)
{
// ESC sequence is to long. We are not interested....
*ignore = 1;
return src - src_orig;
}
// Check for 2 octet ESC sequence that does not end in A-Za-z
if (src_orig + 1 == src)
{
switch (*src)
{
case '8':
case '7':
case '>':
case '<':
case '=':
case '\\':
src++;
return src - src_orig;
}
}
// Check if this is the end of an ansi sequence
if ((*src >= 'a') && (*src <= 'z'))
{
src++;
return src - src_orig;
}
if ((*src >= 'A') && (*src <= 'Z'))
{
src++;
return src - src_orig;
}
src++;
}
return 0; // Not enough data // src - src_orig;
}
static size_t
ansi_until_esc(uint8_t *src, size_t src_sz, int *in_esc)
{
uint8_t *src_end = src + src_sz;
uint8_t *src_orig = src;
while (src < src_end)
{
if (*src == '\x1B')
{
*in_esc = 1;
// DEBUGF("at pos %zd=0x%02x\n", src - src_orig, *src);
break;
}
src++;
}
return src - src_orig;
}
static int in_esc;
// Parse 'src' for an ansi sequence that we might be interested in.
// *tail_len contains a number of bytes if there is an incomplete ansi-sequence (and we
// do not have enough data yet)
//
// Return: Length of data in dst.
static void
ansi_parse(uint8_t *src, size_t src_sz, GS_BUF *dst, size_t *tail_len, int *cls_code, int *sb_code)
{
uint8_t *src_end = src + src_sz;
size_t len;
int ignore;
*tail_len = 0;
while (src < src_end)
{
if (in_esc)
{
len = ansi_until_end(src, src_end - src, &ignore);
// DEBUGF("esc len=%zd, ignore=%d, dst=%zd, left=%zd\n", len, ignore, GS_BUF_USED(dst), src_end - src);
if (len == 0)
{
// Not enough data
DEBUGF_R("Not Enough Data. TAIL %zd\n", src_end - src);
DEBUGF("esc len=%zd, ignore=%d, dst=%zd, left=%zd\n", len, ignore, GS_BUF_USED(dst), src_end - src);
HEXDUMP(src, src_end - src);
*tail_len = src_end - src;
return; //break;
}
in_esc = 0;
#ifdef DEBUG
// Output some ANSI but ignore some often re-occuring codes:
while (1)
{
// if (len <= 4)
// break; // Ignore short ones...like [1m
if ((len == 8) && (src[7] == 'm'))
break; // Ingore [39;49m to debug 'top'
if ((len == 5) && (src[4] == 'm'))
break; // Ingore [39m to debug 'mc'
if ((len == 4) && (src[3] == 'm'))
break; // Ingore [1m to debug
DEBUGF_B("ANSI %.*s\n", (int)len -1, src+1);
break;
}
#endif
if (ignore)
{
GS_BUF_add_data(dst, src, len);
src += len;
continue;
}
int is_substitute = 0;
// Check if the Upper Tier (ut) wants the cursor prompt ON or OFF
// Check for this even if the console is closed so that when we open the console
// that the right cursor can be displayed
is_substitute = 0;
while (len == 6)
{
if (memcmp(src + 1, "[?25l", 5) == 0)
ut_cursor = GS_UT_CURSOR_OFF; // OFF
else if (memcmp(src + 1, "[?25h", 5) == 0)
ut_cursor = GS_UT_CURSOR_ON; // ON
else
break;
// DEBUGF_R("ut_cursor=%d, in-console=%d\n", ut_cursor, is_cursor_in_console);
// If cursor is in console then ignore all requests
if (is_cursor_in_console)
{
is_substitute = 1;
src += len;
break;
}
break;
}
if (is_substitute)
continue;
// Check for Bracketed paste mode [?2004l
if (len == 8)
{
if (memcmp(src + 1, "[?2004l", 7) == 0)
is_console_cursor_needs_reset = 0;
else if (memcmp(src + 1, "[?2004h", 7) == 0)
is_console_cursor_needs_reset = 1;
}
// If console is not open then we do not have to check any other ansi symboles
if (gopt.is_console == 0)
{
GS_BUF_add_data(dst, src, len);
src += len;
continue;
}
// Replace [2J (clear entire screen) with move to last line. Clear Line. Clear from cursor up
if ((len == 4) && (memcmp(src + 1, "[2J", 3) == 0))
{
// Move to last line. [K => Clear until end of line. [1J => Clear up]]
GS_BUF_printf(dst, "\x1b[%d;1f\x1b[K\x1b[1J", gopt.winsize.ws_row - GS_CONSOLE_ROWS);
src += len;
continue;
}
// [J = Clear from cursor down
// I dont have a solution how to do this more efficient beside re-drawing entire console :/
// or the need to track the cursor position or request the position from the terminal.
// If the cursor position is known (as cordinated) then it's easy: Set up new scrolling area.
// Use [<nnn>S (scroll up n lines) to scroll black.
// Reset scrolling area to original.
// if ((len == 3) && (memcmp(src + 1, "[J", 2) == 0))
// {
// src += len;
// continue;
// }
if ((len == 3) && memcmp(src + 1, "[r", 2) == 0)
{
DEBUGF_R("Scrolling area reset received.\n");
if (gopt.is_console)
{
GS_BUF_printf(dst, "\x1B[1;%dr", gopt.winsize.ws_row - GS_CONSOLE_ROWS);
src += len;
continue;
}
}
// Check if this was a cursor-position request that moved the course
// outside its boundary (and into our console, like debian's top does (!))
// '\x1b' + '[1;1h'
is_substitute = 0;
while (1)
{
if (len < 6)
break;
// DEBUGF_W("len %d\n", len);
if ((src[len-1] != 'H') && (src[len-1] != 'h'))
break;
// search for ';' between src+2 and src+len
uint8_t *ptr = src+2;
for (ptr = src + 2; ptr < src+len; ptr++)
{
if (*ptr == ';')
break;
}
if (*ptr != ';')
break;
int row = atoi((char *)src+2);
int col = atoi((char *)ptr+1);
// DEBUGF_W("pos %d:%d\n", row, col);
if (row > gopt.winsize.ws_row - GS_CONSOLE_ROWS)
{
DEBUGF_R("CURSOR MOVE outside area DENIED. Changed to: %d;%d\n", gopt.winsize.ws_row - GS_CONSOLE_ROWS, col);
GS_BUF_printf(dst, "\x1B[%d;%dH\r\n", gopt.winsize.ws_row - GS_CONSOLE_ROWS, col);
src += len;
is_substitute = 1;
}
break;
}
if (is_substitute)
continue;
// Check for any ANSI sequence that may have cleared the screen:
int i;
for (i = 0; i < sizeof cls_pattern / sizeof *cls_pattern; i++)
{
if (cls_pattern[i].len != len)
continue;
if (memcmp(cls_pattern[i].data, src, len) != 0)
continue;
DEBUGF_W("CLS found %d\n", cls_pattern[i].type);
*cls_code = cls_pattern[i].type;
}
// Check for any ANSI sequence that changed Screen Buffer
for (i = 0; i < sizeof sb_pattern / sizeof *sb_pattern; i++)
{
if (sb_pattern[i].len != len)
continue;
if (memcmp(sb_pattern[i].data, src, len) != 0)
continue;
// Handle if we receive [?1049h + [?1049l in one go then do nothing.
if (*sb_code == 0)
{
*sb_code = sb_pattern[i].type;
} else {
if (*sb_code != sb_pattern[i].type)
*sb_code = 0;
else
*sb_code = sb_pattern[i].type;
}
DEBUGF_W("SB change found (%d), sb_code set to %d\n", sb_pattern[i].type, *sb_code);
}
// We are not interested to substitute it. Let it pass through.
GS_BUF_add_data(dst, src, len);
src += len;
} else {
// DEBUGF_Y("#%zd not in esc\n", src - src_orig);
len = ansi_until_esc(src, src_end - src, &in_esc);
GS_BUF_add_data(dst, src, len);
src += len; // *src points to ESC or is done.
}
}
}
GS_BUF g_dst;
GS_BUF g_ansi;
/*
* Buffered write to ansi terminal. All output to terminal needs to be analyzed
* and checked for 'clear screen' ansi code. If found then the console needs
* to be re-drawn as well.
*
* Also need to find a good place to inject ansi sequence to move cursor
* to upper tier (if in console).
*
* We do this by buffering the output and to only write complete ansi sequences
* and never an incomplete sequences (as it would then not be possible to issue
* another ESC sequence to move the cursor).
*
* - Find a good place to inject to move cursor from console to upper tier
* - If half way inside an ansi sequence then buffer the remaining
* - Also return if an ansi sequence was sent that clears the screen
*/
// Parse ANSI:
// 1. Find any ansi sequence that clears the screen (so we know when to draw our console again)
// 2. Substitute ESC-sequences with our own to stop console from getting fucked.
// 3. If the ESC-sequence stops half way then write *dst and record
// the remaining sequence (if we have that much space)
static ssize_t
ansi_write(int fd, void *src, size_t src_len, int *cls_code, int *sb_code)
{
// size_t amount = 0;
size_t tail_len = 0;
size_t src_len_orig = src_len;
if (!GS_BUF_IS_INIT(&g_dst))
{
GS_BUF_init(&g_dst, 1024);
GS_BUF_init(&g_ansi, 1024);
}
if (GS_BUF_USED(&g_ansi) > 0)
{
GS_BUF_add_data(&g_ansi, src, src_len);
src = GS_BUF_DATA(&g_ansi);
src_len = GS_BUF_USED(&g_ansi);
}
// HEXDUMP(src, src_len);
ansi_parse(src, src_len, &g_dst, &tail_len, cls_code, sb_code);
if (GS_BUF_USED(&g_dst) > 0)
{
if (write(fd, GS_BUF_DATA(&g_dst), GS_BUF_USED(&g_dst)) != GS_BUF_USED(&g_dst))
{
DEBUGF_R("Failed to write() all data...\n"); // SHOULD NOT HAPPEN
return -1;
}
}
GS_BUF_empty(&g_dst);
GS_BUF_empty(&g_ansi);
if (tail_len > 0)
{
// Use memmove() here because src might be pointing to same data but further along
GS_BUF_memmove(&g_ansi, src + src_len - tail_len, tail_len);
}
// From the caller's perspective this function has processed all data
// and this function will buffer (if needed) any data not yet passed
// to 'write()'. Thus return 'len' here to satisfy caller that all supplied
// data is or will be processed.
return src_len_orig;
}
static int is_console_before_sb; // before Alternate Screen Buffer
/*
* Parse all output and check if the screen is cleared. If so then
* redraw the console (if console is active)
*
* Situation to think about:
* - console is visible
* - top switches to frame buffer (console is visible)
* - console is turned off
* - top exits.
* -> Still need to parse all output to check when we switch back to normal
* buffer. The console was VISIBILE before we entered 'top' and now
* need to be diabled after exiting 'top'.
* Midnight commander:
* - console is visible
* - launch mc. mc does not use Screen Buffer (t should!) but instead remembers
* the max screen size.
* - while in mc, turn the console off. Then exit mc.
* - mc will set the scroll area as when the console was visibile (but it aint
* anymore).
*
* FIXME unsolved nested console problem:
* - Both consoles fight to use ^[7 to save the cursor position:
* Start outter gs-netcat. Open console. Move cursor to (outter) Upper Tier.
*
* Start another gs-netcat (inner from within outter). Open console. Sends [7 to save
* (*1) cursor position from (inner) Upper Tier. Both consoles are not open (inner & outter).
*
* Outter updates its StatusBar (every second): It sends a [7 to save cursor position
* from its Upper Tier.
* That [7 request will overwrite the [7 that was sent under (*1) and will now store the position
* of the cursor from inners console prompt. When the inner wants to move cursor its upper tier
* it will send a [8 but that will move the cursor to its own prompt and not to its upper tier.
*
* - Workaround: Always leave cursor in up-most tier. Use a 'fake' cursor for the console
* (like '_', [7m) and if cursor is supposed to be in the console then make it invisible
* in upper tier (but move it back to upper tier [while invisilbe] as soon as console
* update is completed).
* The tricky parts are two:
* 1. The outter does not know if the inner has the cursor in the console or its Upper Tier.
* What should happen if ESC-e UP is pressed in outter tier? Cursor ON or OFF?
* -> Could be solved by inner sending an 'in-band' custom ESC-sequence to outter that outter
* intercepts (or if there is no outter but xterm, then ignored by xterm).
* 2. The inner does not know when to disable its own fake-cursor (e.g. when outter presses ESC-e DOWN)
* to move from its (outter) Upper Tier to (outter) console.
* There is no signal send to the inner that its cursor should be disabled because the outter
* moved it into its own console.
*/
ssize_t
CONSOLE_write(int fd, void *data, size_t len)
{
int is_detected_clearscreen = 0;
int is_sb_detected = 0;
/* Move cursor to upper tier if cursor inside console */
if (is_cursor_in_console)
{
// DEBUGF_C("CURSOR-restore\n");
if (ut_cursor == GS_UT_CURSOR_OFF)
tty_write("\x1B[?25l\x1B""8", 6+2); // Restore cursor to upper tier
else
tty_write("\x1B""8", 2); // Restore cursor to upper tier
}
ssize_t sz;
sz = ansi_write(fd, data, len, &is_detected_clearscreen, &is_sb_detected);
// The write() to upper tier may have set some funky paste modes and
// screen-buffer modes. Track this (even if console is currently
// closed - because it may have been closed while in a screen-buffer).
if (is_cursor_in_console)
{
// DEBUGF_C("CURSOR-save\n");
tty_write("\x1B""7", 2); // Save new cursor position after writing to upper tier
}
// Now check if console needs to be re-drawn
if (is_sb_detected == 2)
{
// Switch to Alternate Screen Buffer detected
is_console_before_sb = gopt.is_console;
DEBUGF_W("saving is_console=%d\n", gopt.is_console);
}
// DEBUGF_G("cls = %d iscon-before = %d, iscon-now %d\n", is_detected_clearscreen, is_console_before_sb, gopt.is_console);
if (is_sb_detected == 3)
{
// Switched to Normal Screen Buffer detected
DEBUGF_W("saved-is-console=%d, is_console=%d\n", is_console_before_sb, gopt.is_console);
if (is_console_before_sb != gopt.is_console)
{
// Console has changed while operating on screen buffer
if (gopt.is_console == 0)
console_stop();
else
console_reset();
}
}
if (is_detected_clearscreen == 4)
{
DEBUGF_R("RESET of terminal detected.\n");
if (gopt.is_console)
console_reset();
}
// Now we can safely return (after we tracked the ansi codes).
if (gopt.is_console == 0)
return sz;
if ((is_detected_clearscreen) || (is_sb_detected))
console_draw(fd, 1 /*force*/);
if (is_cursor_in_console)
cursor_to_lt();
return sz;
}
/*
* Offer data to console for readline. If cursor is in console then
* we shall read those data in readline style.
*
* Return 1 if data was for console.
* Return 0 otherwise
*/
int
CONSOLE_readline(struct _peer *p, void *data, size_t len)
{
int fd = p->fd_out;
uint8_t *src = (uint8_t *)data;
uint8_t *s_end = src + len;
uint8_t key;
int rv;
int is_got_line = 0;
if (!(is_cursor_in_console))
return 0;
for (; src < s_end; src++)
{
rv = GS_RL_add(&rl, *src, &key, gopt.winsize.ws_row, 1 + GS_CONSOLE_PROMPT_LEN);
if (rl.esc_len > 0)
{
if (write(fd, rl.esc_data, rl.esc_len) != rl.esc_len)
ERREXIT("write()\n");
}
if (rv < 0)
{
// HERE: Special character (like UP/DOWN or ENTER)
if (key == '\n')
{
is_got_line = 1;
break;
} else if (key == 'A') {
DEBUGF_Y("UP\n");
GS_condis_up(&gs_condis);
CONSOLE_draw(gs_condis.fd);
} else if (key == 'B') {
GS_condis_down(&gs_condis);
CONSOLE_draw(gs_condis.fd);
}
// Unhandled control character (ignore for input)
continue;
}
}
if (is_got_line)
{
console_command(p, rl.line);
GS_RL_reset(&rl);
}
// DEBUGF("final line: '%s'\n", rl.line);
return 1;
}
/*
* Set up terminal to display console (e.g. scroll upper tier up
* and save cursor location of upper tier).
* Called when console starts or when change in screenbuffer is detected.
*/
static void
console_reset(void)
{
char buf[GS_CONSOLE_BUF_SIZE];
char *end = buf + sizeof (buf);
char *ptr = buf;
int row;
row = gopt.winsize.ws_row - GS_CONSOLE_ROWS;
int i;
// Scroll up i lines
for (i = 0; i < GS_CONSOLE_ROWS; i++)
SXPRINTF(ptr, end - ptr, "\x1B""D");
// Move cursor up. Then save cursor pos.
SXPRINTF(ptr, end - ptr, "\x1B[%dA\x1B""7", GS_CONSOLE_ROWS);
// Set scrolling area. Will set cursor to 1;1.
DEBUGF("Setting Scrolling area to %d\n", row);
SXPRINTF(ptr, end - ptr, "\x1b[1;%dr", row);
// Restore cursor to saved location
SXPRINTF(ptr, end - ptr, "\x1B""8");
tty_write(buf, ptr - buf);
}
static void
console_start(void)
{
console_reset();
gopt.is_console = 1;
cursor_to_lt(); // Start with cursor in console
}
/*
* configure terminal back to normal (no console)
*/
static void
console_stop(void)
{
char buf[GS_CONSOLE_BUF_SIZE];
char *end = buf + sizeof (buf);
char *ptr = buf;
// Clear console
SXPRINTF(ptr, end - ptr, "\x1B[%d;1f", gopt.winsize.ws_row - GS_CONSOLE_ROWS);
SXPRINTF(ptr, end - ptr, "\x1B[J");
// Reset scroll size
SXPRINTF(ptr, end - ptr, "\x1B[r");
// Upper Tier wants cursor OFF
if (ut_cursor == GS_UT_CURSOR_OFF)
SXPRINTF(ptr, end - ptr, "\x1B[?25l");
// Restore cursor to upper tier (shell)
SXPRINTF(ptr, end - ptr, "\x1B""8");
tty_write(buf, ptr - buf);
is_cursor_in_console = 0;
gopt.is_console = 0;
}
/*
* Equivalent to ssh's ~. quick exit.
*/
static int
hard_quit(void)
{
CONSOLE_reset();
stty_reset();
exit(0); // hard exit.
}
/*
* Process single action keys (e.g. CTRL+E + <action>)
*/
int
CONSOLE_action(struct _peer *p, uint8_t key)
{
console_init(p->fd_out);
DEBUGF("\nConsole Key Action 0x%02x\n", key);
if (key == 'q')
hard_quit();
#ifdef DEBUG
if (key == 'l')
{
DEBUGF_B("redraw\n");
mk_statusbar();
console_draw(p->fd_out, 1);
}
#endif
if (key == 'c')
{
gopt.is_win_resized = 1; // Trigger: Send new window size to peer
gopt.is_want_ids_on = 1;
GS_SELECT_FD_SET_W(p->gs);
if (gopt.is_console == 1)
{
// Close console and restore cursor
console_stop();
return 0;
}
console_start();
GS_condis_pos(&gs_condis, (gopt.winsize.ws_row - GS_CONSOLE_ROWS) + 1 + 1, gopt.winsize.ws_col);
if (is_console_welcome_msg == 0)
{
GS_condis_add(&gs_condis, 0, "Press Ctrl-e + c to close this console or Ctrl-e + q to quit.");
GS_condis_add(&gs_condis, 0, "Press Ctrl-e + UP to leave the console.");
GS_condis_add(&gs_condis, 0, "Press Ctrl-e + DOWN to enter the console.");
GS_condis_add(&gs_condis, 0, "Use UP/DOWN to scroll through the console's log");
GS_condis_add(&gs_condis, 0, "Type 'help' for a list of commands.");
is_console_welcome_msg = 1;
}
// Draw console needed? Resizing remote will trigger a CLEAR (=> re-draw)
mk_statusbar();
console_draw(p->fd_out, 1);
}
return 0;
}
static void
cmd_help(int fd)
{
GS_condis_add(&gs_condis, 0, "quit - Quit | Ctrl-e q : quit | Ctrl-e c : toggle console");
GS_condis_add(&gs_condis, 0, "ping - RTT to peer | Ctrl-e UP: Go Up | Ctrl-e DN: Go Down");
GS_condis_add(&gs_condis, 0, "put <file> - Upload file - Example: put /usr/./share/ma*");
GS_condis_add(&gs_condis, 0, "get <file> - Download file - Example: get ~/*.[ch]");
GS_condis_add(&gs_condis, 0, "Other commands: lls, lcd, lmkdir, lpwd, pwd");
GS_condis_draw(&gs_condis, 1);
}
// Use wordexp(3) to resolve path name with ~/ and variable substitution
static int
path_resolve(const char *pattern, char *dst, size_t len)
{
wordexp_t p;
int ret;
if (len <= 0)
return -1;
dst[0] = '\0';
// On failure return 'pattern' as path
snprintf(dst, len, "%.*s", MAX(0, (int)len -1) , pattern);
signal(SIGCHLD, SIG_DFL);
ret = wordexp(pattern, &p, WRDE_NOCMD);
signal(SIGCHLD, SIG_IGN);
if (ret != 0)
{
DEBUGF_R("wordexp(%s) error: %d\n", pattern, ret);
return -1;
}
if (p.we_wordc <= 0)
{
wordfree(&p);
return -1;
}
snprintf(dst, len, "%s", p.we_wordv[0]);
wordfree(&p);
return 0;
}
static const char *
strip_space(const char *str)
{
while (*str == ' ')
str++;
return str;
}
// Output single file information
static void
cmd_lls_file(const char *name)
{
struct stat sr;
if (stat(name, &sr) != 0)
{
// ERROR
GS_condis_printf(&gs_condis, GS_PKT_APP_LOG_TYPE_DEFAULT, "%s: %s", strerror(errno), name);
return;
}
#ifdef __APPLE__
struct timespec ts = sr.st_mtimespec;
#else
struct timespec ts = sr.st_mtim;
#endif
struct tm tm;
localtime_r(&ts.tv_sec, &tm);
// MS-DOS style output (oldskewl)
char tmstr[32];
strftime(tmstr, sizeof tmstr, "%Y-%m-%d %H:%M", &tm);
const char *typestr = "<\?\?\?>";
if (S_ISDIR(sr.st_mode))
typestr = "<DIR>";
else if (S_ISLNK(sr.st_mode))
typestr = "<LNK>";
else if (S_ISFIFO(sr.st_mode))
typestr = "<FIF>";
else if (S_ISBLK(sr.st_mode))
typestr = "<BLK>";
else if (S_ISCHR(sr.st_mode))
typestr = "<DEV>";
else if (S_ISREG(sr.st_mode))
typestr = "";
GS_condis_printf(&gs_condis, GS_PKT_APP_LOG_TYPE_DEFAULT, "%16s %5.5s %' 16"PRId64" %s", tmstr, typestr, (int64_t)sr.st_size, name);
}
// List local files.
static void
cmd_lls_single(const char *exp)
{
wordexp_t p;
char **w;
DIR *d = NULL;
char buf[GS_PATH_MAX];
int ret;
signal(SIGCHLD, SIG_DFL);
ret = wordexp(exp, &p, 0);
signal(SIGCHLD, SIG_IGN);
if (ret != 0)
return; // error (0 found)
setlocale(LC_NUMERIC, ""); // for printf("'%d" thausand separator
w = p.we_wordv;
// If there is only ONE result and that result is a DIRECTORY then output the content
// of that directory instead. (e.g. 'ls .' or 'ls /tmp')
struct stat sr;
if ((p.we_wordc == 1) && (stat(w[0], &sr) == 0) && S_ISDIR(sr.st_mode))
{
// Opendir etc..
d = opendir(w[0]);
if (d == NULL)
{
// ERROR
GS_condis_printf(&gs_condis, GS_PKT_APP_LOG_TYPE_DEFAULT, "%s: %s", strerror(errno), w[0]);
goto err;
}
struct dirent *entry;
for (entry = readdir(d); entry != NULL; entry = readdir(d))
{
if (memcmp(w[0], ".\0", 2) == 0)
snprintf(buf, sizeof buf, "%s", entry->d_name);
else
snprintf(buf, sizeof buf, "%s/%s", w[0], entry->d_name);
cmd_lls_file(buf);
}
} else {
int i;
for (i = 0; i < p.we_wordc; i++)
cmd_lls_file(w[i]);
}
err:
if (d != NULL)
closedir(d);
wordfree(&p);
}
static void
cmd_lls(const char *str)
{
char *orig = strdup(str);
char *next;
char *name = orig;
while (name != NULL)
{
next = strchr(name, ' ');
if (next != NULL)
{
*next = '\0';
next += 1;
}
cmd_lls_single(name);
name = next;
}
XFREE(orig);
}
static int
console_command(struct _peer *p, const char *cmd)
{
int fd = p->fd_out;
char buf[GS_CONSOLE_BUF_SIZE];
char path[GS_PATH_MAX + 1];
char *end = buf + sizeof (buf);
char *ptr;
const char *arg;
if (strlen(cmd) <= 0)
return 0;
if (memcmp(cmd, "help", 4) == 0)
{
cmd_help(fd);
} else if (memcmp(cmd, "ping", 4) == 0) {
cmd_ping(p);
} else if (memcmp(cmd, "quit", 4) == 0) {
hard_quit();
} else if (memcmp(cmd, "pwd", 3) == 0) {
cmd_pwd(p);
} else if (memcmp(cmd, "clear", 5) == 0) {
GS_condis_clear(&gs_condis);
GS_condis_draw(&gs_condis, 1);
} else if (memcmp(cmd, "put ", 4) == 0) {
GS_FT_put(&p->ft, cmd+4);
GS_SELECT_FD_SET_W(p->gs);
} else if (memcmp(cmd, "get ", 4) == 0) {
GS_FT_get(&p->ft, cmd+4);
GS_SELECT_FD_SET_W(p->gs);
} else if (memcmp(cmd, "xaitax", 6) == 0) {
GS_condis_add(&gs_condis, GS_PKT_APP_LOG_TYPE_DEFAULT, "Thanks xaitax for testing!");
GS_condis_draw(&gs_condis, 1);
} else if (strncmp(cmd, "lpwd", 4) == 0) {
char *cwd = getcwdx();
GS_condis_add(&gs_condis, GS_PKT_APP_LOG_TYPE_DEFAULT, cwd);
XFREE(cwd);
GS_condis_draw(&gs_condis, 1);
} else if (strncmp(cmd, "lcd ", 4) == 0) {
arg = strip_space(cmd + 4);
path_resolve(arg, path, sizeof path);
if (chdir(path) != 0)
GS_condis_printf(&gs_condis, GS_PKT_APP_LOG_TYPE_DEFAULT, "%s: %.512s", strerror(errno), path);
else {
char *cwd = getcwdx();
GS_condis_printf(&gs_condis, GS_PKT_APP_LOG_TYPE_DEFAULT, "%s", cwd);
XFREE(cwd);
}
GS_condis_draw(&gs_condis, 1);
} else if (strncmp(cmd, "lmkdir ", 7) == 0) {
arg = strip_space(cmd + 7);
if (mkdir(arg, 0777) != 0)
{
GS_condis_printf(&gs_condis, GS_PKT_APP_LOG_TYPE_DEFAULT, "%s: %.512s", strerror(errno), arg);
GS_condis_draw(&gs_condis, 1);
}
} else if (strncmp(cmd, "lls", 3) == 0) {
arg = strip_space(cmd + 3);
if (*arg == 0)
arg = "."; // 'lls' should be 'lls .' (current directory)
cmd_lls(arg);
GS_condis_draw(&gs_condis, 1);
} else {
GS_condis_printf(&gs_condis, 0, "Command not known: '%s'", cmd);
GS_condis_draw(&gs_condis, 1);
}
ptr = buf;
SXPRINTF(ptr, end - ptr, "\x1B[%d;%zuf\x1B[K", gopt.winsize.ws_row, 1 + GS_CONSOLE_PROMPT_LEN);
tty_write(buf, ptr - buf);
return 0;
}
|
ab7d24b3ccf9896079cd4f7a400831ed2db3100c
|
2af283f8a587bcc3d2a744f7d86007ab2428f9bc
|
/src/dev_model/deprecated/impl_ntp.c
|
ffb9f94189896c1d55bbc904cb115e1582cde022
|
[
"Apache-2.0"
] |
permissive
|
aliyun/iotkit-embedded
|
bfda585c8a5db3fea215ad15fe7699cebde1dfc8
|
3010153fb53865ce3925f8e43900adbbfa358874
|
refs/heads/v3.0.1
| 2023-03-12T23:14:04.902446
| 2022-11-11T07:12:05
| 2022-11-11T09:01:43
| 106,364,205
| 544
| 289
|
Apache-2.0
| 2023-08-22T06:00:04
| 2017-10-10T03:30:08
|
C
|
UTF-8
|
C
| false
| false
| 5,013
|
c
|
impl_ntp.c
|
/*
* Copyright (C) 2015-2018 Alibaba Group Holding Limited
*/
#include "iotx_dm_internal.h"
#ifdef DEPRECATED_LINKKIT
#include "infra_json_parser.h"
#include "mqtt_api.h"
#include "impl_ntp.h"
#if defined(__cplusplus) /* If this is a C++ compiler, use C linkage */
extern "C" {
#endif
#ifdef INFRA_MEM_STATS
#include "infra_mem_stats.h"
#define IMPL_NTP_MALLOC(size) LITE_malloc(size, MEM_MAGIC, "impl.ntp")
#define IMPL_NTP_FREE(ptr) LITE_free(ptr)
#else
#define IMPL_NTP_MALLOC(size) HAL_Malloc(size)
#define IMPL_NTP_FREE(ptr) {HAL_Free((void *)ptr);ptr = NULL;}
#endif
typedef void (*ntp_reply_cb_t)(const char *);
static ntp_reply_cb_t g_ntp_reply_cb = NULL;
static char g_ntp_time[NTP_TIME_STR_MAX_LEN + 1] = {0};
static void linkkit_ntp_time_reply(void *pcontext, void *pclient, void *mesg)
{
#define DEV_TX_TIME "deviceSendTime"
#define SERVER_RX_TIME "serverRecvTime"
#define SERVER_TX_TIME "serverSendTime"
int len = 0;
char *elem = NULL;
char server_rx_time[NTP_TIME_STR_MAX_LEN + 1] = {0};
char server_tx_time[NTP_TIME_STR_MAX_LEN + 1] = {0};
uint32_t payload_len;
char *payload;
uint32_t tx = 0;
uint32_t rx = 0;
uint32_t diff = 0;
iotx_mqtt_event_msg_pt msg = (iotx_mqtt_event_msg_pt)mesg;
iotx_mqtt_topic_info_pt ptopic_info = (iotx_mqtt_topic_info_pt) msg->msg;
switch (msg->event_type) {
case IOTX_MQTT_EVENT_PUBLISH_RECEIVED:
payload_len = ptopic_info->payload_len;
payload = (char *)ptopic_info->payload;
break;
default:
goto NTP_FAIL;
}
if (payload == NULL || payload_len == 0) {
goto NTP_FAIL;
}
memset(g_ntp_time, 0, sizeof(g_ntp_time));
log_debug("[ntp]", "ntp reply len:%u, payload:%s\r\n", payload_len, payload);
/*
* get deviceSendTime, serverRecvTime, serverSendTime
*/
elem = json_get_value_by_name(payload, payload_len, SERVER_TX_TIME, &len, NULL);
if (elem == NULL || len <= 0 || len > NTP_TIME_STR_MAX_LEN) {
goto NTP_FAIL;
}
memcpy(server_tx_time, elem, len);
elem = json_get_value_by_name(payload, payload_len, SERVER_RX_TIME, &len, NULL);
if (elem == NULL || len <= 0 || len > NTP_TIME_STR_MAX_LEN) {
goto NTP_FAIL;
}
memcpy(server_rx_time, elem, len);
elem = json_get_value_by_name(payload, payload_len, DEV_TX_TIME, &len, NULL);
if (elem == NULL || len <= 0 || len > NTP_TIME_STR_MAX_LEN) {
goto NTP_FAIL;
}
/*
* atoi fails to convert string to integer
* so we convert manully
*/
while (len -- > 0) {
tx *= 10;
tx += elem[0] - '0';
elem ++;
}
rx = HAL_UptimeMs();
diff = (rx - tx) >> 1;
if (diff >= 1000000) {
goto NTP_FAIL;
}
len = strlen(server_tx_time);
elem = &server_tx_time[len > 9 ? len - 9 : 0];
tx = atoi(elem);
tx += diff;
if (tx > 999999999) {
tx = 999999999;
}
if (len > 9) {
sprintf(elem, "%09u", (unsigned int)tx);
} else {
sprintf(elem, "%u", (unsigned int)tx);
}
strncpy(g_ntp_time, (const char *)server_tx_time, sizeof(g_ntp_time) - 1);
NTP_FAIL:
if (g_ntp_reply_cb != NULL) {
g_ntp_reply_cb(g_ntp_time);
}
return;
}
int linkkit_ntp_time_request(void (*ntp_reply)(const char *ntp_offset_time_ms))
{
int ret = -1;
int final_len = 0;
int packet_len = 64;
int topic_len = 128;
char *packet = NULL;
char *topic = NULL;
do {
char pk[IOTX_PRODUCT_KEY_LEN + 1] = {0};
char dn[IOTX_DEVICE_NAME_LEN + 1] = {0};
HAL_GetProductKey(pk);
HAL_GetDeviceName(dn);
topic = (char *)IMPL_NTP_MALLOC(topic_len + 1);
if (topic == NULL) {
goto NTP_REQ_ERR;
}
memset(topic, 0, topic_len + 1);
HAL_Snprintf(topic, topic_len, TOPIC_NTP_REPLY, pk, dn);
ret = IOT_MQTT_Subscribe_Sync(NULL, topic, IOTX_MQTT_QOS0,
(iotx_mqtt_event_handle_func_fpt)linkkit_ntp_time_reply, NULL, 1000);
if (ret < 0) {
goto NTP_REQ_ERR;
}
memset(topic, 0, topic_len + 1);
HAL_Snprintf(topic, topic_len, TOPIC_NTP, pk, dn);
} while (0);
packet = (char *)IMPL_NTP_MALLOC(packet_len + 1);
if (packet == NULL) {
ret = -1;
goto NTP_REQ_ERR;
}
memset(packet, 0, packet_len + 1);
g_ntp_reply_cb = ntp_reply;
final_len = HAL_Snprintf(packet, packet_len, "{\"deviceSendTime\":\"%u\"}", (unsigned int)(HAL_UptimeMs()));
log_debug("[ntp]", "report ntp:%s\r\n", packet);
ret = IOT_MQTT_Publish_Simple(NULL, topic, IOTX_MQTT_QOS0, packet, final_len);
NTP_REQ_ERR:
if (topic) {
IMPL_NTP_FREE(topic);
}
if (packet) {
IMPL_NTP_FREE(packet);
}
return ret;
}
#if defined(__cplusplus) /* If this is a C++ compiler, use C linkage */
}
#endif
#endif
|
8b8d710b88308688614f1d5cd43f1bf0b0bd8c25
|
21c92afbd7fd022a206fb31294c523aebb770104
|
/SuiteSparse/CHOLMOD/Cholesky/t_cholmod_rowfac.c
|
2594766bc728d169131492cf19a7b604b8f1edb6
|
[
"BSD-3-Clause",
"LGPL-2.1-only",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-unknown-license-reference",
"GPL-2.0-or-later",
"GPL-3.0-only",
"LGPL-2.1-or-later",
"LGPL-2.0-or-later",
"GPL-1.0-or-later",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] |
permissive
|
jlblancoc/suitesparse-metis-for-windows
|
70e6bcab2b525afb41758d61f823efa0618f67cf
|
5ee2eb4bc7bfd6d27af2f7fb027b1545cfc0fa3f
|
refs/heads/master
| 2023-08-30T21:15:39.624300
| 2023-03-09T10:16:48
| 2023-03-09T10:16:48
| 16,236,582
| 423
| 251
|
BSD-3-Clause
| 2023-03-09T10:18:08
| 2014-01-25T18:06:21
|
C
|
UTF-8
|
C
| false
| false
| 13,331
|
c
|
t_cholmod_rowfac.c
|
/* ========================================================================== */
/* === Cholesky/t_cholmod_rowfac ============================================ */
/* ========================================================================== */
/* -----------------------------------------------------------------------------
* CHOLMOD/Cholesky Module. Copyright (C) 2005-2006, Timothy A. Davis
* -------------------------------------------------------------------------- */
/* Template routine for cholmod_rowfac. Supports any numeric xtype
* (real, complex, or zomplex).
*
* workspace: Iwork (n), Flag (n), Xwork (n if real, 2*n if complex)
*/
#include "cholmod_template.h"
#ifdef MASK
static int TEMPLATE (cholmod_rowfac_mask)
#else
static int TEMPLATE (cholmod_rowfac)
#endif
(
/* ---- input ---- */
cholmod_sparse *A, /* matrix to factorize */
cholmod_sparse *F, /* used for A*A' case only. F=A' or A(:,f)' */
double beta [2], /* factorize beta*I+A or beta*I+AA' (beta [0] only) */
size_t kstart, /* first row to factorize */
size_t kend, /* last row to factorize is kend-1 */
#ifdef MASK
/* These inputs are used for cholmod_rowfac_mask only */
Int *mask, /* size A->nrow. if mask[i] >= maskmark
then W(i) is set to zero */
Int maskmark,
Int *RLinkUp, /* size A->nrow. link list of rows to compute */
#endif
/* ---- in/out --- */
cholmod_factor *L,
/* --------------- */
cholmod_common *Common
)
{
double yx [2], lx [2], fx [2], dk [1], di [1], fl = 0 ;
#ifdef ZOMPLEX
double yz [1], lz [1], fz [1] ;
#endif
double *Ax, *Az, *Lx, *Lz, *Wx, *Wz, *Fx, *Fz ;
Int *Ap, *Anz, *Ai, *Lp, *Lnz, *Li, *Lnext, *Flag, *Stack, *Fp, *Fi, *Fnz,
*Iwork ;
Int i, p, k, t, pf, pfend, top, s, mark, pend, n, lnz, is_ll, multadds,
use_dbound, packed, stype, Fpacked, sorted, nzmax, len, parent ;
#ifndef REAL
Int dk_imaginary ;
#endif
/* ---------------------------------------------------------------------- */
/* get inputs */
/* ---------------------------------------------------------------------- */
PRINT1 (("\nin cholmod_rowfac, kstart %d kend %d stype %d\n",
kstart, kend, A->stype)) ;
DEBUG (CHOLMOD(dump_factor) (L, "Initial L", Common)) ;
n = A->nrow ;
stype = A->stype ;
if (stype > 0)
{
/* symmetric upper case: F is not needed. It may be NULL */
Fp = NULL ;
Fi = NULL ;
Fx = NULL ;
Fz = NULL ;
Fnz = NULL ;
Fpacked = TRUE ;
}
else
{
/* unsymmetric case: F is required. */
Fp = F->p ;
Fi = F->i ;
Fx = F->x ;
Fz = F->z ;
Fnz = F->nz ;
Fpacked = F->packed ;
}
Ap = A->p ; /* size A->ncol+1, column pointers of A */
Ai = A->i ; /* size nz = Ap [A->ncol], row indices of A */
Ax = A->x ; /* size nz, numeric values of A */
Az = A->z ;
Anz = A->nz ;
packed = A->packed ;
sorted = A->sorted ;
use_dbound = IS_GT_ZERO (Common->dbound) ;
/* get the current factors L (and D for LDL'); allocate space if needed */
is_ll = L->is_ll ;
if (L->xtype == CHOLMOD_PATTERN)
{
/* ------------------------------------------------------------------ */
/* L is symbolic only; allocate and initialize L (and D for LDL') */
/* ------------------------------------------------------------------ */
/* workspace: none */
CHOLMOD(change_factor) (A->xtype, is_ll, FALSE, FALSE, TRUE, L, Common);
if (Common->status < CHOLMOD_OK)
{
/* out of memory */
return (FALSE) ;
}
ASSERT (L->minor == (size_t) n) ;
}
else if (kstart == 0 && kend == (size_t) n)
{
/* ------------------------------------------------------------------ */
/* refactorization; reset L->nz and L->minor to restart factorization */
/* ------------------------------------------------------------------ */
L->minor = n ;
Lnz = L->nz ;
for (k = 0 ; k < n ; k++)
{
Lnz [k] = 1 ;
}
}
ASSERT (is_ll == L->is_ll) ;
ASSERT (L->xtype != CHOLMOD_PATTERN) ;
DEBUG (CHOLMOD(dump_factor) (L, "L ready", Common)) ;
DEBUG (CHOLMOD(dump_sparse) (A, "A ready", Common)) ;
DEBUG (if (stype == 0) CHOLMOD(dump_sparse) (F, "F ready", Common)) ;
/* inputs, can be modified on output: */
Lp = L->p ; /* size n+1 */
ASSERT (Lp != NULL) ;
/* outputs, contents defined on input for incremental case only: */
Lnz = L->nz ; /* size n */
Lnext = L->next ; /* size n+2 */
Li = L->i ; /* size L->nzmax, can change in size */
Lx = L->x ; /* size L->nzmax or 2*L->nzmax, can change in size */
Lz = L->z ; /* size L->nzmax for zomplex case, can change in size */
nzmax = L->nzmax ;
ASSERT (Lnz != NULL && Li != NULL && Lx != NULL) ;
/* ---------------------------------------------------------------------- */
/* get workspace */
/* ---------------------------------------------------------------------- */
Iwork = Common->Iwork ;
Stack = Iwork ; /* size n (i/i/l) */
Flag = Common->Flag ; /* size n, Flag [i] < mark must hold */
Wx = Common->Xwork ; /* size n if real, 2*n if complex or
* zomplex. Xwork [i] == 0 must hold. */
Wz = Wx + n ; /* size n for zomplex case only */
mark = Common->mark ;
ASSERT ((Int) Common->xworksize >= (L->xtype == CHOLMOD_REAL ? 1:2)*n) ;
/* ---------------------------------------------------------------------- */
/* compute LDL' or LL' factorization by rows */
/* ---------------------------------------------------------------------- */
#ifdef MASK
#define NEXT(k) k = RLinkUp [k]
#else
#define NEXT(k) k++
#endif
for (k = kstart ; k < ((Int) kend) ; NEXT(k))
{
PRINT1 (("\n===============K "ID" Lnz [k] "ID"\n", k, Lnz [k])) ;
/* ------------------------------------------------------------------ */
/* compute pattern of kth row of L and scatter kth input column */
/* ------------------------------------------------------------------ */
/* column k of L is currently empty */
ASSERT (Lnz [k] == 1) ;
ASSERT (CHOLMOD(dump_work) (TRUE, TRUE, 2*n, Common)) ;
top = n ; /* Stack is empty */
Flag [k] = mark ; /* do not include diagonal entry in Stack */
/* use Li [Lp [i]+1] for etree */
#define PARENT(i) (Lnz [i] > 1) ? (Li [Lp [i] + 1]) : EMPTY
if (stype > 0)
{
/* scatter kth col of triu (beta*I+AA'), get pattern L(k,:) */
p = Ap [k] ;
pend = (packed) ? (Ap [k+1]) : (p + Anz [k]) ;
/* W [i] = Ax [i] ; scatter column of A */
#define SCATTER ASSIGN(Wx,Wz,i, Ax,Az,p)
SUBTREE ;
#undef SCATTER
}
else
{
/* scatter kth col of triu (beta*I+AA'), get pattern L(k,:) */
pf = Fp [k] ;
pfend = (Fpacked) ? (Fp [k+1]) : (pf + Fnz [k]) ;
for ( ; pf < pfend ; pf++)
{
/* get nonzero entry F (t,k) */
t = Fi [pf] ;
/* fk = Fx [pf] */
ASSIGN (fx, fz, 0, Fx, Fz, pf) ;
p = Ap [t] ;
pend = (packed) ? (Ap [t+1]) : (p + Anz [t]) ;
multadds = 0 ;
/* W [i] += Ax [p] * fx ; scatter column of A*A' */
#define SCATTER MULTADD (Wx,Wz,i, Ax,Az,p, fx,fz,0) ; multadds++ ;
SUBTREE ;
#undef SCATTER
#ifdef REAL
fl += 2 * ((double) multadds) ;
#else
fl += 8 * ((double) multadds) ;
#endif
}
}
#undef PARENT
/* ------------------------------------------------------------------ */
/* if mask is present, set the corresponding entries in W to zero */
/* ------------------------------------------------------------------ */
#ifdef MASK
/* remove the dead element of Wx */
if (mask != NULL)
{
#if 0
/* older version */
for (p = n; p > top;)
{
i = Stack [--p] ;
if ( mask [i] >= 0 )
{
CLEAR (Wx,Wz,i) ; /* set W(i) to zero */
}
}
#endif
for (s = top ; s < n ; s++)
{
i = Stack [s] ;
if (mask [i] >= maskmark)
{
CLEAR (Wx,Wz,i) ; /* set W(i) to zero */
}
}
}
#endif
/* nonzero pattern of kth row of L is now in Stack [top..n-1].
* Flag [Stack [top..n-1]] is equal to mark, but no longer needed */
/* mark = CHOLMOD(clear_flag) (Common) ; */
CHOLMOD_CLEAR_FLAG (Common) ;
mark = Common->mark ;
/* ------------------------------------------------------------------ */
/* compute kth row of L and store in column form */
/* ------------------------------------------------------------------ */
/* Solve L (0:k-1, 0:k-1) * y (0:k-1) = b (0:k-1) where
* b (0:k) = A (0:k,k) or A(0:k,:) * F(:,k) is in W and Stack.
*
* For LDL' factorization:
* L (k, 0:k-1) = y (0:k-1) ./ D (0:k-1)
* D (k) = b (k) - L (k, 0:k-1) * y (0:k-1)
*
* For LL' factorization:
* L (k, 0:k-1) = y (0:k-1)
* L (k,k) = sqrt (b (k) - L (k, 0:k-1) * L (0:k-1, k))
*/
/* dk = W [k] + beta */
ADD_REAL (dk,0, Wx,k, beta,0) ;
#ifndef REAL
/* In the unsymmetric case, the imaginary part of W[k] must be real,
* since F is assumed to be the complex conjugate transpose of A. In
* the symmetric case, W[k] is the diagonal of A. If the imaginary part
* of W[k] is nonzero, then the Cholesky factorization cannot be
* computed; A is not positive definite */
dk_imaginary = (stype > 0) ? (IMAG_IS_NONZERO (Wx,Wz,k)) : FALSE ;
#endif
/* W [k] = 0.0 ; */
CLEAR (Wx,Wz,k) ;
for (s = top ; s < n ; s++)
{
/* get i for each nonzero entry L(k,i) */
i = Stack [s] ;
/* y = W [i] ; */
ASSIGN (yx,yz,0, Wx,Wz,i) ;
/* W [i] = 0.0 ; */
CLEAR (Wx,Wz,i) ;
lnz = Lnz [i] ;
p = Lp [i] ;
ASSERT (lnz > 0 && Li [p] == i) ;
pend = p + lnz ;
/* di = Lx [p] ; the diagonal entry L or D(i,i), which is real */
ASSIGN_REAL (di,0, Lx,p) ;
if (i >= (Int) L->minor || IS_ZERO (di [0]))
{
/* For the LL' factorization, L(i,i) is zero. For the LDL',
* D(i,i) is zero. Skip column i of L, and set L(k,i) = 0. */
CLEAR (lx,lz,0) ;
p = pend ;
}
else if (is_ll)
{
#ifdef REAL
fl += 2 * ((double) (pend - p - 1)) + 3 ;
#else
fl += 8 * ((double) (pend - p - 1)) + 6 ;
#endif
/* forward solve using L (i:(k-1),i) */
/* divide by L(i,i), which must be real and nonzero */
/* y /= di [0] */
DIV_REAL (yx,yz,0, yx,yz,0, di,0) ;
for (p++ ; p < pend ; p++)
{
/* W [Li [p]] -= Lx [p] * y ; */
MULTSUB (Wx,Wz,Li[p], Lx,Lz,p, yx,yz,0) ;
}
/* do not scale L; compute dot product for L(k,k) */
/* L(k,i) = conj(y) ; */
ASSIGN_CONJ (lx,lz,0, yx,yz,0) ;
/* d -= conj(y) * y ; */
LLDOT (dk,0, yx,yz,0) ;
}
else
{
#ifdef REAL
fl += 2 * ((double) (pend - p - 1)) + 3 ;
#else
fl += 8 * ((double) (pend - p - 1)) + 6 ;
#endif
/* forward solve using D (i,i) and L ((i+1):(k-1),i) */
for (p++ ; p < pend ; p++)
{
/* W [Li [p]] -= Lx [p] * y ; */
MULTSUB (Wx,Wz,Li[p], Lx,Lz,p, yx,yz,0) ;
}
/* Scale L (k,0:k-1) for LDL' factorization, compute D (k,k)*/
#ifdef REAL
/* L(k,i) = y/d */
lx [0] = yx [0] / di [0] ;
/* d -= L(k,i) * y */
dk [0] -= lx [0] * yx [0] ;
#else
/* L(k,i) = conj(y) ; */
ASSIGN_CONJ (lx,lz,0, yx,yz,0) ;
/* L(k,i) /= di ; */
DIV_REAL (lx,lz,0, lx,lz,0, di,0) ;
/* d -= conj(y) * y / di */
LDLDOT (dk,0, yx,yz,0, di,0) ;
#endif
}
/* determine if column i of L can hold the new L(k,i) entry */
if (p >= Lp [Lnext [i]])
{
/* column i needs to grow */
PRINT1 (("Factor Colrealloc "ID", old Lnz "ID"\n", i, Lnz [i]));
if (!CHOLMOD(reallocate_column) (i, lnz + 1, L, Common))
{
/* out of memory, L is now simplicial symbolic */
for (i = 0 ; i < n ; i++)
{
/* W [i] = 0 ; */
CLEAR (Wx,Wz,i) ;
}
ASSERT (CHOLMOD(dump_work) (TRUE, TRUE, n, Common)) ;
return (FALSE) ;
}
Li = L->i ; /* L->i, L->x, L->z may have moved */
Lx = L->x ;
Lz = L->z ;
p = Lp [i] + lnz ; /* contents of L->p changed */
ASSERT (p < Lp [Lnext [i]]) ;
}
/* store L (k,i) in the column form matrix of L */
Li [p] = k ;
/* Lx [p] = L(k,i) ; */
ASSIGN (Lx,Lz,p, lx,lz,0) ;
Lnz [i]++ ;
}
/* ------------------------------------------------------------------ */
/* ensure abs (d) >= dbound if dbound is given, and store it in L */
/* ------------------------------------------------------------------ */
p = Lp [k] ;
Li [p] = k ;
if (k >= (Int) L->minor)
{
/* the matrix is already not positive definite */
dk [0] = 0 ;
}
else if (use_dbound)
{
/* modify the diagonal to force LL' or LDL' to exist */
dk [0] = CHOLMOD(dbound) (is_ll ? fabs (dk [0]) : dk [0], Common) ;
}
else if ((is_ll ? (IS_LE_ZERO (dk [0])) : (IS_ZERO (dk [0])))
#ifndef REAL
|| dk_imaginary
#endif
)
{
/* the matrix has just been found to be not positive definite */
dk [0] = 0 ;
L->minor = k ;
ERROR (CHOLMOD_NOT_POSDEF, "not positive definite") ;
}
if (is_ll)
{
/* this is counted as one flop, below */
dk [0] = sqrt (dk [0]) ;
}
/* Lx [p] = D(k,k) = d ; real part only */
ASSIGN_REAL (Lx,p, dk,0) ;
CLEAR_IMAG (Lx,Lz,p) ;
}
#undef NEXT
if (is_ll) fl += MAX ((Int) kend - (Int) kstart, 0) ; /* count sqrt's */
Common->rowfacfl = fl ;
DEBUG (CHOLMOD(dump_factor) (L, "final cholmod_rowfac", Common)) ;
ASSERT (CHOLMOD(dump_work) (TRUE, TRUE, n, Common)) ;
return (TRUE) ;
}
#undef PATTERN
#undef REAL
#undef COMPLEX
#undef ZOMPLEX
|
0ac81b96353c5d7fc4c67413f9ee4ab22b027101
|
aa3befea459382dc5c01c925653d54f435b3fb0f
|
/boards/arm/cxd56xx/drivers/audio/cxd56_audio_bca_reg.c
|
3f80b10a905e77a73635d0f1fcf4682a5066c699
|
[
"MIT-open-group",
"BSD-3-Clause",
"HPND-sell-variant",
"BSD-4-Clause-UC",
"LicenseRef-scancode-warranty-disclaimer",
"MIT-0",
"LicenseRef-scancode-bsd-atmel",
"LicenseRef-scancode-gary-s-brown",
"LicenseRef-scancode-proprietary-license",
"SunPro",
"MIT",
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-other-permissive",
"HPND",
"ISC",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"GPL-1.0-or-later",
"CC-BY-2.0",
"CC-BY-4.0"
] |
permissive
|
apache/nuttx
|
14519a7bff4a87935d94fb8fb2b19edb501c7cec
|
606b6d9310fb25c7d92c6f95bf61737e3c79fa0f
|
refs/heads/master
| 2023-08-25T06:55:45.822534
| 2023-08-23T16:03:31
| 2023-08-24T21:25:47
| 228,103,273
| 407
| 241
|
Apache-2.0
| 2023-09-14T18:26:05
| 2019-12-14T23:27:55
|
C
|
UTF-8
|
C
| false
| false
| 41,434
|
c
|
cxd56_audio_bca_reg.c
|
/****************************************************************************
* boards/arm/cxd56xx/drivers/audio/cxd56_audio_bca_reg.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <arch/chip/audio.h>
#include "cxd56_audio_config.h"
#include "cxd56_audio_bca_reg.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define BCA_REG_BASE (0x0c000000 + 0x02300000)
#define TRANS_CH_NUM_MAX 8
#define TRANS_CH_NUM_24BIT 8
#define TRANS_CH_NUM_16BIT 4
#define TRANS_CH_NO_SELECT 8
enum dma_i2s_in_sel_e
{
I2S_IN_SEL_SRC1L = 0,
I2S_IN_SEL_SRC1R = 1,
I2S_IN_SEL_UNUSE
};
enum dma_i2s_out_sel_e
{
I2S_OUT_SEL_SD1L = 0,
I2S_OUT_SEL_SD1R = 1,
I2S_OUT_SEL_UNUSE
};
#define BCA_REG_MAX_BIT 32
/****************************************************************************
* Public Data
****************************************************************************/
struct audio_bca_reg_s
{
uint32_t addr;
uint32_t pos;
uint32_t len;
uint32_t init;
};
const struct audio_bca_reg_s g_bca_reg[BCA_REG_MAX_ENTRY] =
{
{0x1000, 2, 30, 0x00000000}, /* Mic_In_start_adr (0x00000000) */
{0x1004, 0, 32, 0x00000000}, /* Mic_In_sample_no (0x00000000) */
{0x1008, 0, 2, 0x00000000}, /* Mic_In_rtd_trg (0x00) */
{0x1008, 2, 1, 0x00000000}, /* Mic_In_nointr (0x00) */
{0x100c, 0, 1, 0x00000000}, /* Mic_In_bitwt (0x00) */
{0x1010, 0, 4, 0x00000000}, /* Mic_In_ch8_sel (0x00) */
{0x1010, 4, 4, 0x00000000}, /* Mic_In_ch7_sel (0x00) */
{0x1010, 8, 4, 0x00000000}, /* Mic_In_ch6_sel (0x00) */
{0x1010, 12, 4, 0x00000000}, /* Mic_In_ch5_sel (0x00) */
{0x1010, 16, 4, 0x00000000}, /* Mic_In_ch4_sel (0x00) */
{0x1010, 20, 4, 0x00000000}, /* Mic_In_ch3_sel (0x00) */
{0x1010, 24, 4, 0x00000000}, /* Mic_In_ch2_sel (0x00) */
{0x1010, 28, 4, 0x00000000}, /* Mic_In_ch1_sel (0x00) */
{0x1014, 0, 1, 0x00000000}, /* Mic_In_start (0x00) */
{0x1014, 8, 8, 0x00000000}, /* Mic_In_error_setting (0x00) */
{0x1014, 16, 4, 0x00000000}, /* Mic_In_monbuf (0x00) */
{0x1080, 2, 30, 0x00000000}, /* I2s1_In_start_adr (0x00000000) */
{0x1084, 0, 32, 0x00000000}, /* I2s1_In_sample_no (0x00000000) */
{0x1088, 0, 2, 0x00000000}, /* I2s1_In_rtd_trg (0x00) */
{0x1088, 2, 1, 0x00000000}, /* I2s1_In_nointr (0x00) */
{0x108c, 0, 1, 0x00000000}, /* I2s1_In_bitwt (0x00) */
{0x1090, 0, 2, 0x00000000}, /* I2s1_In_ch2_sel (0x00) */
{0x1090, 4, 2, 0x00000000}, /* I2s1_In_ch1_sel (0x00) */
{0x1094, 0, 1, 0x00000000}, /* I2s1_In_Mon_start (0x00) */
{0x1094, 8, 8, 0x00000000}, /* I2s1_In_Mon_error_setting (0x00) */
{0x1094, 16, 4, 0x00000000}, /* I2s1_In_Mon_monbuf (0x00) */
{0x10a0, 2, 30, 0x00000000}, /* I2s2_In_start_adr (0x00000000) */
{0x10a4, 0, 32, 0x00000000}, /* I2s2_In_sample_no (0x00000000) */
{0x10a8, 0, 2, 0x00000000}, /* I2s2_In_rtd_trg (0x00) */
{0x10a8, 2, 1, 0x00000000}, /* I2s2_In_nointr (0x00) */
{0x10ac, 0, 1, 0x00000000}, /* I2s2_In_bitwt (0x00) */
{0x10b0, 0, 2, 0x00000000}, /* I2s2_In_ch2_sel (0x00) */
{0x10b0, 4, 2, 0x00000000}, /* I2s2_In_ch1_sel (0x00) */
{0x10b4, 0, 1, 0x00000000}, /* I2s2_In_Mon_start (0x00) */
{0x10b4, 8, 8, 0x00000000}, /* I2s2_In_Mon_error_setting (0x00) */
{0x10b4, 16, 4, 0x00000000}, /* I2s2_In_Mon_monbuf (0x00) */
{0x10c0, 2, 30, 0x00000000}, /* I2s1_Out_start_adr (0x00000000) */
{0x10c4, 0, 32, 0x00000000}, /* I2s1_Out_sample_no (0x00000000) */
{0x10c8, 0, 2, 0x00000000}, /* I2s1_Out_rtd_trg (0x00) */
{0x10c8, 2, 1, 0x00000000}, /* I2s1_Out_nointr (0x00) */
{0x10cc, 0, 1, 0x00000000}, /* I2s1_Out_bitwt (0x00) */
{0x10d0, 0, 2, 0x00000000}, /* I2s1_Out_sd1_r_sel (0x00) */
{0x10d0, 4, 2, 0x00000000}, /* I2s1_Out_sd1_l_sel (0x00) */
{0x10d4, 0, 1, 0x00000000}, /* I2s1_Out_Mon_start (0x00) */
{0x10d4, 8, 8, 0x00000000}, /* I2s1_Out_Mon_error_setting (0x00) */
{0x10d4, 16, 4, 0x00000000}, /* I2s1_Out_Mon_monbuf (0x00) */
{0x10e0, 2, 30, 0x00000000}, /* I2s2_Out_start_adr (0x00000000) */
{0x10e4, 0, 32, 0x00000000}, /* I2s2_Out_sample_no (0x00000000) */
{0x10e8, 0, 2, 0x00000000}, /* I2s2_Out_rtd_trg (0x00) */
{0x10e8, 2, 1, 0x00000000}, /* I2s2_Out_nointr (0x00) */
{0x10ec, 0, 1, 0x00000000}, /* I2s2_Out_bitwt (0x00) */
{0x10f0, 0, 2, 0x00000000}, /* I2s2_Out_sd1_r_sel (0x00) */
{0x10f0, 4, 2, 0x00000000}, /* I2s2_Out_sd1_l_sel (0x00) */
{0x10f4, 0, 1, 0x00000000}, /* I2s2_Out_Mon_start (0x00) */
{0x10f4, 8, 8, 0x00000000}, /* I2s2_Out_Mon_error_setting (0x00) */
{0x10f4, 16, 4, 0x00000000}, /* I2s2_Out_Mon_monbuf (0x00) */
{0x1110, 0, 1, 0x00000000}, /* I2s_ensel (0x00) */
{0x1120, 0, 32, 0x00000000}, /* Mici_prdat_u (0x00000000) */
{0x1130, 0, 32, 0x00000000}, /* I2s1_In_prdat_u (0x00000000) */
{0x1134, 0, 32, 0x00000000}, /* I2s2_In_prdat_u (0x00000000) */
{0x1138, 0, 32, 0x00000000}, /* I2s1_Out_prdat_d (0x00000000) */
{0x113c, 0, 32, 0x00000000}, /* I2s2_Out_prdat_d (0x00000000) */
{0x1140, 0, 1, 0x00000000}, /* Mic_Int_Ctrl_done_mic (0x00) */
{0x1140, 1, 1, 0x00000000}, /* Mic_Int_Ctrl_err_mic (0x00) */
{0x1140, 2, 1, 0x00000000}, /* Mic_Int_Ctrl_smp_mic (0x00) */
{0x1140, 3, 1, 0x00000000}, /* Mic_Int_Ctrl_cmb_mic (0x00) */
{0x1144, 0, 1, 0x00000000}, /* I2s1_Int_Ctrl_done_i2so (0x00) */
{0x1144, 1, 1, 0x00000000}, /* I2s1_Int_Ctrl_err_i2so (0x00) */
{0x1144, 2, 1, 0x00000000}, /* I2s1_Int_Ctrl_done_i2si (0x00) */
{0x1144, 3, 1, 0x00000000}, /* I2s1_Int_Ctrl_err_i2si (0x00) */
{0x1144, 4, 1, 0x00000000}, /* I2s1_Int_Ctrl_smp_i2s (0x00) */
{0x1144, 5, 1, 0x00000000}, /* I2s1_Int_Ctrl_cmb_i2s (0x00) */
{0x1148, 0, 1, 0x00000000}, /* I2s2_Int_Ctrl_done_i2so (0x00) */
{0x1148, 1, 1, 0x00000000}, /* I2s2_Int_Ctrl_err_i2so (0x00) */
{0x1148, 2, 1, 0x00000000}, /* I2s2_Int_Ctrl_done_i2si (0x00) */
{0x1148, 3, 1, 0x00000000}, /* I2s2_Int_Ctrl_err_i2si (0x00) */
{0x1148, 4, 1, 0x00000000}, /* I2s2_Int_Ctrl_smp_i2s (0x00) */
{0x1148, 5, 1, 0x00000000}, /* I2s2_Int_Ctrl_cmb_i2s (0x00) */
{0x114c, 0, 1, 0x00000001}, /* Mic_Int_Mask_done_mic (0x00) */
{0x114c, 1, 1, 0x00000001}, /* Mic_Int_Mask_err_mic (0x00) */
{0x114c, 2, 1, 0x00000001}, /* Mic_Int_Mask_smp_mic (0x00) */
{0x114c, 3, 1, 0x00000001}, /* Mic_Int_Mask_cmb_mic (0x00) */
{0x114c, 30, 1, 0x00000000}, /* Mic_Int_Mask_nostpmsk (0x00) */
{0x114c, 31, 1, 0x00000000}, /* Mic_Int_Mask_srst_mic (0x00) */
{0x1150, 0, 1, 0x00000001}, /* I2s1_Int_Mask_done_i2so (0x00) */
{0x1150, 1, 1, 0x00000001}, /* I2s1_Int_Mask_err_i2so (0x00) */
{0x1150, 2, 1, 0x00000001}, /* I2s1_Int_Mask_done_i2si (0x00) */
{0x1150, 3, 1, 0x00000001}, /* I2s1_Int_Mask_err_i2si (0x00) */
{0x1150, 4, 1, 0x00000001}, /* I2s1_Int_Mask_smp_i2s (0x00) */
{0x1150, 5, 1, 0x00000001}, /* I2s1_Int_Mask_cmb_i2s (0x00) */
{0x1150, 30, 1, 0x00000000}, /* I2s1_Int_Mask_nostpmsk_i2s (0x00) */
{0x1150, 31, 1, 0x00000000}, /* I2s1_Int_Mask_srst_i2s (0x00) */
{0x1154, 0, 1, 0x00000001}, /* I2s2_Int_Mask_done_i2so (0x00) */
{0x1154, 1, 1, 0x00000001}, /* I2s2_Int_Mask_err_i2so (0x00) */
{0x1154, 2, 1, 0x00000001}, /* I2s2_Int_Mask_done_i2si (0x00) */
{0x1154, 3, 1, 0x00000001}, /* I2s2_Int_Mask_err_i2si (0x00) */
{0x1154, 4, 1, 0x00000001}, /* I2s2_Int_Mask_smp_i2s (0x00) */
{0x1154, 5, 1, 0x00000001}, /* I2s2_Int_Mask_cmb_i2s (0x00) */
{0x1154, 30, 1, 0x00000000}, /* I2s2_Int_Mask_nostpmsk_i2s (0x00) */
{0x1154, 31, 1, 0x00000000}, /* I2s2_Int_Mask_srst_i2s (0x00) */
{0x1158, 0, 1, 0x00000001}, /* Int_m_hresp_err (0x01) */
{0x1158, 8, 1, 0x00000001}, /* Int_m_I2s1_bck_err1 (0x01) */
{0x1158, 9, 1, 0x00000001}, /* Int_m_I2s1_bck_err2 (0x01) */
{0x1158, 10, 1, 0x00000001}, /* Int_m_anc_faint (0x01) */
{0x1158, 17, 1, 0x00000001}, /* Int_m_ovf_smasl (0x01) */
{0x1158, 18, 1, 0x00000001}, /* Int_m_ovf_smasr (0x01) */
{0x1158, 21, 1, 0x00000001}, /* Int_m_ovf_dnc1l (0x01) */
{0x1158, 22, 1, 0x00000001}, /* Int_m_ovf_dnc1r (0x01) */
{0x1158, 23, 1, 0x00000001}, /* Int_m_ovf_dnc2l (0x01) */
{0x1158, 24, 1, 0x00000001}, /* Int_m_ovf_dnc2r (0x01) */
{0x115c, 0, 1, 0x00000000}, /* Int_clr_hresp_err (0x00) */
{0x115c, 8, 1, 0x00000000}, /* Int_clr_I2s1_bck_err1 (0x00) */
{0x115c, 9, 1, 0x00000000}, /* Int_clr_I2s1_bck_err2 (0x00) */
{0x115c, 10, 1, 0x00000000}, /* Int_clr_anc_faint (0x00) */
{0x115c, 17, 1, 0x00000000}, /* Int_clr_ovf_smasl (0x00) */
{0x115c, 18, 1, 0x00000000}, /* Int_clr_ovf_smasr (0x00) */
{0x115c, 21, 1, 0x00000000}, /* Int_clr_ovf_dnc1l (0x00) */
{0x115c, 22, 1, 0x00000000}, /* Int_clr_ovf_dnc1r (0x00) */
{0x115c, 23, 1, 0x00000000}, /* Int_clr_ovf_dnc2l (0x00) */
{0x115c, 24, 1, 0x00000000}, /* Int_clr_ovf_dnc2r (0x00) */
{0x1160, 0, 1, 0x00000000}, /* Int_hresp_err (0x00) */
{0x1160, 8, 1, 0x00000000}, /* Int_i2s_bck_err1 (0x00) */
{0x1160, 9, 1, 0x00000000}, /* Int_i2s_bck_err2 (0x00) */
{0x1160, 10, 1, 0x00000000}, /* Int_anc_faint (0x00) */
{0x1160, 17, 1, 0x00000000}, /* Int_ovf_smasl (0x00) */
{0x1160, 18, 1, 0x00000000}, /* Int_ovf_smasr (0x00) */
{0x1160, 21, 1, 0x00000000}, /* Int_ovf_dnc1l (0x00) */
{0x1160, 22, 1, 0x00000000}, /* Int_ovf_dnc1r (0x00) */
{0x1160, 23, 1, 0x00000000}, /* Int_ovf_dnc2l (0x00) */
{0x1160, 24, 1, 0x00000000}, /* Int_ovf_dnc2r (0x00) */
{0x1180, 8, 24, 0x00000000}, /* Dbg_Mic_ch1_data (0x00) */
{0x1184, 8, 24, 0x00000000}, /* Dbg_Mic_ch2_data (0x00) */
{0x1188, 8, 24, 0x00000000}, /* Dbg_Mic_ch3_data (0x00) */
{0x118c, 8, 24, 0x00000000}, /* Dbg_Mic_ch4_data (0x00) */
{0x1190, 8, 24, 0x00000000}, /* Dbg_Mic_ch5_data (0x00) */
{0x1194, 8, 24, 0x00000000}, /* Dbg_Mic_ch6_data (0x00) */
{0x1198, 8, 24, 0x00000000}, /* Dbg_Mic_ch7_data (0x00) */
{0x119c, 8, 24, 0x00000000}, /* Dbg_Mic_ch8_data (0x00) */
{0x11a0, 8, 24, 0x00000000}, /* Dbg_I2s1_u_ch1_data (0x00) */
{0x11a4, 8, 24, 0x00000000}, /* Dbg_I2s1_u_ch2_data (0x00) */
{0x11a8, 8, 24, 0x00000000}, /* Dbg_I2s1_d_ch1_data (0x00) */
{0x11ac, 8, 24, 0x00000000}, /* Dbg_I2s1_d_ch2_data (0x00) */
{0x11b0, 8, 24, 0x00000000}, /* Dbg_I2s2_u_ch1_data (0x00) */
{0x11b4, 8, 24, 0x00000000}, /* Dbg_I2s2_u_ch2_data (0x00) */
{0x11b8, 8, 24, 0x00000000}, /* Dbg_I2s2_d_ch1_data (0x00) */
{0x11bc, 8, 24, 0x00000000}, /* Dbg_I2s2_d_ch2_data (0x00) */
{0x11c0, 0, 1, 0x00000000}, /* Dbg_Ctrl_mic_dbg_en (0x00) */
{0x11c0, 1, 1, 0x00000000}, /* Dbg_Ctrl_I2s1_dbg_u_en (0x00) */
{0x11c0, 2, 1, 0x00000000}, /* Dbg_Ctrl_I2s1_dbg_d_en (0x00) */
{0x11c0, 3, 1, 0x00000000}, /* Dbg_Ctrl_I2s2_dbg_u_en (0x00) */
{0x11c0, 4, 1, 0x00000000}, /* Dbg_Ctrl_I2s2_dbg_d_en (0x00) */
{0x11f0, 0, 1, 0x00000000}, /* Clk_En_ahbmstr_mic_en (0x00) */
{0x11f0, 1, 1, 0x00000000}, /* Clk_En_ahbmstr_I2s1_en (0x00) */
{0x11f0, 2, 1, 0x00000000}, /* Clk_En_ahbmstr_I2s2_en (0x00) */
{0x11fc, 0, 8, 0x00000064}, /* Mclk_Mon_thresh (0x64) */
{0x1730, 0, 32, 0x00000000}, /* AHB MASTER MIC MASK (0x00) */
{0x1f30, 0, 32, 0x00000000}, /* AHB MASTER I2S1 MASK (0x00) */
{0x2730, 0, 32, 0x00000000}, /* AHB MASTER I2S2 MASK (0x00) */
};
/****************************************************************************
* Private Functions
****************************************************************************/
uint32_t write_bca_reg(BCA_REG_ID reg_id, uint32_t data)
{
volatile uint32_t *addr;
uint32_t curr;
uint32_t mask = (g_bca_reg[reg_id].len == BCA_REG_MAX_BIT) ?
0xffffffff : (1 << g_bca_reg[reg_id].len) - 1;
addr = (volatile uint32_t *)(BCA_REG_BASE + g_bca_reg[reg_id].addr);
curr = *addr & ~(mask << g_bca_reg[reg_id].pos);
*addr = curr | ((data & mask) << g_bca_reg[reg_id].pos);
return 0;
}
uint32_t write_bca_reg_mask(BCA_REG_ID reg_id)
{
volatile uint32_t *addr;
uint32_t mask = (g_bca_reg[reg_id].len == BCA_REG_MAX_BIT) ?
0xffffffff : (1 << g_bca_reg[reg_id].len) - 1;
addr = (volatile uint32_t *)(BCA_REG_BASE + g_bca_reg[reg_id].addr);
*addr = mask << g_bca_reg[reg_id].pos;
return 0;
}
uint32_t read_bca_reg(BCA_REG_ID reg_id)
{
volatile uint32_t *addr;
uint32_t data = 0;
uint32_t mask = (g_bca_reg[reg_id].len == BCA_REG_MAX_BIT) ?
0xffffffff : (1 << g_bca_reg[reg_id].len) - 1;
addr = (volatile uint32_t *)(BCA_REG_BASE + g_bca_reg[reg_id].addr);
data = (*addr >> g_bca_reg[reg_id].pos) & mask;
return data;
}
uint32_t write32_bca_reg(uint32_t offset, uint32_t data)
{
volatile uint32_t *addr;
addr = (volatile uint32_t *)(BCA_REG_BASE + offset);
*addr = data;
return 0;
}
uint32_t read32_bca_reg(uint32_t offset)
{
volatile uint32_t *addr;
uint32_t data = 0;
addr = (volatile uint32_t *)(BCA_REG_BASE + offset);
data = *addr;
return data;
}
void enable_mic_in_fmt24(uint8_t mic_num)
{
uint8_t i;
BCA_REG_ID mic_ch_sell[TRANS_CH_NUM_MAX] =
{
BCA_MIC_IN_CH1_SEL,
BCA_MIC_IN_CH2_SEL,
BCA_MIC_IN_CH3_SEL,
BCA_MIC_IN_CH4_SEL,
BCA_MIC_IN_CH5_SEL,
BCA_MIC_IN_CH6_SEL,
BCA_MIC_IN_CH7_SEL,
BCA_MIC_IN_CH8_SEL
};
mic_num = (mic_num > TRANS_CH_NUM_24BIT) ? TRANS_CH_NUM_24BIT : mic_num;
write_bca_reg(BCA_MIC_IN_BITWT, 0);
for (i = 0; i < mic_num; i++)
{
write_bca_reg(mic_ch_sell[i], i);
}
for (i = mic_num; i < TRANS_CH_NUM_24BIT; i++)
{
write_bca_reg(mic_ch_sell[i], TRANS_CH_NO_SELECT);
}
write_bca_reg(BCA_CLK_EN_AHBMASTER_MIC_EN, 1);
write_bca_reg(BCA_MIC_IN_START_ADR, 0x00000000);
write_bca_reg(BCA_MIC_IN_SAMPLE_NO, 0);
}
void enable_mic_in_fmt16(uint8_t mic_num)
{
uint8_t i;
BCA_REG_ID mic_ch_sell[TRANS_CH_NUM_MAX] =
{
BCA_MIC_IN_CH1_SEL,
BCA_MIC_IN_CH2_SEL,
BCA_MIC_IN_CH3_SEL,
BCA_MIC_IN_CH4_SEL,
BCA_MIC_IN_CH5_SEL,
BCA_MIC_IN_CH6_SEL,
BCA_MIC_IN_CH7_SEL,
BCA_MIC_IN_CH8_SEL
};
mic_num = (mic_num > (TRANS_CH_NUM_16BIT * 2)) ?
TRANS_CH_NUM_16BIT : (mic_num + 1) / 2;
write_bca_reg(BCA_MIC_IN_BITWT, 1);
for (i = 0; i < mic_num; i++)
{
write_bca_reg(mic_ch_sell[i], i);
}
for (i = mic_num; i < TRANS_CH_NUM_MAX; i++)
{
write_bca_reg(mic_ch_sell[i], TRANS_CH_NO_SELECT);
}
write_bca_reg(BCA_CLK_EN_AHBMASTER_MIC_EN, 1);
write_bca_reg(BCA_MIC_IN_START_ADR, 0x00000000);
write_bca_reg(BCA_MIC_IN_SAMPLE_NO, 0);
}
void enable_i2s1_in_fmt24(void)
{
write_bca_reg(BCA_I2S1_IN_BITWT, 0);
write_bca_reg(BCA_I2S1_IN_CH2_SEL, I2S_IN_SEL_SRC1R);
write_bca_reg(BCA_I2S1_IN_CH1_SEL, I2S_IN_SEL_SRC1L);
write_bca_reg(BCA_CLK_EN_AHBMASTER_I2S1_EN, 1);
write_bca_reg(BCA_I2S1_IN_START_ADR, 0x00000000);
write_bca_reg(BCA_I2S1_IN_SAMPLE_NO, 0);
}
void enable_i2s1_in_fmt16(void)
{
write_bca_reg(BCA_I2S1_IN_BITWT, 1);
write_bca_reg(BCA_I2S1_IN_CH2_SEL, I2S_IN_SEL_UNUSE);
write_bca_reg(BCA_I2S1_IN_CH1_SEL, I2S_IN_SEL_SRC1L);
write_bca_reg(BCA_CLK_EN_AHBMASTER_I2S1_EN, 1);
write_bca_reg(BCA_I2S1_IN_START_ADR, 0x00000000);
write_bca_reg(BCA_I2S1_IN_SAMPLE_NO, 0);
}
void enable_i2s2_in_fmt24(void)
{
write_bca_reg(BCA_I2S2_IN_BITWT, 0);
write_bca_reg(BCA_I2S2_IN_CH2_SEL, I2S_IN_SEL_SRC1R);
write_bca_reg(BCA_I2S2_IN_CH1_SEL, I2S_IN_SEL_SRC1L);
write_bca_reg(BCA_CLK_EN_AHBMASTER_I2S2_EN, 1);
write_bca_reg(BCA_I2S2_IN_START_ADR, 0x00000000);
write_bca_reg(BCA_I2S2_IN_SAMPLE_NO, 0);
}
void enable_i2s2_in_fmt16(void)
{
write_bca_reg(BCA_I2S2_IN_BITWT, 0);
write_bca_reg(BCA_I2S2_IN_CH2_SEL, I2S_IN_SEL_UNUSE);
write_bca_reg(BCA_I2S2_IN_CH1_SEL, I2S_IN_SEL_SRC1L);
write_bca_reg(BCA_CLK_EN_AHBMASTER_I2S2_EN, 1);
write_bca_reg(BCA_I2S2_IN_START_ADR, 0x00000000);
write_bca_reg(BCA_I2S2_IN_SAMPLE_NO, 0);
}
void enable_i2s1_out_fmt24(void)
{
write_bca_reg(BCA_I2S1_OUT_SD1_L_SEL, I2S_OUT_SEL_SD1L);
write_bca_reg(BCA_I2S1_OUT_SD1_R_SEL, I2S_OUT_SEL_SD1R);
write_bca_reg(BCA_I2S1_OUT_BITWT, 0);
write_bca_reg(BCA_CLK_EN_AHBMASTER_I2S1_EN, 1);
write_bca_reg(BCA_I2S1_OUT_START_ADR, 0x00000000);
write_bca_reg(BCA_I2S2_OUT_SAMPLE_NO, 0);
}
void enable_i2s1_out_fmt16(void)
{
write_bca_reg(BCA_I2S1_OUT_SD1_L_SEL, I2S_OUT_SEL_SD1L);
write_bca_reg(BCA_I2S1_OUT_SD1_R_SEL, I2S_OUT_SEL_SD1R);
write_bca_reg(BCA_I2S1_OUT_BITWT, 1);
write_bca_reg(BCA_CLK_EN_AHBMASTER_I2S1_EN, 1);
write_bca_reg(BCA_I2S1_OUT_START_ADR, 0x00000000);
write_bca_reg(BCA_I2S2_OUT_SAMPLE_NO, 0);
}
void enable_i2s2_out_fmt24(void)
{
write_bca_reg(BCA_I2S2_OUT_SD1_L_SEL, I2S_OUT_SEL_SD1L);
write_bca_reg(BCA_I2S2_OUT_SD1_R_SEL, I2S_OUT_SEL_SD1R);
write_bca_reg(BCA_I2S2_OUT_BITWT, 0);
write_bca_reg(BCA_CLK_EN_AHBMASTER_I2S2_EN, 1);
write_bca_reg(BCA_I2S2_OUT_START_ADR, 0x00000000);
write_bca_reg(BCA_I2S2_OUT_SAMPLE_NO, 0);
}
void enable_i2s2_out_fmt16(void)
{
write_bca_reg(BCA_I2S2_OUT_SD1_L_SEL, I2S_OUT_SEL_SD1L);
write_bca_reg(BCA_I2S2_OUT_SD1_R_SEL, I2S_OUT_SEL_SD1R);
write_bca_reg(BCA_I2S2_OUT_BITWT, 1);
write_bca_reg(BCA_CLK_EN_AHBMASTER_I2S2_EN, 1);
write_bca_reg(BCA_I2S2_OUT_START_ADR, 0x00000000);
write_bca_reg(BCA_I2S2_OUT_SAMPLE_NO, 0);
}
/****************************************************************************
* Public Functions
****************************************************************************/
void cxd56_audio_bca_reg_clear_bck_err_int(void)
{
write_bca_reg(BCA_INT_M_I2S1_BCL_ERR1, 0);
write_bca_reg(BCA_INT_M_I2S1_BCL_ERR2, 0);
}
void cxd56_audio_bca_reg_set_smaster(void)
{
write_bca_reg(BCA_INT_M_OVF_SMASL, 0);
write_bca_reg(BCA_INT_M_OVF_SMASR, 0);
}
void cxd56_audio_bca_reg_set_datarate(uint8_t clk_mode)
{
if (clk_mode == CXD56_AUDIO_CLKMODE_HIRES)
{
/* Set 4fs. */
write_bca_reg(BCA_I2S_ENSEL, 1);
}
else
{
/* Set 1fs. */
write_bca_reg(BCA_I2S_ENSEL, 0);
}
}
void cxd56_audio_bca_reg_en_fmt24(cxd56_audio_dma_t handle, uint8_t ch_num)
{
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
enable_mic_in_fmt24(ch_num);
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
enable_i2s1_in_fmt24();
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
enable_i2s1_out_fmt24();
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
enable_i2s2_in_fmt24();
break;
default:
enable_i2s2_out_fmt24();
break;
}
}
void cxd56_audio_bca_reg_en_fmt16(cxd56_audio_dma_t handle, uint8_t ch_num)
{
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
enable_mic_in_fmt16(ch_num);
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
enable_i2s1_in_fmt16();
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
enable_i2s1_out_fmt16();
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
enable_i2s2_in_fmt16();
break;
default:
enable_i2s2_out_fmt16();
break;
}
}
void cxd56_audio_bca_reg_get_dma_mstate(cxd56_audio_dma_t handle,
cxd56_audio_dma_mstate_t *state)
{
BCA_REG_ID reg_id_start;
BCA_REG_ID reg_id_error;
BCA_REG_ID reg_id_monbuf;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id_start = BCA_MIC_IN_START;
reg_id_error = BCA_MIC_IN_ERROR_SETTING;
reg_id_monbuf = BCA_MIC_IN_MONBUF;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id_start = BCA_I2S1_IN_MON_START;
reg_id_error = BCA_I2S1_IN_MON_ERROR_SETTING;
reg_id_monbuf = BCA_I2S1_IN_MON_MONBUF;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id_start = BCA_I2S1_OUT_MON_START;
reg_id_error = BCA_I2S1_OUT_MON_ERROR_SETTING;
reg_id_monbuf = BCA_I2S1_OUT_MON_MONBUF;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id_start = BCA_I2S2_IN_MON_START;
reg_id_error = BCA_I2S2_IN_MON_ERROR_SETTING;
reg_id_monbuf = BCA_I2S2_IN_MON_MONBUF;
break;
default:
reg_id_start = BCA_I2S2_OUT_MON_START;
reg_id_error = BCA_I2S2_OUT_MON_ERROR_SETTING;
reg_id_monbuf = BCA_I2S2_OUT_MON_MONBUF;
break;
}
state->start = (uint8_t)read_bca_reg(reg_id_start);
state->err_setting = (uint8_t)read_bca_reg(reg_id_error);
state->buf_state = (uint8_t)read_bca_reg(reg_id_monbuf);
}
void cxd56_audio_bca_reg_en_bus_err_int(void)
{
write_bca_reg(BCA_INT_M_HRESP_ERR, 0);
}
void cxd56_audio_bca_reg_dis_bus_err_int(void)
{
write_bca_reg(BCA_INT_M_HRESP_ERR, 1);
}
uint32_t cxd56_audio_bca_reg_get_dma_done_state_mic(void)
{
uint32_t int_ac =
read32_bca_reg(g_bca_reg[BCA_MIC_INT_CTRL_DONE_MIC].addr)
& ~(read32_bca_reg(g_bca_reg[BCA_MIC_INT_MASK_DONE_MIC].addr))
& 0x0f;
return int_ac;
}
uint32_t cxd56_audio_bca_reg_get_dma_done_state_i2s1(void)
{
uint32_t int_i2s =
read32_bca_reg(g_bca_reg[BCA_I2S1_INT_CTRL_DONE_I2SO].addr)
& ~(read32_bca_reg(g_bca_reg[BCA_I2S1_INT_MASK_DONE_I2SO].addr))
& 0x3f;
return int_i2s;
}
uint32_t cxd56_audio_bca_reg_get_dma_done_state_i2s2(void)
{
uint32_t int_i2s2 =
read32_bca_reg(g_bca_reg[BCA_I2S2_INT_CTRL_DONE_I2SO].addr)
& ~(read32_bca_reg(g_bca_reg[BCA_I2S2_INT_MASK_DONE_I2SO].addr))
& 0x3f;
return int_i2s2;
}
void cxd56_audio_bca_reg_clear_dma_done_state_mic(uint32_t value)
{
write32_bca_reg(g_bca_reg[BCA_MIC_INT_CTRL_DONE_MIC].addr, value);
}
void cxd56_audio_bca_reg_clear_dma_done_state_i2s1(uint32_t value)
{
write32_bca_reg(g_bca_reg[BCA_I2S1_INT_CTRL_DONE_I2SO].addr, value);
}
void cxd56_audio_bca_reg_clear_dma_done_state_i2s2(uint32_t value)
{
write32_bca_reg(g_bca_reg[BCA_I2S2_INT_CTRL_DONE_I2SO].addr, value);
}
void cxd56_audio_bca_reg_mask_done_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_INT_MASK_DONE_MIC;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_INT_MASK_DONE_I2SI;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_INT_MASK_DONE_I2SO;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_INT_MASK_DONE_I2SI;
break;
default:
reg_id = BCA_I2S2_INT_MASK_DONE_I2SO;
break;
}
write_bca_reg(reg_id, 1);
}
void cxd56_audio_bca_reg_unmask_done_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_INT_MASK_DONE_MIC;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_INT_MASK_DONE_I2SI;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_INT_MASK_DONE_I2SO;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_INT_MASK_DONE_I2SI;
break;
default:
reg_id = BCA_I2S2_INT_MASK_DONE_I2SO;
break;
}
write_bca_reg(reg_id, 0);
}
void cxd56_audio_bca_reg_clear_done_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_INT_CTRL_DONE_MIC;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_INT_CTRL_DONE_I2SI;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_INT_CTRL_DONE_I2SO;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_INT_CTRL_DONE_I2SI;
break;
default:
reg_id = BCA_I2S2_INT_CTRL_DONE_I2SO;
break;
}
write_bca_reg_mask(reg_id);
}
bool cxd56_audio_bca_reg_is_dma_fifo_empty(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_IN_RTD_TRG;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_IN_RTD_TRG;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_OUT_RTD_TRG;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_IN_RTD_TRG;
break;
default:
reg_id = BCA_I2S2_OUT_RTD_TRG;
break;
}
if (1 == read_bca_reg(reg_id))
{
return true;
}
return false;
}
void cxd56_audio_bca_reg_mask_err_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_INT_MASK_ERR_MIC;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_INT_MASK_ERR_I2SI;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_INT_MASK_ERR_I2SO;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_INT_MASK_ERR_I2SI;
break;
default:
reg_id = BCA_I2S2_INT_MASK_ERR_I2SO;
break;
}
write_bca_reg(reg_id, 1);
}
void cxd56_audio_bca_reg_unmask_err_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_INT_MASK_ERR_MIC;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_INT_MASK_ERR_I2SI;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_INT_MASK_ERR_I2SO;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_INT_MASK_ERR_I2SI;
break;
default:
reg_id = BCA_I2S2_INT_MASK_ERR_I2SO;
break;
}
write_bca_reg(reg_id, 0);
}
void cxd56_audio_bca_reg_clear_err_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_INT_CTRL_ERR_MIC;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_INT_CTRL_ERR_I2SI;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_INT_CTRL_ERR_I2SO;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_INT_CTRL_ERR_I2SI;
break;
default:
reg_id = BCA_I2S2_INT_MASK_ERR_I2SO;
break;
}
write_bca_reg_mask(reg_id);
}
void cxd56_audio_bca_reg_mask_cmb_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_INT_MASK_CMB_MIC;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_INT_MASK_CMB_I2S;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_INT_MASK_CMB_I2S;
break;
default:
reg_id = BCA_I2S2_INT_MASK_CMB_I2S;
break;
}
write_bca_reg(reg_id, 1);
}
void cxd56_audio_bca_reg_unmask_cmb_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_INT_MASK_CMB_MIC;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_INT_MASK_CMB_I2S;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_INT_MASK_CMB_I2S;
break;
default:
reg_id = BCA_I2S2_INT_MASK_CMB_I2S;
break;
}
write_bca_reg(reg_id, 0);
}
void cxd56_audio_bca_reg_clear_cmb_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_INT_CTRL_CMB_MIC;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_INT_CTRL_CMB_I2S;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_INT_CTRL_CMB_I2S;
break;
default:
reg_id = BCA_I2S2_INT_CTRL_CMB_I2S;
break;
}
write_bca_reg_mask(reg_id);
}
uint32_t cxd56_audio_bca_reg_get_int_status(void)
{
return read32_bca_reg(g_bca_reg[BCA_INT_HRESP_ERR].addr);
}
void cxd56_audio_bca_reg_clear_int_status(uint32_t int_au)
{
write32_bca_reg(g_bca_reg[BCA_INT_CLR_HRESP_ERR].addr, int_au);
}
void cxd56_audio_bca_reg_mask_bus_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = AHB_MASTER_MIC_MASK;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = AHB_MASTER_I2S1_MASK;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = AHB_MASTER_I2S2_MASK;
break;
default:
reg_id = AHB_MASTER_I2S2_MASK;
break;
}
write_bca_reg(reg_id, 0);
}
void cxd56_audio_bca_reg_unmask_bus_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
uint32_t val = 0;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = AHB_MASTER_MIC_MASK;
val = 0x00000303;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = AHB_MASTER_I2S1_MASK;
val = 0x00000101;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = AHB_MASTER_I2S1_MASK;
val = 0x00000202;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = AHB_MASTER_I2S2_MASK;
val = 0x00000101;
break;
default:
reg_id = AHB_MASTER_I2S2_MASK;
val = 0x00000202;
break;
}
write_bca_reg(reg_id, val);
}
void cxd56_audio_bca_reg_set_start_addr(cxd56_audio_dma_t handle,
uint32_t addr)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_IN_START_ADR;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_IN_START_ADR;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_OUT_START_ADR;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_IN_START_ADR;
break;
default:
reg_id = BCA_I2S2_OUT_START_ADR;
break;
}
write_bca_reg(reg_id, addr >> 2);
}
void cxd56_audio_bca_reg_set_sample_no(cxd56_audio_dma_t handle,
uint32_t sample)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_IN_SAMPLE_NO;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_IN_SAMPLE_NO;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_OUT_SAMPLE_NO;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_IN_SAMPLE_NO;
break;
default:
reg_id = BCA_I2S2_OUT_SAMPLE_NO;
break;
}
write_bca_reg(reg_id, sample - 1);
}
void cxd56_audio_bca_reg_start_dma(cxd56_audio_dma_t handle,
bool nointr)
{
BCA_REG_ID reg_id;
uint32_t val = nointr ? 0x05 : 0x01;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_IN_RTD_TRG;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_IN_RTD_TRG;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_OUT_RTD_TRG;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_IN_RTD_TRG;
break;
default:
reg_id = BCA_I2S2_OUT_RTD_TRG;
break;
}
write_bca_reg(reg_id, val);
}
void cxd56_audio_bca_reg_stop_dma(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_IN_RTD_TRG;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_IN_RTD_TRG;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_OUT_RTD_TRG;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_IN_RTD_TRG;
break;
default:
reg_id = BCA_I2S2_OUT_RTD_TRG;
break;
}
write_bca_reg(reg_id, 0x04);
}
bool cxd56_audio_bca_reg_is_done_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_INT_CTRL_DONE_MIC;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_INT_CTRL_DONE_I2SI;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_INT_CTRL_DONE_I2SO;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_INT_CTRL_DONE_I2SI;
break;
default:
reg_id = BCA_I2S2_INT_CTRL_DONE_I2SO;
break;
}
if (read_bca_reg(reg_id) == 0)
{
return false;
}
return true;
}
bool cxd56_audio_bca_reg_is_err_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_INT_CTRL_ERR_MIC;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_INT_CTRL_ERR_I2SI;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_INT_CTRL_ERR_I2SO;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_INT_CTRL_ERR_I2SI;
break;
default:
reg_id = BCA_I2S2_INT_CTRL_ERR_I2SO;
break;
}
if (read_bca_reg(reg_id) == 0)
{
return false;
}
return true;
}
bool cxd56_audio_bca_reg_is_smp_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_INT_CTRL_SMP_MIC;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_INT_CTRL_SMP_I2S;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_INT_CTRL_SMP_I2S;
break;
default:
reg_id = BCA_I2S2_INT_CTRL_SMP_I2S;
break;
}
if (read_bca_reg(reg_id) == 0)
{
return false;
}
return true;
}
void cxd56_audio_bca_reg_mask_smp_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_INT_MASK_SMP_MIC;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_INT_MASK_SMP_I2S;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_INT_MASK_SMP_I2S;
break;
default:
reg_id = BCA_I2S2_INT_MASK_SMP_I2S;
break;
}
write_bca_reg(reg_id, 1);
}
void cxd56_audio_bca_reg_unmask_smp_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_INT_MASK_SMP_MIC;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_INT_MASK_SMP_I2S;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_INT_MASK_SMP_I2S;
break;
default:
reg_id = BCA_I2S2_INT_MASK_SMP_I2S;
break;
}
write_bca_reg(reg_id, 0);
}
void cxd56_audio_bca_reg_clear_smp_int(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_INT_CTRL_SMP_MIC;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_INT_CTRL_SMP_I2S;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_INT_CTRL_SMP_I2S;
break;
default:
reg_id = BCA_I2S2_INT_CTRL_SMP_I2S;
break;
}
write_bca_reg_mask(reg_id);
}
uint32_t cxd56_audio_bca_reg_get_mon_state_err(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_IN_ERROR_SETTING;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_IN_MON_ERROR_SETTING;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_OUT_MON_ERROR_SETTING;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_IN_MON_ERROR_SETTING;
break;
default:
reg_id = BCA_I2S2_OUT_MON_ERROR_SETTING;
break;
}
return read_bca_reg(reg_id);
}
uint32_t cxd56_audio_bca_reg_get_mon_state_start(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_IN_START;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_IN_MON_START;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_OUT_MON_START;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_IN_MON_START;
break;
default:
reg_id = BCA_I2S2_OUT_MON_START;
break;
}
return read_bca_reg(reg_id);
}
uint32_t cxd56_audio_bca_reg_get_mon_state_buf(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_IN_MONBUF;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_IN_MON_MONBUF;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_OUT_MON_MONBUF;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_IN_MON_MONBUF;
break;
default:
reg_id = BCA_I2S2_OUT_MON_MONBUF;
break;
}
return read_bca_reg(reg_id);
}
uint32_t cxd56_audio_bca_reg_get_dma_state(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_IN_RTD_TRG;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_IN_RTD_TRG;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_OUT_RTD_TRG;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_IN_RTD_TRG;
break;
default:
reg_id = BCA_I2S2_OUT_RTD_TRG;
break;
}
return read_bca_reg(reg_id);
}
void cxd56_audio_bca_reg_reset_chsel(cxd56_audio_dma_t handle)
{
BCA_REG_ID reg_id;
uint32_t chsel;
switch (handle)
{
case CXD56_AUDIO_DMAC_MIC:
reg_id = BCA_MIC_IN_CH8_SEL;
break;
case CXD56_AUDIO_DMAC_I2S0_UP:
reg_id = BCA_I2S1_IN_CH2_SEL;
break;
case CXD56_AUDIO_DMAC_I2S0_DOWN:
reg_id = BCA_I2S1_OUT_SD1_R_SEL;
break;
case CXD56_AUDIO_DMAC_I2S1_UP:
reg_id = BCA_I2S2_IN_CH2_SEL;
break;
default:
reg_id = BCA_I2S2_OUT_SD1_R_SEL;
break;
}
chsel = read32_bca_reg(g_bca_reg[reg_id].addr);
/* Clear ChSel. */
write32_bca_reg(g_bca_reg[reg_id].addr, 0xffffffff);
/* Set ChSel. */
write32_bca_reg(g_bca_reg[reg_id].addr, chsel);
}
|
ad15eceb060e649c05e2f7afdb8c1c3a733bb3e6
|
cf60f9591fef521d3092f81785de7942d0ca568e
|
/PubNub/include/PNFetchUUIDMetadataResult.h
|
aadcac7d81c2104e999af549c5b13ed1282fdd3b
|
[
"MIT"
] |
permissive
|
pubnub/objective-c
|
a49e2e5c7898eb893b601ae31a098361fb8b4406
|
eef06ae76fd45931ea09900e3b3ce50133870eca
|
refs/heads/master
| 2023-04-07T08:28:47.174178
| 2023-01-05T11:15:57
| 2023-01-05T11:15:57
| 8,490,984
| 137
| 145
|
NOASSERTION
| 2023-03-30T08:47:36
| 2013-03-01T00:10:41
|
Objective-C
|
UTF-8
|
C
| false
| false
| 51
|
h
|
PNFetchUUIDMetadataResult.h
|
../Data/Service Objects/PNFetchUUIDMetadataResult.h
|
75448bbdd247cfd70f1335eed1a7c0504469e9e1
|
5ed4f58304033044e3a259f2a678328de4696692
|
/src/kbd.h
|
4c6da1c653f37f4771664c7c97044b07a3dad9f0
|
[
"Unlicense",
"LicenseRef-scancode-public-domain"
] |
permissive
|
troglobit/mg
|
a971a04a1610f93d57636f1253760684ea7b29a9
|
46dca121b1d67758ee06809d8eb72d0b9d6def65
|
refs/heads/master
| 2023-08-21T22:52:12.135823
| 2023-08-13T15:31:28
| 2023-08-13T15:31:28
| 58,325,928
| 333
| 39
|
Unlicense
| 2023-08-09T23:59:32
| 2016-05-08T18:41:56
|
C
|
UTF-8
|
C
| false
| false
| 1,618
|
h
|
kbd.h
|
/* $OpenBSD: kbd.h,v 1.18 2006/07/27 19:59:29 deraadt Exp $ */
/* This file is in the public domain. */
/*
* kbd.h: type definitions for symbol.c and kbd.c for mg experimental
*/
struct map_element {
KCHAR k_base; /* first key in element */
KCHAR k_num; /* last key in element */
PF *k_funcp; /* pointer to array of pointers */
/* to functions */
struct keymap_s *k_prefmap; /* keymap of ONLY prefix key in */
/* element */
};
/*
* Predefined keymaps are NOT type KEYMAP because final array needs
* dimension. If any changes are made to this struct, they must be reflected
* in all keymap declarations.
*/
#define KEYMAPE(NUM) { \
short map_num; /* elements used */ \
short map_max; /* elements allocated */\
PF map_default; /* default function */ \
struct map_element map_element[NUM]; /* really [e_max] */ \
}
typedef struct keymap_s KEYMAPE(1) KEYMAP;
/* Number of map_elements to grow an overflowed keymap by */
#define MAPGROW 3
#define MAPINIT (MAPGROW+1)
/* Max number of default bindings added to avoid creating new element */
#define MAPELEDEF 4
struct maps_s {
KEYMAP *p_map;
const char *p_name;
struct maps_s *p_next;
};
extern struct maps_s *maps;
extern struct maps_s fundamental_mode;
#define fundamental_map (fundamental_mode.p_map)
int dobindkey(KEYMAP *, const char *, const char *);
KEYMAP *name_map(const char *);
struct maps_s *name_mode(const char *);
PF doscan(KEYMAP *, int, KEYMAP **);
void maps_init(void);
int maps_add(KEYMAP *, const char *);
extern struct map_element *ele;
extern struct maps_s *defb_modes[];
|
bd0629c8190ef27406a49d1eb47e277127de1d79
|
88ae8695987ada722184307301e221e1ba3cc2fa
|
/third_party/dav1d/libdav1d/src/msac.h
|
eb04f58f8117118df56e359b496a1484ddf87336
|
[
"BSD-3-Clause",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"LGPL-2.0-or-later",
"MIT",
"GPL-1.0-or-later"
] |
permissive
|
iridium-browser/iridium-browser
|
71d9c5ff76e014e6900b825f67389ab0ccd01329
|
5ee297f53dc7f8e70183031cff62f37b0f19d25f
|
refs/heads/master
| 2023-08-03T16:44:16.844552
| 2023-07-20T15:17:00
| 2023-07-23T16:09:30
| 220,016,632
| 341
| 40
|
BSD-3-Clause
| 2021-08-13T13:54:45
| 2019-11-06T14:32:31
| null |
UTF-8
|
C
| false
| false
| 4,004
|
h
|
msac.h
|
/*
* Copyright © 2018, VideoLAN and dav1d authors
* Copyright © 2018, Two Orioles, LLC
* 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 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 DAV1D_SRC_MSAC_H
#define DAV1D_SRC_MSAC_H
#include <stdint.h>
#include <stdlib.h>
#include "common/intops.h"
typedef size_t ec_win;
typedef struct MsacContext {
const uint8_t *buf_pos;
const uint8_t *buf_end;
ec_win dif;
unsigned rng;
int cnt;
int allow_update_cdf;
#if ARCH_X86_64 && HAVE_ASM
unsigned (*symbol_adapt16)(struct MsacContext *s, uint16_t *cdf, size_t n_symbols);
#endif
} MsacContext;
#if HAVE_ASM
#if ARCH_AARCH64 || ARCH_ARM
#include "src/arm/msac.h"
#elif ARCH_X86
#include "src/x86/msac.h"
#endif
#endif
void dav1d_msac_init(MsacContext *s, const uint8_t *data, size_t sz,
int disable_cdf_update_flag);
unsigned dav1d_msac_decode_symbol_adapt_c(MsacContext *s, uint16_t *cdf,
size_t n_symbols);
unsigned dav1d_msac_decode_bool_adapt_c(MsacContext *s, uint16_t *cdf);
unsigned dav1d_msac_decode_bool_equi_c(MsacContext *s);
unsigned dav1d_msac_decode_bool_c(MsacContext *s, unsigned f);
unsigned dav1d_msac_decode_hi_tok_c(MsacContext *s, uint16_t *cdf);
int dav1d_msac_decode_subexp(MsacContext *s, int ref, int n, unsigned k);
/* Supported n_symbols ranges: adapt4: 1-4, adapt8: 1-7, adapt16: 3-15 */
#ifndef dav1d_msac_decode_symbol_adapt4
#define dav1d_msac_decode_symbol_adapt4 dav1d_msac_decode_symbol_adapt_c
#endif
#ifndef dav1d_msac_decode_symbol_adapt8
#define dav1d_msac_decode_symbol_adapt8 dav1d_msac_decode_symbol_adapt_c
#endif
#ifndef dav1d_msac_decode_symbol_adapt16
#define dav1d_msac_decode_symbol_adapt16 dav1d_msac_decode_symbol_adapt_c
#endif
#ifndef dav1d_msac_decode_bool_adapt
#define dav1d_msac_decode_bool_adapt dav1d_msac_decode_bool_adapt_c
#endif
#ifndef dav1d_msac_decode_bool_equi
#define dav1d_msac_decode_bool_equi dav1d_msac_decode_bool_equi_c
#endif
#ifndef dav1d_msac_decode_bool
#define dav1d_msac_decode_bool dav1d_msac_decode_bool_c
#endif
#ifndef dav1d_msac_decode_hi_tok
#define dav1d_msac_decode_hi_tok dav1d_msac_decode_hi_tok_c
#endif
static inline unsigned dav1d_msac_decode_bools(MsacContext *const s, unsigned n) {
unsigned v = 0;
while (n--)
v = (v << 1) | dav1d_msac_decode_bool_equi(s);
return v;
}
static inline int dav1d_msac_decode_uniform(MsacContext *const s, const unsigned n) {
assert(n > 0);
const int l = ulog2(n) + 1;
assert(l > 1);
const unsigned m = (1 << l) - n;
const unsigned v = dav1d_msac_decode_bools(s, l - 1);
return v < m ? v : (v << 1) - m + dav1d_msac_decode_bool_equi(s);
}
#endif /* DAV1D_SRC_MSAC_H */
|
14b6b7923fb371d0146f36b38b65997041d54441
|
bed3ac926beac0f4e0293303d7b2a6031ee476c9
|
/Modules/ThirdParty/HDF5/src/itkhdf5/src/H5Clog_json.c
|
18323ca74e9842478e26b435c418d5cbe7d28bdb
|
[
"IJG",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"SMLNJ",
"BSD-3-Clause",
"BSD-4.3TAHOE",
"LicenseRef-scancode-free-unknown",
"Spencer-86",
"LicenseRef-scancode-llnl",
"FSFUL",
"Libpng",
"libtiff",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-hdf5",
"MIT",
"NTP",
"LicenseRef-scancode-mit-old-style",
"GPL-1.0-or-later",
"LicenseRef-scancode-unknown-license-reference",
"MPL-2.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] |
permissive
|
InsightSoftwareConsortium/ITK
|
ed9dbbc5b8b3f7511f007c0fc0eebb3ad37b88eb
|
3eb8fd7cdfbc5ac2d0c2e5e776848a4cbab3d7e1
|
refs/heads/master
| 2023-08-31T17:21:47.754304
| 2023-08-31T00:58:51
| 2023-08-31T14:12:21
| 800,928
| 1,229
| 656
|
Apache-2.0
| 2023-09-14T17:54:00
| 2010-07-27T15:48:04
|
C++
|
UTF-8
|
C
| false
| false
| 43,646
|
c
|
H5Clog_json.c
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Copyright by The HDF Group. *
* Copyright by the Board of Trustees of the University of Illinois. *
* All rights reserved. *
* *
* This file is part of HDF5. The full HDF5 copyright notice, including *
* terms governing use, modification, and redistribution, is contained in *
* the COPYING file, which can be found at the root of the source code *
* distribution tree, or in https://www.hdfgroup.org/licenses. *
* If you do not have access to either file, you may request a copy from *
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*-------------------------------------------------------------------------
*
* Created: H5Clog_json.c
*
* Purpose: Cache log implementation that emits JSON-formatted log
* entries for consumption by new-fangled data analysis tools.
*
*-------------------------------------------------------------------------
*/
/****************/
/* Module Setup */
/****************/
#include "H5Cmodule.h" /* This source code file is part of the H5C module */
/***********/
/* Headers */
/***********/
#include "H5private.h" /* Generic Functions */
#include "H5Cpkg.h" /* Cache */
#include "H5Clog.h" /* Cache logging */
#include "H5Eprivate.h" /* Error handling */
#include "H5MMprivate.h" /* Memory management */
/****************/
/* Local Macros */
/****************/
/* Max log message size */
#define H5C_MAX_JSON_LOG_MSG_SIZE 1024
/******************/
/* Local Typedefs */
/******************/
/********************/
/* Package Typedefs */
/********************/
typedef struct H5C_log_json_udata_t {
FILE *outfile;
char *message;
} H5C_log_json_udata_t;
/********************/
/* Local Prototypes */
/********************/
/* Internal message handling calls */
static herr_t H5C__json_write_log_message(H5C_log_json_udata_t *json_udata);
/* Log message callbacks */
static herr_t H5C__json_tear_down_logging(H5C_log_info_t *log_info);
static herr_t H5C__json_write_start_log_msg(void *udata);
static herr_t H5C__json_write_stop_log_msg(void *udata);
static herr_t H5C__json_write_create_cache_log_msg(void *udata, herr_t fxn_ret_value);
static herr_t H5C__json_write_destroy_cache_log_msg(void *udata);
static herr_t H5C__json_write_evict_cache_log_msg(void *udata, herr_t fxn_ret_value);
static herr_t H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id,
herr_t fxn_ret_value);
static herr_t H5C__json_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value);
static herr_t H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags,
size_t size, herr_t fxn_ret_value);
static herr_t H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry,
herr_t fxn_ret_value);
static herr_t H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry,
herr_t fxn_ret_value);
static herr_t H5C__json_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
herr_t fxn_ret_value);
static herr_t H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
herr_t fxn_ret_value);
static herr_t H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id,
herr_t fxn_ret_value);
static herr_t H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
herr_t fxn_ret_value);
static herr_t H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
const H5C_cache_entry_t *child, herr_t fxn_ret_value);
static herr_t H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id,
unsigned flags, herr_t fxn_ret_value);
static herr_t H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
size_t new_size, herr_t fxn_ret_value);
static herr_t H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
herr_t fxn_ret_value);
static herr_t H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
const H5C_cache_entry_t *child, herr_t fxn_ret_value);
static herr_t H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id,
unsigned flags, herr_t fxn_ret_value);
static herr_t H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t *config,
herr_t fxn_ret_value);
static herr_t H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
herr_t fxn_ret_value);
/*********************/
/* Package Variables */
/*********************/
/*****************************/
/* Library Private Variables */
/*****************************/
/*******************/
/* Local Variables */
/*******************/
/* Note that there's no cache set up call since that's the
* place where this struct is wired into the cache.
*/
static const H5C_log_class_t H5C_json_log_class_g = {"json",
H5C__json_tear_down_logging,
NULL, /* start logging */
NULL, /* stop logging */
H5C__json_write_start_log_msg,
H5C__json_write_stop_log_msg,
H5C__json_write_create_cache_log_msg,
H5C__json_write_destroy_cache_log_msg,
H5C__json_write_evict_cache_log_msg,
H5C__json_write_expunge_entry_log_msg,
H5C__json_write_flush_cache_log_msg,
H5C__json_write_insert_entry_log_msg,
H5C__json_write_mark_entry_dirty_log_msg,
H5C__json_write_mark_entry_clean_log_msg,
H5C__json_write_mark_unserialized_entry_log_msg,
H5C__json_write_mark_serialized_entry_log_msg,
H5C__json_write_move_entry_log_msg,
H5C__json_write_pin_entry_log_msg,
H5C__json_write_create_fd_log_msg,
H5C__json_write_protect_entry_log_msg,
H5C__json_write_resize_entry_log_msg,
H5C__json_write_unpin_entry_log_msg,
H5C__json_write_destroy_fd_log_msg,
H5C__json_write_unprotect_entry_log_msg,
H5C__json_write_set_cache_config_log_msg,
H5C__json_write_remove_entry_log_msg};
/*-------------------------------------------------------------------------
* Function: H5C__json_write_log_message
*
* Purpose: Write a message to the log file and flush the file.
* The message string is neither modified nor freed.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_log_message(H5C_log_json_udata_t *json_udata)
{
size_t n_chars;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->outfile);
HDassert(json_udata->message);
/* Write the log message and flush */
n_chars = HDstrlen(json_udata->message);
if ((int)n_chars != HDfprintf(json_udata->outfile, "%s", json_udata->message))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "error writing log message")
HDmemset((void *)(json_udata->message), 0, (size_t)(n_chars * sizeof(char)));
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_log_message() */
/*-------------------------------------------------------------------------
* Function: H5C_log_json_set_up
*
* Purpose: Setup for metadata cache logging.
*
* Metadata logging is enabled and disabled at two levels. This
* function and the associated tear_down function open and close
* the log file. the start_ and stop_logging functions are then
* used to switch logging on/off. Optionally, logging can begin
* as soon as the log file is opened (set via the start_immediately
* parameter to this function).
*
* The log functionality is split between the H5C and H5AC
* packages. Log state and direct log manipulation resides in
* H5C. Log messages are generated in H5AC and sent to
* the H5C__json_write_log_message function.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
herr_t
H5C_log_json_set_up(H5C_log_info_t *log_info, const char log_location[], int mpi_rank)
{
H5C_log_json_udata_t *json_udata = NULL;
char * file_name = NULL;
size_t n_chars;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
HDassert(log_info);
HDassert(log_location);
/* Set up the class struct */
log_info->cls = &H5C_json_log_class_g;
/* Allocate memory for the JSON-specific data */
if (NULL == (log_info->udata = H5MM_calloc(sizeof(H5C_log_json_udata_t))))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
json_udata = (H5C_log_json_udata_t *)(log_info->udata);
/* Allocate memory for the message buffer */
if (NULL == (json_udata->message = (char *)H5MM_calloc(H5C_MAX_JSON_LOG_MSG_SIZE * sizeof(char))))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL, "memory allocation failed")
/* Possibly fix up the log file name.
* The extra 39 characters are for adding the rank to the file name
* under parallel HDF5. 39 characters allows > 2^127 processes which
* should be enough for anybody.
*
* allocation size = "RANK_" + <rank # length> + dot + <path length> + \0
*/
n_chars = 5 + 39 + 1 + HDstrlen(log_location) + 1;
if (NULL == (file_name = (char *)H5MM_calloc(n_chars * sizeof(char))))
HGOTO_ERROR(H5E_CACHE, H5E_CANTALLOC, FAIL,
"can't allocate memory for mdc log file name manipulation")
/* Add the rank to the log file name when MPI is in use */
if (-1 == mpi_rank)
HDsnprintf(file_name, n_chars, "%s", log_location);
else
HDsnprintf(file_name, n_chars, "RANK_%d.%s", mpi_rank, log_location);
/* Open log file and set it to be unbuffered */
if (NULL == (json_udata->outfile = HDfopen(file_name, "w")))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "can't create mdc log file")
HDsetbuf(json_udata->outfile, NULL);
done:
if (file_name)
H5MM_xfree(file_name);
/* Free and reset the log info struct on errors */
if (FAIL == ret_value) {
/* Free */
if (json_udata && json_udata->message)
H5MM_xfree(json_udata->message);
if (json_udata)
H5MM_xfree(json_udata);
/* Reset */
log_info->udata = NULL;
log_info->cls = NULL;
}
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C_log_json_set_up() */
/*-------------------------------------------------------------------------
* Function: H5C__json_tear_down_logging
*
* Purpose: Tear-down for metadata cache logging.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_tear_down_logging(H5C_log_info_t *log_info)
{
H5C_log_json_udata_t *json_udata = NULL;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(log_info);
/* Alias */
json_udata = (H5C_log_json_udata_t *)(log_info->udata);
/* Free the message buffer */
H5MM_xfree(json_udata->message);
/* Close log file */
if (EOF == HDfclose(json_udata->outfile))
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "problem closing mdc log file")
json_udata->outfile = NULL;
/* Fre the udata */
H5MM_xfree(json_udata);
/* Reset the log class info and udata */
log_info->cls = NULL;
log_info->udata = NULL;
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_tear_down_logging() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_start_log_msg
*
* Purpose: Write a log message when logging starts.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_start_log_msg(void *udata)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
/* Create the log message string (opens the JSON array) */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\n\
\"HDF5 metadata cache log messages\" : [\n\
{\
\"timestamp\":%lld,\
\"action\":\"logging start\"\
},\n\
",
(long long)HDtime(NULL));
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_start_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_stop_log_msg
*
* Purpose: Write a log message when logging ends.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_stop_log_msg(void *udata)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
/* Create the log message string (closes the JSON array) */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"logging stop\"\
}\n\
]}\n\
",
(long long)HDtime(NULL));
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_stop_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_create_cache_log_msg
*
* Purpose: Write a log message for cache creation.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_create_cache_log_msg(void *udata, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"create\",\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_create_cache_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_destroy_cache_log_msg
*
* Purpose: Write a log message for cache destruction.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_destroy_cache_log_msg(void *udata)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"destroy\"\
},\n\
",
(long long)HDtime(NULL));
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_destroy_cache_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_evict_cache_log_msg
*
* Purpose: Write a log message for eviction of cache entries.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_evict_cache_log_msg(void *udata, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"evict\",\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_evict_cache_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_expunge_entry_log_msg
*
* Purpose: Write a log message for expunge of cache entries.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_expunge_entry_log_msg(void *udata, haddr_t address, int type_id, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"expunge\",\
\"address\":0x%lx,\
\"type_id\":%d,\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (unsigned long)address, (int)type_id, (int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_expunge_entry_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_flush_cache_log_msg
*
* Purpose: Write a log message for cache flushes.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_flush_cache_log_msg(void *udata, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"flush\",\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_flush_cache_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_insert_entry_log_msg
*
* Purpose: Write a log message for insertion of cache entries.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_insert_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags, size_t size,
herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"insert\",\
\"address\":0x%lx,\
\"type_id\":%d,\
\"flags\":0x%x,\
\"size\":%d,\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (unsigned long)address, type_id, flags, (int)size,
(int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_insert_entry_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_mark_entry_dirty_log_msg
*
* Purpose: Write a log message for marking cache entries as dirty.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_mark_entry_dirty_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
HDassert(entry);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"dirty\",\
\"address\":0x%lx,\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_mark_entry_dirty_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_mark_entry_clean_log_msg
*
* Purpose: Write a log message for marking cache entries as clean.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_mark_entry_clean_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
HDassert(entry);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"clean\",\
\"address\":0x%lx,\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_mark_entry_clean_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_mark_unserialized_entry_log_msg
*
* Purpose: Write a log message for marking cache entries as unserialized.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_mark_unserialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
HDassert(entry);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"unserialized\",\
\"address\":0x%lx,\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_mark_unserialized_entry_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_mark_serialize_entry_log_msg
*
* Purpose: Write a log message for marking cache entries as serialize.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_mark_serialized_entry_log_msg(void *udata, const H5C_cache_entry_t *entry,
herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
HDassert(entry);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"serialized\",\
\"address\":0x%lx,\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_mark_serialized_entry_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_move_entry_log_msg
*
* Purpose: Write a log message for moving a cache entry.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_move_entry_log_msg(void *udata, haddr_t old_addr, haddr_t new_addr, int type_id,
herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"move\",\
\"old_address\":0x%lx,\
\"new_address\":0x%lx,\
\"type_id\":%d,\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (unsigned long)old_addr, (unsigned long)new_addr, type_id,
(int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_move_entry_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_pin_entry_log_msg
*
* Purpose: Write a log message for pinning a cache entry.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_pin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
HDassert(entry);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"pin\",\
\"address\":0x%lx,\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_pin_entry_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_create_fd_log_msg
*
* Purpose: Write a log message for creating a flush dependency between
* two cache entries.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_create_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
const H5C_cache_entry_t *child, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
HDassert(parent);
HDassert(child);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"create_fd\",\
\"parent_addr\":0x%lx,\
\"child_addr\":0x%lx,\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (unsigned long)parent->addr, (unsigned long)child->addr,
(int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_create_fd_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_protect_entry_log_msg
*
* Purpose: Write a log message for protecting a cache entry.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_protect_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, int type_id,
unsigned flags, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
char rw_s[16];
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
HDassert(entry);
if (H5C__READ_ONLY_FLAG == flags)
HDstrcpy(rw_s, "READ");
else
HDstrcpy(rw_s, "WRITE");
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"protect\",\
\"address\":0x%lx,\
\"type_id\":%d,\
\"readwrite\":\"%s\",\
\"size\":%d,\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (unsigned long)entry->addr, type_id, rw_s, (int)entry->size,
(int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_protect_entry_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_resize_entry_log_msg
*
* Purpose: Write a log message for resizing a cache entry.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_resize_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, size_t new_size,
herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
HDassert(entry);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"resize\",\
\"address\":0x%lx,\
\"new_size\":%d,\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)new_size, (int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_resize_entry_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_unpin_entry_log_msg
*
* Purpose: Write a log message for unpinning a cache entry.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_unpin_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
HDassert(entry);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"unpin\",\
\"address\":0x%lx,\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_unpin_entry_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_destroy_fd_log_msg
*
* Purpose: Write a log message for destroying a flush dependency
* between two cache entries.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_destroy_fd_log_msg(void *udata, const H5C_cache_entry_t *parent,
const H5C_cache_entry_t *child, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
HDassert(parent);
HDassert(child);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"destroy_fd\",\
\"parent_addr\":0x%lx,\
\"child_addr\":0x%lx,\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (unsigned long)parent->addr, (unsigned long)child->addr,
(int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_destroy_fd_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_unprotect_entry_log_msg
*
* Purpose: Write a log message for unprotecting a cache entry.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_unprotect_entry_log_msg(void *udata, haddr_t address, int type_id, unsigned flags,
herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"unprotect\",\
\"address\":0x%lx,\
\"id\":%d,\
\"flags\":%x,\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (unsigned long)address, type_id, flags, (int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_unprotect_entry_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_set_cache_config_log_msg
*
* Purpose: Write a log message for setting the cache configuration.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_set_cache_config_log_msg(void *udata, const H5AC_cache_config_t H5_ATTR_NDEBUG_UNUSED *config,
herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
HDassert(config);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"set_config\",\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_set_cache_config_log_msg() */
/*-------------------------------------------------------------------------
* Function: H5C__json_write_remove_entry_log_msg
*
* Purpose: Write a log message for removing a cache entry.
*
* Return: SUCCEED/FAIL
*
* Programmer: Dana Robinson
* Fall 2018
*
*-------------------------------------------------------------------------
*/
static herr_t
H5C__json_write_remove_entry_log_msg(void *udata, const H5C_cache_entry_t *entry, herr_t fxn_ret_value)
{
H5C_log_json_udata_t *json_udata = (H5C_log_json_udata_t *)(udata);
herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
/* Sanity checks */
HDassert(json_udata);
HDassert(json_udata->message);
HDassert(entry);
/* Create the log message string */
HDsnprintf(json_udata->message, H5C_MAX_JSON_LOG_MSG_SIZE, "\
{\
\"timestamp\":%lld,\
\"action\":\"remove\",\
\"address\":0x%lx,\
\"returned\":%d\
},\n\
",
(long long)HDtime(NULL), (unsigned long)entry->addr, (int)fxn_ret_value);
/* Write the log message to the file */
if (H5C__json_write_log_message(json_udata) < 0)
HGOTO_ERROR(H5E_CACHE, H5E_LOGGING, FAIL, "unable to emit log message")
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5C__json_write_remove_entry_log_msg() */
|
b8f1808960010a71608d31676f7ad47797a23bf1
|
468cd559cb5374e737bb1b5f42f5fe73dd98dd8b
|
/source/backend/rmt_thread_event.h
|
2df5f77f9597282338739524237022046606494a
|
[
"MIT"
] |
permissive
|
GPUOpen-Tools/radeon_memory_visualizer
|
31b84ceeb44573e654876df7af9cbf0063015898
|
87d9ca84492432f384e1cc8e93e59c3700ef0e3f
|
refs/heads/master
| 2023-09-01T00:41:37.480829
| 2023-07-12T15:02:57
| 2023-08-16T18:44:26
| 245,466,905
| 117
| 17
| null | null | null | null |
UTF-8
|
C
| false
| false
| 3,809
|
h
|
rmt_thread_event.h
|
//=============================================================================
// Copyright (c) 2019-2023 Advanced Micro Devices, Inc. All rights reserved.
/// @author AMD Developer Tools Team
/// @file
/// @brief Definition of platform-specific thread events.
//=============================================================================
#ifndef RMV_BACKEND_RMT_THREAD_EVENT_H_
#define RMV_BACKEND_RMT_THREAD_EVENT_H_
#include "rmt_error.h"
/// Define the size of a thread event handle structure (in DWORDS).
#define RMT_THREAD_EVENT_SIZE (4)
#ifdef __cplusplus
extern "C" {
#endif // #ifdef __cplusplus
/// A handle for a thread event.
typedef struct RmtThreadEvent
{
uint32_t data[RMT_THREAD_EVENT_SIZE];
} RmtThreadEvent;
/// Create a new thread event.
///
/// @param [in] thread_event A pointer to a <c><i>RmtThreadEvent</i></c> structure.
/// @param [in] initial_value Boolean value indicating what the set the thread event to.
/// @param [in] manual_reset Boolean value indicating if the thread event should require manually reset.
/// @param [in] name The name of the thread event.
///
/// @retval
/// kRmtOk The operation completed successfully.
/// @retval
/// kRmtErrorInvalidPointer The parameter <c><i>threadEvent</i></c> was NULL.
/// @retval
/// kRmtErrorPlatformFunctionFailed A platform-specific function failed.
///
RmtErrorCode RmtThreadEventCreate(RmtThreadEvent* thread_event, bool initial_value, bool manual_reset, const char* name);
/// Signal a thread event.
///
/// @param [in] thread_event A pointer to a <c><i>RmtThreadEvent</i></c> structure.
///
/// @retval
/// kRmtOk The operation completed successfully.
/// @retval
/// kRmtErrorInvalidPointer The parameter <c><i>threadEvent</i></c> was NULL.
/// @retval
/// kRmtErrorPlatformFunctionFailed A platform-specific function failed.
///
RmtErrorCode RmtThreadEventSignal(RmtThreadEvent* thread_event);
/// Wait for a thread event to be signalled.
///
/// @param [in] thread_event A pointer to a <c><i>RmtThreadEvent</i></c> structure.
///
/// @retval
/// kRmtOk The operation completed successfully.
/// @retval
/// kRmtErrorInvalidPointer The parameter <c><i>threadEvent</i></c> was NULL.
/// @retval
/// kRmtErrorPlatformFunctionFailed A platform-specific function failed.
///
RmtErrorCode RmtThreadEventWait(RmtThreadEvent* thread_event);
/// Wait for a thread event to be reset.
///
/// @param [in] thread_event A pointer to a <c><i>RmtThreadEvent</i></c> structure.
///
/// @retval
/// kRmtOk The operation completed successfully.
/// @retval
/// kRmtErrorInvalidPointer The parameter <c><i>threadEvent</i></c> was NULL.
/// @retval
/// kRmtErrorPlatformFunctionFailed A platform-specific function failed.
///
RmtErrorCode RmtThreadEventReset(RmtThreadEvent* thread_event);
/// Destroy a thread event.
///
/// @param [in] thread_event A pointer to a <c><i>RmtThreadEvent</i></c> structure.
///
/// @retval
/// kRmtOk The operation completed successfully.
/// @retval
/// kRmtErrorInvalidPointer The parameter <c><i>threadEvent</i></c> was NULL.
/// @retval
/// kRmtErrorPlatformFunctionFailed A platform-specific function failed.
///
RmtErrorCode RmtThreadEventDestroy(RmtThreadEvent* thread_event);
#ifdef __cplusplus
}
#endif // #ifdef __cplusplus
#endif // #ifndef RMV_BACKEND_RMT_THREAD_EVENT_H_
|
019fc9a6232792d48d544a157eaa0c3b71b6e64a
|
376e1818d427b5e4d32fa6dd6c7b71e9fd88afdb
|
/lang/LuaJIT2/patches/patch-src_lj__arch.h
|
55835241d1e62e4e8e5a4366bf366a225fbc8338
|
[] |
no_license
|
NetBSD/pkgsrc
|
a0732c023519650ef821ab89c23ab6ab59e25bdb
|
d042034ec4896cc5b47ed6f2e5b8802d9bc5c556
|
refs/heads/trunk
| 2023-09-01T07:40:12.138283
| 2023-09-01T05:25:19
| 2023-09-01T05:25:19
| 88,439,572
| 321
| 138
| null | 2023-07-12T22:34:14
| 2017-04-16T20:04:15
| null |
UTF-8
|
C
| false
| false
| 984
|
h
|
patch-src_lj__arch.h
|
$NetBSD: patch-src_lj__arch.h,v 1.1 2018/06/02 20:01:21 he Exp $
Fix the test for endianness so that NetBSD/powerpc isn't
mis-categorized as little-endian only because _LITTLE_ENDIAN
is defined -- what matters on NetBSD is the value of _BYTE_ORDER.
--- src/lj_arch.h.orig 2017-05-01 18:11:00.000000000 +0000
+++ src/lj_arch.h
@@ -339,12 +339,21 @@
#if defined(_SOFT_FLOAT) || defined(_SOFT_DOUBLE)
#error "No support for PowerPC CPUs without double-precision FPU"
#endif
-#if defined(_LITTLE_ENDIAN)
-#error "No support for little-endian PowerPC"
+
+#if defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN)
+# if (_BYTE_ORDER == _LITTLE_ENDIAN)
+# error "No support for little-endian PowerPC"
+# endif
+#else
+# if defined(_LITTLE_ENDIAN)
+# error "No support for little-endian PowerPC"
+# endif
#endif
+
#if defined(_LP64)
#error "No support for PowerPC 64 bit mode"
#endif
+
#elif LJ_TARGET_MIPS
#if defined(__mips_soft_float)
#error "No support for MIPS CPUs without FPU"
|
563372be6a253f9a654d5bdad3d7080bd0c46b67
|
c8b39acfd4a857dc15ed3375e0d93e75fa3f1f64
|
/Engine/Source/Programs/SlateViewer/Public/SlateViewerApp.h
|
2da06c771a0cb522230ee9fae591b035fc9e3ab6
|
[
"MIT",
"LicenseRef-scancode-proprietary-license"
] |
permissive
|
windystrife/UnrealEngine_NVIDIAGameWorks
|
c3c7863083653caf1bc67d3ef104fb4b9f302e2a
|
b50e6338a7c5b26374d66306ebc7807541ff815e
|
refs/heads/4.18-GameWorks
| 2023-03-11T02:50:08.471040
| 2022-01-13T20:50:29
| 2022-01-13T20:50:29
| 124,100,479
| 262
| 179
|
MIT
| 2022-12-16T05:36:38
| 2018-03-06T15:44:09
|
C++
|
UTF-8
|
C
| false
| false
| 402
|
h
|
SlateViewerApp.h
|
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "ISlateReflectorModule.h"
#include "SlateViewer.h"
#include "Widgets/Docking/SDockTab.h"
/**
* Run the SlateViewer .
*/
int RunSlateViewer(const TCHAR* Commandline);
/**
* Spawn the contents of the web browser tab
*/
TSharedRef<SDockTab> SpawnWebBrowserTab(const FSpawnTabArgs& Args);
|
4cd6a759738a58be65c651b89f2acb79bca5aba5
|
fad354de10252cf074d5727232682440bdced572
|
/project/include/hx/CFFIExt.h
|
43c0b7d04b20fa792007c39057f778a3c214b3e4
|
[
"LicenseRef-scancode-free-unknown",
"MIT",
"BSD-3-Clause",
"Apache-2.0",
"MPL-1.1",
"LGPL-2.0-only",
"LicenseRef-scancode-public-domain",
"GPL-3.0-only"
] |
permissive
|
openfl/lime
|
12bf58892e11df1b40e9cd8d75939b33bba29a27
|
d4a04c80df33bbbd7e2fc54c5f6dc9d32b2ad83e
|
refs/heads/develop
| 2023-09-01T17:21:02.054726
| 2023-08-19T16:39:16
| 2023-08-19T16:39:16
| 10,876,724
| 410
| 380
|
MIT
| 2023-08-19T16:39:18
| 2013-06-23T02:49:06
|
JavaScript
|
UTF-8
|
C
| false
| false
| 1,981
|
h
|
CFFIExt.h
|
#ifndef HX_CFFIEXT_INCLUDED
#define HX_CFFIEXT_INCLUDED
#include <hx/CFFI.h>
#if defined(STATIC_LINK) && defined(IMPLEMENT_CFFI_EXT)
void *LoadFunc(const char *inName) { return 0; }
#else
extern void *LoadFunc(const char *inName);
#endif
#ifdef IMPLEMENT_CFFI_EXT
#define DEFFUNC_EXT(name,ret,def_args,call_args) \
typedef ret (*FUNC_##name)def_args; \
FUNC_##name IMPL_##name = NULL; \
extern FUNC_##name EXT_##name; \
bool LOADED_##name = false; \
bool HAS_##name () \
{ \
if (!LOADED_##name) \
{ \
IMPL_##name = (FUNC_##name)LoadFunc(#name); \
LOADED_##name = true; \
} \
return IMPL_##name != NULL; \
} \
ret REAL_##name def_args \
{ \
if (!HAS_##name()) \
{ \
fprintf(stderr,"Could not find external function:" #name " \n"); \
abort(); \
} \
EXT_##name = IMPL_##name; \
return IMPL_##name call_args; \
} \
FUNC_##name EXT_##name = REAL_##name;
#else
#define DEFFUNC_EXT(name,ret,def_args,call_args) \
typedef ret (*FUNC_##name)def_args; \
extern bool HAS_##name (); \
extern FUNC_##name EXT_##name;
#endif
#define DEFFUNC_EXT_0(ret,name) DEFFUNC_EXT(name,ret, (), ())
#define DEFFUNC_EXT_1(ret,name,t1) DEFFUNC_EXT(name,ret, (t1 a1), (a1))
#define DEFFUNC_EXT_2(ret,name,t1,t2) DEFFUNC_EXT(name,ret, (t1 a1, t2 a2), (a1,a2))
#define DEFFUNC_EXT_3(ret,name,t1,t2,t3) DEFFUNC_EXT(name,ret, (t1 a1, t2 a2, t3 a3), (a1,a2,a3))
#define DEFFUNC_EXT_4(ret,name,t1,t2,t3,t4) DEFFUNC_EXT(name,ret, (t1 a1, t2 a2, t3 a3, t4 a4), (a1,a2,a3,a4))
#define DEFFUNC_EXT_5(ret,name,t1,t2,t3,t4,t5) DEFFUNC_EXT(name,ret, (t1 a1, t2 a2, t3 a3, t4 a4,t5 a5), (a1,a2,a3,a4,a5))
DEFFUNC_EXT_1(value,pin_buffer,buffer);
DEFFUNC_EXT_1(void,unpin_buffer,value);
DEFFUNC_EXT_2(value,alloc_array_type,int,hxValueType);
static value alloc_array_type_wrap(int size, hxValueType type)
{
return HAS_alloc_array_type() ? EXT_alloc_array_type(size, type) : alloc_array (size);
}
#endif
|
3a0343cac3b681bc6a4d13f8824e02a552466ad0
|
79d343002bb63a44f8ab0dbac0c9f4ec54078c3a
|
/lib/libc/include/any-windows-any/usbdi.h
|
e47a28746068ea758ef901685bd5222ef6f43a97
|
[
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-public-domain"
] |
permissive
|
ziglang/zig
|
4aa75d8d3bcc9e39bf61d265fd84b7f005623fc5
|
f4c9e19bc3213c2bc7e03d7b06d7129882f39f6c
|
refs/heads/master
| 2023-08-31T13:16:45.980913
| 2023-08-31T05:50:29
| 2023-08-31T05:50:29
| 40,276,274
| 25,560
| 2,399
|
MIT
| 2023-09-14T21:09:50
| 2015-08-06T00:51:28
|
Zig
|
UTF-8
|
C
| false
| false
| 1,704
|
h
|
usbdi.h
|
/**
* usbdi.h
*
* USBD and USB device driver definitions
*
* FIXME : Obsolete header.. Use usb.h instead.
*
* This file is part of the mingw-w64 runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*
* This file is based on the ReactOS PSDK file usbdi.h header.
* Original contributed by Casper S. Hornstrup <chorns@users.sourceforge.net>
*
* Added winapi-family check by Kai Tietz.
*/
#ifndef __USBDI_H__
#define __USBDI_H__
#include <winapifamily.h>
#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
#include <usb.h>
#include <usbioctl.h>
#define USBD_STATUS_CANCELLING ((USBD_STATUS) 0x00020000)
#define USBD_STATUS_CANCELING ((USBD_STATUS) 0x00020000)
#define USBD_STATUS_NO_MEMORY ((USBD_STATUS) 0x80000100)
#define USBD_STATUS_ERROR ((USBD_STATUS) 0x80000000)
#define USBD_STATUS_REQUEST_FAILED ((USBD_STATUS) 0x80000500)
#define USBD_STATUS_HALTED ((USBD_STATUS) 0xc0000000)
#define USBD_HALTED(Status) ((ULONG) (Status) >> 30 == 3)
#define USBD_STATUS(Status) ((ULONG) (Status) & __MSABI_LONG (0x0fffffff))
#define URB_FUNCTION_RESERVED0 0x0016
#define URB_FUNCTION_RESERVED 0x001d
#define URB_FUNCTION_LAST 0x0029
#define USBD_PF_DOUBLE_BUFFER 0x00000002
#ifdef USBD_PF_VALID_MASK
#undef USBD_PF_VALID_MASK
#endif
#define USBD_PF_VALID_MASK (USBD_PF_CHANGE_MAX_PACKET | USBD_PF_DOUBLE_BUFFER | USBD_PF_ENABLE_RT_THREAD_ACCESS | USBD_PF_MAP_ADD_TRANSFERS)
#define USBD_TRANSFER_DIRECTION_BIT 0
#define USBD_SHORT_TRANSFER_OK_BIT 1
#define USBD_START_ISO_TRANSFER_ASAP_BIT 2
#ifdef USBD_TRANSFER_DIRECTION
#undef USBD_TRANSFER_DIRECTION
#endif
#define USBD_TRANSFER_DIRECTION(x) ((x) & USBD_TRANSFER_DIRECTION_IN)
#endif
#endif
|
4e1afe39dc2d683aab7674a6aa0ba0cb368c6412
|
9a55275a51068a4318ab6ef2a1168d03ed5ee939
|
/libs/directx/gamecontroller.c
|
8a1a189fab2df829388c1cd40f8ccefb3adcc449
|
[
"MIT"
] |
permissive
|
HaxeFoundation/hashlink
|
c76dec3d00a8897dc3ae233d146393731caf8e57
|
12f91260eaa4332830609c8db5c086cb7f17c44c
|
refs/heads/master
| 2023-08-31T06:07:38.964706
| 2023-08-30T13:15:14
| 2023-08-30T13:15:14
| 42,316,018
| 793
| 205
|
MIT
| 2023-09-13T08:13:39
| 2015-09-11T15:19:53
|
C
|
UTF-8
|
C
| false
| false
| 11,267
|
c
|
gamecontroller.c
|
#define HL_NAME(n) directx_##n
#include <hl.h>
#include <xinput.h>
#include <InitGuid.h>
#define DIRECTINPUT_VERSION 0x0800
#include <dinput.h>
#include <dbt.h>
#define HAT_CENTERED 0x00
#define HAT_UP 0x01
#define HAT_RIGHT 0x02
#define HAT_DOWN 0x04
#define HAT_LEFT 0x08
typedef struct {
hl_type *t;
int num;
int mask; // for hat only
int axis;
} dinput_mapping_btn;
typedef struct {
hl_type *t;
unsigned int guid;
vbyte *name;
varray *button; // dinput_mapping_btn
} dinput_mapping;
typedef struct _dx_gctrl_device dx_gctrl_device;
struct _dx_gctrl_device {
char *name;
bool isNew;
int xUID;
GUID dGuid;
LPDIRECTINPUTDEVICE8 dDevice;
dinput_mapping *dMapping;
dx_gctrl_device *next;
};
typedef struct {
hl_type *t;
dx_gctrl_device *device;
int index;
vstring *name;
int buttons;
vbyte *axes;
vdynamic *rumbleEnd;
} dx_gctrl_data;
static dx_gctrl_device *dx_gctrl_devices = NULL;
static dx_gctrl_device *dx_gctrl_removed = NULL;
static CRITICAL_SECTION dx_gctrl_cs;
static bool dx_gctrl_syncNeeded = FALSE;
// DirectInput specific
static LPDIRECTINPUT8 gctrl_dinput = NULL;
static varray *gctrl_dinput_mappings = NULL;
static HWND gctrl_dinput_win = NULL;
static bool gctrl_dinput_changed = FALSE;
// XInput
static void gctrl_xinput_add(int uid, dx_gctrl_device **current) {
dx_gctrl_device *device = *current;
dx_gctrl_device *prev = NULL;
while (device) {
if (device->xUID == uid) {
if (device == *current) *current = device->next;
else if (prev) prev->next = device->next;
device->next = dx_gctrl_devices;
dx_gctrl_devices = device;
return;
}
prev = device;
device = device->next;
}
device = (dx_gctrl_device*)malloc(sizeof(dx_gctrl_device));
ZeroMemory(device, sizeof(dx_gctrl_device));
device->name = "XInput controller";
device->xUID = uid;
device->isNew = TRUE;
device->next = dx_gctrl_devices;
dx_gctrl_devices = device;
dx_gctrl_syncNeeded = TRUE;
}
static void gctrl_xinput_update(dx_gctrl_data *data) {
XINPUT_STATE state;
HRESULT r = XInputGetState(data->device->xUID, &state);
if (FAILED(r))
return;
data->buttons = (state.Gamepad.wButtons & 0x0FFF) | (state.Gamepad.wButtons & 0xF000) >> 2;
((double*)data->axes)[0] = (double)(state.Gamepad.sThumbLX < -32767 ? -1. : (state.Gamepad.sThumbLX / 32767.));
((double*)data->axes)[1] = (double)(state.Gamepad.sThumbLY < -32767 ? -1. : (state.Gamepad.sThumbLY / 32767.));
((double*)data->axes)[2] = (double)(state.Gamepad.sThumbRX < -32767 ? -1. : (state.Gamepad.sThumbRX / 32767.));
((double*)data->axes)[3] = (double)(state.Gamepad.sThumbRY < -32767 ? -1. : (state.Gamepad.sThumbRY / 32767.));
((double*)data->axes)[4] = (double)(state.Gamepad.bLeftTrigger / 255.);
((double*)data->axes)[5] = (double)(state.Gamepad.bRightTrigger / 255.);
}
// DirectInput
static LRESULT CALLBACK gctrl_WndProc(HWND wnd, UINT umsg, WPARAM wparam, LPARAM lparam) {
switch (umsg) {
case WM_DEVICECHANGE:
switch (wparam) {
case DBT_DEVICEARRIVAL:
case DBT_DEVICEREMOVECOMPLETE:
if (((DEV_BROADCAST_HDR*)lparam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) {
gctrl_dinput_changed = TRUE;
}
break;
}
}
return DefWindowProc(wnd, umsg, wparam, lparam);
}
static void gctrl_dinput_init( varray *mappings ) {
if( !gctrl_dinput) {
DirectInput8Create(GetModuleHandle(NULL), DIRECTINPUT_VERSION, &IID_IDirectInput8, &gctrl_dinput, NULL);
if (gctrl_dinput) {
WNDCLASSEX wc;
memset(&wc, 0, sizeof(wc));
wc.lpfnWndProc = gctrl_WndProc;
wc.hInstance = GetModuleHandle(NULL);
wc.lpszClassName = USTR("HL_GCTRL");
wc.cbSize = sizeof(WNDCLASSEX);
RegisterClassEx(&wc);
gctrl_dinput_win = CreateWindowEx(0, USTR("HL_GCTRL"), NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL);
GUID guid = { 0x4D1E55B2L, 0xF16F, 0x11CF,{ 0x88, 0xCB, 0x00, 0x11, 0x11, 0x00, 0x00, 0x30 } };
DEV_BROADCAST_DEVICEINTERFACE dbh;
memset(&dbh, 0, sizeof(dbh));
dbh.dbcc_size = sizeof(dbh);
dbh.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
dbh.dbcc_classguid = guid;
RegisterDeviceNotification(gctrl_dinput_win, &dbh, DEVICE_NOTIFY_WINDOW_HANDLE);
gctrl_dinput_changed = TRUE;
}
}
if( mappings ) {
if( gctrl_dinput_mappings )
hl_remove_root(&gctrl_dinput_mappings);
gctrl_dinput_mappings = mappings;
hl_add_root(&gctrl_dinput_mappings);
}
}
static BOOL CALLBACK gctrl_dinput_deviceCb(const DIDEVICEINSTANCE *instance, void *context) {
dx_gctrl_device **current = (dx_gctrl_device**)context;
dx_gctrl_device *device = *current;
dx_gctrl_device *prev = NULL;
LPDIRECTINPUTDEVICE8 di_device;
HRESULT result;
dinput_mapping *mapping = NULL;
while( device ) {
if(device->xUID < 0 && !memcmp(&device->dGuid, &instance->guidInstance, sizeof(device->dGuid)) ) {
if( device == *current ) *current = device->next;
else if( prev ) prev->next = device->next;
device->next = dx_gctrl_devices;
dx_gctrl_devices = device;
return DIENUM_CONTINUE;
}
prev = device;
device = device->next;
}
// Find mapping
for( int i=0; i<gctrl_dinput_mappings->size; i++ ){
dinput_mapping *m = hl_aptr(gctrl_dinput_mappings, dinput_mapping*)[i];
if( instance->guidProduct.Data1 == m->guid ) {
mapping = m;
break;
}
}
if (!mapping ) return DIENUM_CONTINUE;
result = IDirectInput8_CreateDevice(gctrl_dinput, &instance->guidInstance, &di_device, NULL);
if( FAILED(result) ) return DIENUM_CONTINUE;
device = (dx_gctrl_device*)malloc(sizeof(dx_gctrl_device));
ZeroMemory(device, sizeof(dx_gctrl_device));
result = IDirectInputDevice8_QueryInterface(di_device, &IID_IDirectInputDevice8, (LPVOID *)&device->dDevice);
IDirectInputDevice8_Release(di_device);
if( FAILED(result) ) {
free(device);
return DIENUM_CONTINUE;
}
result = IDirectInputDevice8_SetDataFormat(device->dDevice, &c_dfDIJoystick2);
if( FAILED(result) ) {
free(device);
return DIENUM_CONTINUE;
}
device->name = mapping->name;
device->xUID = -1;
device->dMapping = mapping;
memcpy(&device->dGuid, &instance->guidInstance, sizeof(device->dGuid));
device->isNew = TRUE;
device->next = dx_gctrl_devices;
dx_gctrl_devices = device;
dx_gctrl_syncNeeded = TRUE;
return DIENUM_CONTINUE;
}
static void gctrl_dinput_remove(dx_gctrl_device *device) {
IDirectInputDevice8_Unacquire(device->dDevice);
IDirectInputDevice8_Release(device->dDevice);
}
// Based on SDL ( https://hg.libsdl.org/SDL/file/007dfe83abf8/src/joystick/windows/SDL_dinputjoystick.c )
static int gctrl_dinput_translatePOV(DWORD value) {
const int HAT_VALS[] = {
HAT_UP,
HAT_UP | HAT_RIGHT,
HAT_RIGHT,
HAT_DOWN | HAT_RIGHT,
HAT_DOWN,
HAT_DOWN | HAT_LEFT,
HAT_LEFT,
HAT_UP | HAT_LEFT
};
if( LOWORD(value) == 0xFFFF ) return HAT_CENTERED;
value += 4500 / 2;
value %= 36000;
value /= 4500;
if( value < 0 || value >= 8 ) return HAT_CENTERED;
return HAT_VALS[value];
}
static void gctrl_dinput_update(dx_gctrl_data *data) {
DIJOYSTATE2 state;
long *p = (long*)&state;
dinput_mapping *mapping = data->device->dMapping;
LPDIRECTINPUTDEVICE8 dDevice = data->device->dDevice;
HRESULT result = IDirectInputDevice8_GetDeviceState(dDevice, sizeof(DIJOYSTATE2), &state);
if( result == DIERR_INPUTLOST || result == DIERR_NOTACQUIRED ) {
IDirectInputDevice8_Acquire(dDevice);
result = IDirectInputDevice8_GetDeviceState(dDevice, sizeof(DIJOYSTATE2), &state);
}
if( result != DI_OK )
return;
data->buttons = 0;
for( int i = 0; i < mapping->button->size; i++ ) {
dinput_mapping_btn *bmap = hl_aptr(mapping->button, dinput_mapping_btn*)[i];
if (!bmap) continue;
int val;
if( bmap->axis < 0 && bmap->mask == 0 ) {
val = state.rgbButtons[bmap->num];
} else if( bmap->axis < 0 ){
val = gctrl_dinput_translatePOV(state.rgdwPOV[bmap->num])&bmap->mask;
} else {
val = *(p + bmap->axis);
}
switch (i) {
case 0:
case 2:
((double*)data->axes)[i] = (double)(val / 65535.) * 2 - 1.;
break;
case 1:
case 3:
((double*)data->axes)[i] = (double)(val / 65535.) * - 2 + 1.;
break;
case 4:
case 5:
((double*)data->axes)[i] = bmap->axis < 0 ? (val > 0 ? 1 : 0) : (double)(val / 65535.);
break;
default:
data->buttons |= (val > 0 ? 1 : 0) << (i - 6);
break;
}
}
}
//
void gctrl_detect_thread(void *p) {
while (true) {
EnterCriticalSection(&dx_gctrl_cs);
dx_gctrl_device *current = dx_gctrl_devices;
dx_gctrl_devices = NULL;
// XInput
for (int uid = XUSER_MAX_COUNT - 1; uid >= 0; uid--) {
XINPUT_CAPABILITIES capabilities;
if (XInputGetCapabilities(uid, XINPUT_FLAG_GAMEPAD, &capabilities) == ERROR_SUCCESS)
gctrl_xinput_add(uid, ¤t);
}
// DInput
if (gctrl_dinput ) {
if (gctrl_dinput_changed) {
IDirectInput8_EnumDevices(gctrl_dinput, DI8DEVCLASS_GAMECTRL, gctrl_dinput_deviceCb, ¤t, DIEDFL_ATTACHEDONLY);
gctrl_dinput_changed = FALSE;
} else {
while (current) {
dx_gctrl_device *next = current->next;
if (current->xUID < 0) {
current->next = dx_gctrl_devices;
dx_gctrl_devices = current;
}
current = next;
}
}
}
while (current) {
dx_gctrl_device *next = current->next;
current->next = dx_gctrl_removed;
dx_gctrl_removed = current;
dx_gctrl_syncNeeded = TRUE;
current = next;
}
LeaveCriticalSection(&dx_gctrl_cs);
Sleep(300);
}
}
HL_PRIM void HL_NAME(gctrl_init)( varray *mappings ) {
gctrl_dinput_init( mappings );
InitializeCriticalSection(&dx_gctrl_cs);
hl_thread_start(gctrl_detect_thread, NULL, FALSE);
}
static void gctrl_onDetect( vclosure *onDetect, dx_gctrl_device *device, const char *name) {
if( !onDetect ) return;
if( onDetect->hasValue )
((void(*)(void *, dx_gctrl_device*, vbyte*))onDetect->fun)(onDetect->value, device, (vbyte*)name);
else
((void(*)(dx_gctrl_device*, vbyte*))onDetect->fun)(device, (vbyte*)name);
}
HL_PRIM void HL_NAME(gctrl_detect)( vclosure *onDetect ) {
if (dx_gctrl_syncNeeded) {
EnterCriticalSection(&dx_gctrl_cs);
dx_gctrl_device *device = dx_gctrl_devices;
while (device) {
if (device->isNew) {
gctrl_onDetect(onDetect, device, device->name);
device->isNew = FALSE;
}
device = device->next;
}
while (dx_gctrl_removed) {
device = dx_gctrl_removed;
dx_gctrl_removed = device->next;
gctrl_onDetect(onDetect, device, NULL);
if (device->dDevice)
gctrl_dinput_remove(device);
free(device);
}
dx_gctrl_syncNeeded = FALSE;
LeaveCriticalSection(&dx_gctrl_cs);
}
}
HL_PRIM void HL_NAME(gctrl_update)(dx_gctrl_data *data) {
if( data->device->xUID >= 0 )
gctrl_xinput_update(data);
else if( data->device->dDevice && data->device->dMapping )
gctrl_dinput_update(data);
}
HL_PRIM void HL_NAME(gctrl_set_vibration)(dx_gctrl_device *device, double strength) {
if( device->xUID >= 0 ){
XINPUT_VIBRATION vibration;
vibration.wLeftMotorSpeed = vibration.wRightMotorSpeed = (WORD)(strength * 65535);
XInputSetState(device->xUID, &vibration);
}
}
#define TGAMECTRL _ABSTRACT(dx_gctrl_device)
DEFINE_PRIM(_VOID, gctrl_init, _ARR);
DEFINE_PRIM(_VOID, gctrl_detect, _FUN(_VOID, TGAMECTRL _BYTES));
DEFINE_PRIM(_VOID, gctrl_update, _OBJ(TGAMECTRL _I32 _STRING _I32 _BYTES _NULL(_F64)));
DEFINE_PRIM(_VOID, gctrl_set_vibration, TGAMECTRL _F64);
|
e3771476c4bc83e2ec8abe38feef89d59f39b391
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/stm32/stm32f469-st-disco/applications/arduino_pinout/pins_arduino.c
|
37c6397e0a5085e333e3da6496b1ef4b0563f349
|
[
"Apache-2.0",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 2,040
|
c
|
pins_arduino.c
|
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-09-20 liYony first version
*/
#include <Arduino.h>
#include "pins_arduino.h"
/*
* {Arduino Pin, RT-Thread Pin [, Device Name, Channel]}
* [] means optional
* Digital pins must NOT give the device name and channel.
* Analog pins MUST give the device name and channel(ADC, PWM or DAC).
* Arduino Pin must keep in sequence.
*/
const pin_map_t pin_map_table[]=
{
{D0, GET_PIN(G,9), "uart3"}, /* Serial-Rx */
{D1, GET_PIN(G,14), "uart3"}, /* Serial-Tx */
{D2, GET_PIN(G,13)},
{D3, GET_PIN(A,1), "pwm2", 2}, /* PWM */
{D4, GET_PIN(G,12)},
{D5, GET_PIN(A,2), "pwm2", 3}, /* PWM */
{D6, GET_PIN(A,6), "pwm3", 1}, /* PWM */
{D7, GET_PIN(G,11)},
{D8, GET_PIN(G,10)},
{D9, GET_PIN(A,7), "pwm3", 2}, /* PWM */
{D10, GET_PIN(H,6), "pwm12", 1}, /* PWM */
{D11, GET_PIN(B,15), "pwm12", 2}, /* PWM */
{D12, GET_PIN(B,14)},
{D13, GET_PIN(D,3)}, /* LED_BUILTIN */
{D14, GET_PIN(B,9), "i2c1"}, /* I2C-SDA (Wire) */
{D15, GET_PIN(B,8), "i2c1"}, /* I2C-SCL (Wire) */
{D16, GET_PIN(A,0)}, /* user button */
{D17, GET_PIN(G,6)}, /* user LED */
{D18, GET_PIN(D,4)}, /* user LED */
{D19, GET_PIN(D,5)}, /* user LED */
{D20, GET_PIN(K,3)}, /* user LED */
{A0, GET_PIN(B,1), "adc1", 9}, /* ADC */
{A1, GET_PIN(C,2), "adc1", 12}, /* ADC */
{A2, GET_PIN(C,3), "adc1", 13}, /* ADC */
{A3, GET_PIN(C,4), "adc1", 14}, /* ADC */
{A4, GET_PIN(C,5), "adc1", 15}, /* ADC */
{A5, GET_PIN(A,4), "adc1", 4}, /* ADC */
{A6, RT_NULL, "adc1", RT_ADC_INTERN_CH_VREF}, /* ADC, On-Chip: internal reference voltage */
{A7, RT_NULL, "adc1", RT_ADC_INTERN_CH_TEMPER}, /* ADC, On-Chip: internal temperature sensor */
};
|
6af1e981ebcb63b243a56e7e7f43d02fc7ee7884
|
505585f1d89447adea3f9519f12255602acdb1b2
|
/src/cvode/fcmix/fcvbbd.c
|
aaa7c02cf99a75f4d751abb4ff38da627791fa87
|
[
"BSD-3-Clause"
] |
permissive
|
LLNL/sundials
|
11a879f8c8e7a5e40d78d13d0f9baed04d37a280
|
1ea097bb3bce207335ac35f0b5e78df5d71c6409
|
refs/heads/main
| 2023-08-31T12:36:23.500757
| 2023-07-20T16:50:46
| 2023-07-20T16:50:46
| 105,918,649
| 396
| 120
|
BSD-3-Clause
| 2023-09-14T20:38:05
| 2017-10-05T17:20:03
|
C
|
UTF-8
|
C
| false
| false
| 4,950
|
c
|
fcvbbd.c
|
/*
* -----------------------------------------------------------------
* Programmer(s): Daniel R. Reynolds @ SMU
* Alan C. Hindmarsh, Radu Serban and Aaron Collier @ LLNL
* -----------------------------------------------------------------
* SUNDIALS Copyright Start
* Copyright (c) 2002-2023, Lawrence Livermore National Security
* and Southern Methodist University.
* All rights reserved.
*
* See the top-level LICENSE and NOTICE files for details.
*
* SPDX-License-Identifier: BSD-3-Clause
* SUNDIALS Copyright End
* -----------------------------------------------------------------
* This module contains the routines necessary to interface with the
* CVBBDPRE module and user-supplied Fortran routines.
* The routines here call the generically named routines and provide
* a standard interface to the C code of the CVBBDPRE package.
* -----------------------------------------------------------------
*/
#include <stdio.h>
#include <stdlib.h>
#include "fcvode.h" /* actual function names, prototypes, global vars.*/
#include "fcvbbd.h" /* prototypes of interfaces to CVBBDPRE */
#include <cvode/cvode_bbdpre.h> /* prototypes of CVBBDPRE functions and macros */
/***************************************************************************/
/* Prototypes of the Fortran routines */
#ifdef __cplusplus /* wrapper to enable C++ usage */
extern "C" {
#endif
extern void FCV_GLOCFN(long int *NLOC, realtype *T,
realtype *YLOC, realtype *GLOC,
long int *IPAR, realtype *RPAR,
int *ier);
extern void FCV_COMMFN(long int *NLOC, realtype *T,
realtype *Y, long int *IPAR,
realtype *RPAR, int *ier);
#ifdef __cplusplus
}
#endif
/***************************************************************************/
void FCV_BBDINIT(long int *Nloc, long int *mudq, long int *mldq,
long int *mu, long int *ml, realtype* dqrely, int *ier)
{
/*
First call CVBBDPrecInit to initialize CVBBDPRE module:
Nloc is the local vector size
mudq,mldq are the half-bandwidths for computing preconditioner blocks
mu, ml are the half-bandwidths of the retained preconditioner blocks
dqrely is the difference quotient relative increment factor
FCVgloc is a pointer to the CVLocalFn function
FCVcfn is a pointer to the CVCommFn function
*/
*ier = CVBBDPrecInit(CV_cvodemem,
(sunindextype)(*Nloc),
(sunindextype)(*mudq),
(sunindextype)(*mldq),
(sunindextype)(*mu),
(sunindextype)(*ml),
*dqrely,
(CVLocalFn) FCVgloc, (CVCommFn) FCVcfn);
return;
}
/***************************************************************************/
void FCV_BBDREINIT(long int *mudq, long int *mldq,
realtype* dqrely, int *ier)
{
/*
First call CVReInitBBD to re-initialize CVBBDPRE module:
mudq,mldq are the half-bandwidths for computing preconditioner blocks
dqrely is the difference quotient relative increment factor
FCVgloc is a pointer to the CVLocalFn function
FCVcfn is a pointer to the CVCommFn function
*/
*ier = CVBBDPrecReInit(CV_cvodemem,
(sunindextype)(*mudq),
(sunindextype)(*mldq),
*dqrely);
}
/***************************************************************************/
/* C function FCVgloc to interface between CVBBDPRE module and a Fortran
subroutine FCVLOCFN. */
int FCVgloc(long int Nloc, realtype t, N_Vector yloc, N_Vector gloc,
void *user_data)
{
int ier;
realtype *yloc_data, *gloc_data;
FCVUserData CV_userdata;
yloc_data = N_VGetArrayPointer(yloc);
gloc_data = N_VGetArrayPointer(gloc);
CV_userdata = (FCVUserData) user_data;
FCV_GLOCFN(&Nloc, &t, yloc_data, gloc_data,
CV_userdata->ipar, CV_userdata->rpar, &ier);
return(ier);
}
/***************************************************************************/
/* C function FCVcfn to interface between CVBBDPRE module and a Fortran
subroutine FCVCOMMF. */
int FCVcfn(long int Nloc, realtype t, N_Vector y, void *user_data)
{
int ier;
realtype *yloc;
FCVUserData CV_userdata;
yloc = N_VGetArrayPointer(y);
CV_userdata = (FCVUserData) user_data;
FCV_COMMFN(&Nloc, &t, yloc, CV_userdata->ipar, CV_userdata->rpar, &ier);
return(ier);
}
/***************************************************************************/
/* C function FCVBBDOPT to access optional outputs from CVBBD_Data */
void FCV_BBDOPT(long int *lenrwbbd, long int *leniwbbd, long int *ngebbd)
{
CVBBDPrecGetWorkSpace(CV_cvodemem, lenrwbbd, leniwbbd);
CVBBDPrecGetNumGfnEvals(CV_cvodemem, ngebbd);
}
|
4e743899ee86901a5f2ab5460a074277b2299e8a
|
6832a9c81b16ead373325f70fb97753d6a211539
|
/src/wrapped/wrappedlibssl_private.h
|
3e9ed64e59d787a568a1090f79fcef039940fa57
|
[
"MIT"
] |
permissive
|
ptitSeb/box86
|
2d3a0c4574905ff8d9dc7b5afb5444a273832bd6
|
ad934455c1b40feeebe5e6bd09b9063519102859
|
refs/heads/master
| 2023-08-22T05:30:54.331500
| 2023-08-20T13:01:58
| 2023-08-20T13:01:58
| 164,844,546
| 2,877
| 294
|
MIT
| 2023-07-27T11:19:10
| 2019-01-09T10:49:32
|
C
|
UTF-8
|
C
| false
| false
| 17,113
|
h
|
wrappedlibssl_private.h
|
#if !(defined(GO) && defined(GOM) && defined(GO2) && defined(DATA))
#error meh!
#endif
//GO(BIO_f_ssl,
//GO(BIO_new_buffer_ssl_connect,
//GO(BIO_new_ssl,
//GO(BIO_new_ssl_connect,
//GO(BIO_ssl_copy_session_id,
//GO(BIO_ssl_shutdown,
//GO(custom_ext_add,
//GO(custom_ext_init,
//GO(custom_ext_parse,
//GO(custom_exts_copy,
//GO(custom_exts_free,
GO(d2i_SSL_SESSION, pFppl)
//GO(do_dtls1_write,
//GO(dtls1_accept,
//GO(dtls1_buffer_message,
//GO(dtls1_check_timeout_num,
//GO(dtls1_clear,
//GO(dtls1_clear_received_buffer,
//GO(dtls1_clear_sent_buffer,
//GO(dtls1_connect,
//GO(dtls1_ctrl,
//GO(dtls1_default_timeout,
//GO(dtls1_dispatch_alert,
//GO(dtls1_double_timeout,
//GO(dtls1_do_write,
//GO(dtls1_free,
//GO(dtls1_get_ccs_header,
//GO(dtls1_get_cipher,
//GO(dtls1_get_message,
//GO(dtls1_get_message_header,
//GO(dtls1_get_queue_priority,
//GO(dtls1_get_record,
//GO(dtls1_get_timeout,
//GO(dtls1_handle_timeout,
//GO(dtls1_heartbeat,
//GO(dtls1_hm_fragment_free,
//GO(dtls1_is_timer_expired,
//GO(dtls1_link_min_mtu,
//GO(dtls1_listen,
//GO(dtls1_min_mtu,
//GO(dtls1_new,
//GO(dtls1_process_heartbeat,
//GO(dtls1_read_bytes,
//GO(dtls1_read_failed,
//GO(dtls1_reset_seq_numbers,
//GO(dtls1_retransmit_buffered_messages,
//GO(dtls1_retransmit_message,
//GO(dtls1_send_change_cipher_spec,
//GO(dtls1_set_message_header,
//GO(dtls1_shutdown,
//GO(dtls1_start_timer,
//GO(dtls1_stop_timer,
//GO(dtls1_write_app_data_bytes,
//GO(dtls1_write_bytes,
//GO(DTLS_client_method,
GO(DTLS_method, pFv)
GO(DTLS_server_method, pFv)
GO(DTLSv1_2_client_method, pFv)
GO(DTLSv1_2_method, pFv)
GO(DTLSv1_2_server_method, pFv)
GO(DTLSv1_client_method, pFv)
GO(DTLSv1_method, pFv)
GO(DTLSv1_server_method, pFv)
//GO(ERR_load_SSL_strings,
//GO(_fini,
GO(i2d_SSL_SESSION, iFpp)
//GO(_init,
//GO(n_ssl3_mac,
//GO(OBJ_bsearch_ssl_cipher_id,
//GO(PEM_read_bio_SSL_SESSION,
//GO(PEM_read_SSL_SESSION,
//GO(PEM_write_bio_SSL_SESSION,
//GO(PEM_write_SSL_SESSION,
//GO(SRP_Calc_A_param,
//GO(SRP_generate_client_master_secret,
//GO(SRP_generate_server_master_secret,
//GO(srp_verify_server_param,
//GO(ssl23_accept,
//GO(ssl23_connect,
//GO(ssl23_default_timeout,
//GO(ssl23_get_cipher,
//GO(ssl23_get_cipher_by_char,
//GO(ssl23_get_client_hello,
//GO(ssl23_num_ciphers,
//GO(ssl23_peek,
//GO(ssl23_put_cipher_by_char,
//GO(ssl23_read,
//GO(ssl23_read_bytes,
//GO(ssl23_write,
//GO(ssl23_write_bytes,
//GO(ssl3_accept,
//GO(ssl3_alert_code,
//GO(ssl3_callback_ctrl,
//GO(ssl3_cbc_copy_mac,
//GO(ssl3_cbc_digest_record,
//GO(ssl3_cbc_record_digest_supported,
//GO(ssl3_cbc_remove_padding,
//GO(ssl3_cert_verify_mac,
//GO(ssl3_change_cipher_state,
//GO(ssl3_check_cert_and_algorithm,
//GO(ssl3_choose_cipher,
//GO(ssl3_cleanup_key_block,
//GO(ssl3_clear,
//GO(ssl3_client_hello,
//GO(ssl3_comp_find,
//GO(ssl3_connect,
//GO(ssl3_ctrl,
//GO(ssl3_ctx_callback_ctrl,
//GO(ssl3_ctx_ctrl,
//GO(ssl3_default_timeout,
//GO(ssl3_digest_cached_records,
//GO(ssl3_dispatch_alert,
//GO(ssl3_do_change_cipher_spec,
//GO(ssl3_do_compress,
//GO(ssl3_do_uncompress,
//GO(ssl3_do_write,
//GO(ssl3_enc,
//GO(ssl3_final_finish_mac,
//GO(ssl3_finish_mac,
//GO(ssl3_free,
//GO(ssl3_free_digest_list,
//GO(ssl3_generate_master_secret,
//GO(ssl3_get_certificate_request,
//GO(ssl3_get_cert_status,
//GO(ssl3_get_cert_verify,
//GO(ssl3_get_cipher,
//GO(ssl3_get_cipher_by_char,
//GO(ssl3_get_client_certificate,
//GO(ssl3_get_client_hello,
//GO(ssl3_get_client_key_exchange,
//GO(ssl3_get_finished,
//GO(ssl3_get_key_exchange,
//GO(ssl3_get_message,
//GO(ssl3_get_new_session_ticket,
//GO(ssl3_get_next_proto,
//GO(ssl3_get_req_cert_type,
//GO(ssl3_get_server_certificate,
//GO(ssl3_get_server_done,
//GO(ssl3_get_server_hello,
//GO(ssl3_handshake_write,
//GO(ssl3_init_finished_mac,
//GO(ssl3_new,
//GO(ssl3_num_ciphers,
//GO(ssl3_output_cert_chain,
//GO(ssl3_peek,
//GO(ssl3_pending,
//GO(ssl3_put_cipher_by_char,
//GO(ssl3_read,
//GO(ssl3_read_bytes,
//GO(ssl3_read_n,
//GO(ssl3_record_sequence_update,
//GO(ssl3_release_read_buffer,
//GO(ssl3_release_write_buffer,
//GO(ssl3_renegotiate,
//GO(ssl3_renegotiate_check,
//GO(ssl3_send_alert,
//GO(ssl3_send_certificate_request,
//GO(ssl3_send_cert_status,
//GO(ssl3_send_change_cipher_spec,
//GO(ssl3_send_client_certificate,
//GO(ssl3_send_client_key_exchange,
//GO(ssl3_send_client_verify,
//GO(ssl3_send_finished,
//GO(ssl3_send_hello_request,
//GO(ssl3_send_newsession_ticket,
//GO(ssl3_send_next_proto,
//GO(ssl3_send_server_certificate,
//GO(ssl3_send_server_done,
//GO(ssl3_send_server_hello,
//GO(ssl3_send_server_key_exchange,
//GO(ssl3_set_handshake_header,
//GO(ssl3_setup_buffers,
//GO(ssl3_setup_key_block,
//GO(ssl3_setup_read_buffer,
//GO(ssl3_setup_write_buffer,
//GO(ssl3_shutdown,
//GO(ssl3_write,
//GO(ssl3_write_bytes,
//GO(ssl3_write_pending,
GO(SSL_accept, iFp)
//GO(ssl_add_cert_chain,
GO(SSL_add_client_CA, iFpp)
//GO(ssl_add_clienthello_renegotiate_ext,
//GO(ssl_add_clienthello_tlsext,
//GO(ssl_add_clienthello_use_srtp_ext,
//GO(SSL_add_dir_cert_subjects_to_stack,
//GO(SSL_add_file_cert_subjects_to_stack,
//GO(ssl_add_serverhello_renegotiate_ext,
//GO(ssl_add_serverhello_tlsext,
//GO(ssl_add_serverhello_use_srtp_ext,
//GO(SSL_alert_desc_string,
//GO(SSL_alert_desc_string_long,
//GO(SSL_alert_type_string,
//GO(SSL_alert_type_string_long,
//GO(ssl_bad_method,
//GO(ssl_build_cert_chain,
//GO(ssl_bytes_to_cipher_list,
//GO(SSL_cache_hit,
GOM(SSL_callback_ctrl, lFEpip)
//GO(ssl_cert_add0_chain_cert,
//GO(ssl_cert_add1_chain_cert,
//GO(ssl_cert_clear_certs,
//GO(ssl_cert_dup,
//GO(ssl_cert_free,
//GO(ssl_cert_inst,
//GO(ssl_cert_new,
//GO(SSL_certs_clear,
//GO(ssl_cert_select_current,
//GO(ssl_cert_set0_chain,
//GO(ssl_cert_set1_chain,
//GO(ssl_cert_set_cert_cb,
//GO(ssl_cert_set_cert_store,
//GO(ssl_cert_set_current,
//GO(ssl_cert_set_default_md,
//GO(ssl_cert_type,
//GO(SSL_check_chain,
//GO(ssl_check_clienthello_tlsext_late,
GO(SSL_check_private_key, iFp)
//GO(ssl_check_serverhello_tlsext,
//GO(ssl_check_srvr_ecc_cert_and_alg,
GO(SSL_CIPHER_description, pFppi)
//GO(SSL_CIPHER_find,
GO(SSL_CIPHER_get_bits, iFpp)
//GO(ssl_cipher_get_cert_index,
//GO(ssl_cipher_get_evp,
//GO(SSL_CIPHER_get_id,
GO(SSL_CIPHER_get_name, pFp)
GO(SSL_CIPHER_get_version, pFp)
//GO(ssl_cipher_id_cmp,
//GO(ssl_cipher_list_to_bytes,
//GO(ssl_cipher_ptr_id_cmp,
GO(SSL_clear, iFp)
//GO(ssl_clear_bad_session,
//GO(ssl_clear_cipher_ctx,
//GO(ssl_clear_hash_ctx,
//GO(SSL_COMP_add_compression_method,
//GO(SSL_COMP_free_compression_methods,
//GO(SSL_COMP_get_compression_methods,
//GO(SSL_COMP_get_name,
//GO(SSL_COMP_set0_compression_methods,
//GO(SSL_CONF_cmd,
//GO(SSL_CONF_cmd_argv,
//GO(SSL_CONF_cmd_value_type,
//GO(SSL_CONF_CTX_clear_flags,
//GO(SSL_CONF_CTX_finish,
//GO(SSL_CONF_CTX_free,
//GO(SSL_CONF_CTX_new,
//GO(SSL_CONF_CTX_set1_prefix,
//GO(SSL_CONF_CTX_set_flags,
//GO(SSL_CONF_CTX_set_ssl,
//GO(SSL_CONF_CTX_set_ssl_ctx,
GO(SSL_connect, iFp)
//GO(SSL_copy_session_id,
//GO(ssl_create_cipher_list,
GO(SSL_ctrl, lFpilp)
GO(SSL_CTX_add_client_CA, iFpp)
//GO(SSL_CTX_add_client_custom_ext,
//GO(SSL_CTX_add_server_custom_ext,
//GO(SSL_CTX_add_session,
GOM(SSL_CTX_callback_ctrl, lFEpip)
GO(SSL_CTX_check_private_key, iFp)
GO(SSL_CTX_ctrl, lFpilp)
//GO(SSL_CTX_flush_sessions,
GO(SSL_CTX_free, vFp)
//GO(SSL_CTX_get0_certificate,
//GO(SSL_CTX_get0_param,
//GO(SSL_CTX_get0_privatekey,
GO(SSL_CTX_get_cert_store, pFp)
//GO(SSL_CTX_get_client_CA_list,
//GO(SSL_CTX_get_client_cert_cb,
//GO(SSL_CTX_get_ex_data,
//GO(SSL_CTX_get_ex_new_index,
//GO(SSL_CTX_get_info_callback,
//GO(SSL_CTX_get_quiet_shutdown,
//GO(SSL_CTX_get_ssl_method,
//GO(SSL_CTX_get_timeout,
//GO(SSL_CTX_get_verify_callback,
//GO(SSL_CTX_get_verify_depth,
//GO(SSL_CTX_get_verify_mode,
GO(SSL_CTX_load_verify_locations, iFppp)
GO(SSL_CTX_new, pFp)
//GO(SSL_CTX_remove_session,
//GO(SSL_CTX_sess_get_get_cb,
//GO(SSL_CTX_sess_get_new_cb,
//GO(SSL_CTX_sess_get_remove_cb,
//GO(SSL_CTX_sessions,
//GO(SSL_CTX_sess_set_get_cb,
GOM(SSL_CTX_sess_set_new_cb, vFEpp)
//GO(SSL_CTX_sess_set_remove_cb,
//GO(SSL_CTX_set1_param,
//GO(SSL_CTX_set_alpn_protos,
//GO(SSL_CTX_set_alpn_select_cb,
//GO(SSL_CTX_set_cert_cb,
GO(SSL_CTX_set_cert_store, vFpp)
//GO(SSL_CTX_set_cert_verify_callback,
GO(SSL_CTX_set_cipher_list, iFpp)
GO(SSL_CTX_set_client_CA_list, vFpp)
//GO(SSL_CTX_set_client_cert_cb,
//GO(SSL_CTX_set_client_cert_engine,
//GO(SSL_CTX_set_cookie_generate_cb,
//GO(SSL_CTX_set_cookie_verify_cb,
GOM(SSL_CTX_set_default_passwd_cb, vFEpp)
GO(SSL_CTX_set_default_passwd_cb_userdata, vFpp)
GO(SSL_CTX_set_default_verify_paths, iFp)
//GO(SSL_CTX_set_ex_data,
//GO(SSL_CTX_set_generate_session_id,
//GO(SSL_CTX_set_info_callback,
//GO(SSL_CTX_set_msg_callback,
//GO(SSL_CTX_set_next_protos_advertised_cb,
GOM(SSL_CTX_set_next_proto_select_cb, vFEppp)
//GO(SSL_CTX_set_psk_client_callback,
//GO(SSL_CTX_set_psk_server_callback,
//GO(SSL_CTX_set_purpose,
//GO(SSL_CTX_set_quiet_shutdown,
//GO(SSL_CTX_set_session_id_context,
//GO(SSL_CTX_set_srp_cb_arg,
//GO(SSL_CTX_set_srp_client_pwd_callback,
//GO(SSL_CTX_set_srp_password,
//GO(SSL_CTX_set_srp_strength,
//GO(SSL_CTX_set_srp_username,
//GO(SSL_CTX_set_srp_username_callback,
//GO(SSL_CTX_set_srp_verify_param_callback,
//GO(SSL_CTX_set_ssl_version,
//GO(SSL_CTX_set_timeout,
//GO(SSL_CTX_set_tlsext_use_srtp,
//GO(SSL_CTX_set_tmp_dh_callback,
//GO(SSL_CTX_set_tmp_ecdh_callback,
//GO(SSL_CTX_set_tmp_rsa_callback,
//GO(SSL_CTX_set_trust,
GOM(SSL_CTX_set_verify, vFEpip)
GO(SSL_CTX_set_verify_depth, vFpi)
//GO(SSL_CTX_SRP_CTX_free,
//GO(SSL_CTX_SRP_CTX_init,
GO(SSL_CTX_use_certificate, iFpp)
GO(SSL_CTX_use_certificate_ASN1, iFpip)
GO(SSL_CTX_use_certificate_chain_file, iFpp)
GO(SSL_CTX_use_certificate_file, iFppi)
GO(SSL_CTX_use_PrivateKey, iFpp)
GO(SSL_CTX_use_PrivateKey_ASN1, iFuppi)
GO(SSL_CTX_use_PrivateKey_file, iFppi)
//GO(SSL_CTX_use_psk_identity_hint,
GO(SSL_CTX_use_RSAPrivateKey, iFpp)
GO(SSL_CTX_use_RSAPrivateKey_ASN1, iFppl)
GO(SSL_CTX_use_RSAPrivateKey_file, iFppi)
//GO(SSL_CTX_use_serverinfo,
//GO(SSL_CTX_use_serverinfo_file,
//GO(ssl_do_client_cert_cb,
//GO(SSL_do_handshake,
//GO(SSL_dup,
//GO(SSL_dup_CA_list,
//GO(SSL_export_keying_material,
//GO(SSL_extension_supported,
//GO(ssl_fill_hello_random,
GO(SSL_free, vFp)
//GO(ssl_free_wbio_buffer,
//GO(SSL_get0_alpn_selected,
GO(SSL_get0_next_proto_negotiated, vFppp)
//GO(SSL_get0_param,
GO(SSL_get0_session, pFp)
GO(SSL_get1_session, pFp)
//GO(ssl_get_algorithm2,
GO(SSL_get_certificate, pFp)
//GO(ssl_get_cipher_by_char,
//GO(SSL_get_cipher_list,
GO(SSL_get_ciphers, pFp)
//GO(ssl_get_ciphers_by_id,
//GO(SSL_get_client_CA_list,
GO(SSL_get_current_cipher, pFp)
//GO(SSL_get_current_compression,
//GO(SSL_get_current_expansion,
//GO(SSL_get_default_timeout,
GO(SSL_get_error, iFpi)
GO(SSL_get_ex_data, pFpi)
//GO(SSL_get_ex_data_X509_STORE_CTX_idx,
GOM(SSL_get_ex_new_index, iFElpppp)
//GO(SSL_get_fd,
//GO(SSL_get_finished,
//GO(ssl_get_handshake_digest,
//GO(SSL_get_info_callback,
//GO(ssl_get_new_session,
GO(SSL_get_peer_cert_chain, pFp)
GO(SSL_get_peer_certificate, pFp)
//GO(SSL_get_peer_finished,
//GO(ssl_get_prev_session,
GO(SSL_get_privatekey, pFp)
//GO(SSL_get_psk_identity,
//GO(SSL_get_psk_identity_hint,
//GO(SSL_get_quiet_shutdown,
//GO(SSL_get_rbio,
//GO(SSL_get_read_ahead,
//GO(SSL_get_rfd,
//GO(SSL_get_selected_srtp_profile,
//GO(ssl_get_server_cert_serverinfo,
//GO(SSL_get_servername,
//GO(SSL_get_servername_type,
//GO(ssl_get_server_send_pkey,
GO(SSL_get_session, pFp)
//GO(SSL_get_shared_ciphers,
//GO(SSL_get_shared_sigalgs,
GO(SSL_get_shutdown, iFp)
//GO(SSL_get_sigalgs,
//GO(ssl_get_sign_pkey,
//GO(SSL_get_srp_g,
//GO(SSL_get_srp_N,
//GO(SSL_get_srp_userinfo,
//GO(SSL_get_srp_username,
//GO(SSL_get_srtp_profiles,
//GO(SSL_get_SSL_CTX,
//GO(SSL_get_ssl_method,
//GO(SSL_get_verify_callback,
//GO(SSL_get_verify_depth,
//GO(SSL_get_verify_mode,
GO(SSL_get_verify_result, iFp)
//GO(SSL_get_version,
//GO(SSL_get_wbio,
//GO(SSL_get_wfd,
//GO(SSL_has_matching_session_id,
//GO(ssl_init_wbio_buffer,
GO(SSL_is_server, iFp)
GO(SSL_library_init, iFv)
//GO(ssl_load_ciphers,
//GO(SSL_load_client_CA_file,
GO(SSL_load_error_strings, vFv)
GO(SSL_new, pFp)
//GO(ssl_ok,
//GO(ssl_parse_clienthello_renegotiate_ext,
//GO(ssl_parse_clienthello_tlsext,
//GO(ssl_parse_clienthello_use_srtp_ext,
//GO(ssl_parse_serverhello_renegotiate_ext,
//GO(ssl_parse_serverhello_tlsext,
//GO(ssl_parse_serverhello_use_srtp_ext,
GO(SSL_peek, iFppi)
GO(SSL_pending, iFp)
//GO(ssl_prepare_clienthello_tlsext,
//GO(ssl_prepare_serverhello_tlsext,
GO(SSL_read, iFppi)
//GO(SSL_renegotiate,
//GO(SSL_renegotiate_abbreviated,
//GO(SSL_renegotiate_pending,
//GO(ssl_replace_hash,
//GO(SSL_rstate_string,
//GO(SSL_rstate_string_long,
GO(SSL_select_next_proto, iFpppupu)
//GO(ssl_sess_cert_free,
//GO(ssl_sess_cert_new,
GO(ssl_session_dup, pFp)
GO(SSL_SESSION_dup, pFp)
GO(SSL_SESSION_free, vFp)
//GO(SSL_SESSION_get0_peer,
//GO(SSL_SESSION_get_compress_id,
//GO(SSL_SESSION_get_ex_data,
//GO(SSL_SESSION_get_ex_new_index,
//GO(SSL_SESSION_get_id,
//GO(SSL_SESSION_get_time,
//GO(SSL_SESSION_get_timeout,
GO(SSL_SESSION_new, pFv)
//GO(SSL_SESSION_print,
//GO(SSL_SESSION_print_fp,
//GO(SSL_SESSION_set1_id_context,
//GO(SSL_SESSION_set_ex_data,
//GO(SSL_SESSION_set_time,
//GO(SSL_SESSION_set_timeout,
GO(SSL_SESSION_up_ref, iFp)
//GO(SSL_set1_param,
GO(SSL_set_accept_state, vFp)
//GO(SSL_set_alpn_protos,
GO(SSL_set_bio, vFppp)
//GO(SSL_set_cert_cb,
//GO(ssl_set_cert_masks,
GO(SSL_set_cipher_list, iFpp)
GO(SSL_set_client_CA_list, vFpp)
//GO(ssl_set_client_disabled,
GO(SSL_set_connect_state, vFp)
//GO(SSL_set_debug,
GO(SSL_set_ex_data, iFpip)
GO(SSL_set_fd, iFpi)
//GO(SSL_set_generate_session_id,
//GO(SSL_set_info_callback,
//GO(SSL_set_msg_callback,
//GO(ssl_set_peer_cert_type,
GOM(SSL_set_psk_client_callback, vFEpp)
//GO(SSL_set_psk_server_callback,
//GO(SSL_set_purpose,
//GO(SSL_set_quiet_shutdown,
//GO(SSL_set_read_ahead,
GO(SSL_set_rfd, iFpi)
GO(SSL_set_session, iFpp)
//GO(SSL_set_session_id_context,
//GO(SSL_set_session_secret_cb,
//GO(SSL_set_session_ticket_ext,
//GO(SSL_set_session_ticket_ext_cb,
GO(SSL_set_shutdown, iFp)
//GO(SSL_set_srp_server_param,
//GO(SSL_set_srp_server_param_pw,
//GO(SSL_set_SSL_CTX,
//GO(SSL_set_ssl_method,
//GO(SSL_set_state,
//GO(SSL_set_tlsext_use_srtp,
//GO(SSL_set_tmp_dh_callback,
//GO(SSL_set_tmp_ecdh_callback,
//GO(SSL_set_tmp_rsa_callback,
//GO(SSL_set_trust,
GOM(SSL_set_verify, vFEpip)
GO(SSL_set_verify_depth, vFpi)
//GO(SSL_set_verify_result,
GO(SSL_set_wfd, iFpi)
GO(SSL_shutdown, iFp)
//GO(SSL_SRP_CTX_free,
//GO(SSL_SRP_CTX_init,
//GO(SSL_srp_server_param_with_username,
//GO(SSL_state,
//GO(SSL_state_string,
//GO(SSL_state_string_long,
//GO(ssl_undefined_const_function,
//GO(ssl_undefined_function,
//GO(ssl_undefined_void_function,
//GO(ssl_update_cache,
GO(SSL_use_certificate, iFpp)
GO(SSL_use_certificate_ASN1, iFppi)
GO(SSL_use_certificate_file, iFppi)
GO(SSL_use_PrivateKey, iFpp)
GO(SSL_use_PrivateKey_ASN1, iFppl)
GO(SSL_use_PrivateKey_file, iFppi)
//GO(SSL_use_psk_identity_hint,
GO(SSL_use_RSAPrivateKey, iFpp)
GO(SSL_use_RSAPrivateKey_ASN1, iFppl)
GO(SSL_use_RSAPrivateKey_file, iFppi)
GO(SSLv23_client_method, pFv)
GO(SSLv23_method, pFv)
GO(SSLv23_server_method, pFv)
GO(SSLv2_client_method, pFv)
GO(SSLv2_method, pFv)
GO(SSLv2_server_method, pFv)
GO(SSLv3_client_method, pFv)
GO(SSLv3_method, pFv)
GO(SSLv3_server_method, pFv)
//GO(ssl_verify_alarm_type,
//GO(ssl_verify_cert_chain,
GO(SSL_version, iFp)
//GO(SSL_want,
GO(SSL_write, iFppi)
//GO(tls12_check_peer_sigalg,
//GO(tls12_get_hash,
//GO(tls12_get_psigalgs,
//GO(tls12_get_sigandhash,
//GO(tls12_get_sigid,
//GO(tls1_alert_code,
//GO(tls1_cbc_remove_padding,
//GO(tls1_cert_verify_mac,
//GO(tls1_change_cipher_state,
//GO(tls1_check_chain,
//GO(tls1_check_curve,
//GO(tls1_check_ec_tmp_key,
//GO(tls1_clear,
//GO(tls1_default_timeout,
//GO(tls1_ec_curve_id2nid,
//GO(tls1_ec_nid2curve_id,
//GO(tls1_enc,
//GO(tls1_export_keying_material,
//GO(tls1_final_finish_mac,
//GO(tls1_free,
//GO(tls1_generate_master_secret,
//GO(tls1_heartbeat,
//GO(tls1_mac,
//GO(tls1_new,
//GO(tls1_process_heartbeat,
//GO(tls1_process_sigalgs,
//GO(tls1_process_ticket,
//GO(tls1_save_sigalgs,
//GO(tls1_set_cert_validity,
//GO(tls1_set_curves,
//GO(tls1_set_curves_list,
//GO(tls1_set_server_sigalgs,
//GO(tls1_set_sigalgs,
//GO(tls1_set_sigalgs_list,
//GO(tls1_setup_key_block,
//GO(tls1_shared_curve,
GO(TLSv1_1_client_method, pFv)
GO(TLSv1_1_method, pFv)
GO(TLSv1_1_server_method, pFv)
GO(TLSv1_2_client_method, pFv)
GO(TLSv1_2_method, pFv)
GO(TLSv1_2_server_method, pFv)
GO(TLSv1_client_method, pFv)
GO(TLSv1_method, pFv)
GO(verify_callback, iFip)
GO(TLSv1_server_method, pFv) // not always present in lib
|
0613cded8305c96136c6d26896550cc34d75d9d0
|
9eedaea06306b20520151321854f989a73c7daf8
|
/src/audio/ps2/SDL_ps2audio.c
|
2165194eb182fb3440e29058610fcb6671b4a73b
|
[
"Zlib"
] |
permissive
|
libsdl-org/SDL
|
cf56bdc8a9e198e9735201674118c822d0e3edf3
|
8387fae698745969ce366c4de9bcc1b4a364a7dd
|
refs/heads/main
| 2023-09-04T06:58:34.316952
| 2023-09-03T15:11:13
| 2023-09-03T15:11:13
| 330,008,801
| 6,912
| 1,605
|
Zlib
| 2023-09-13T19:12:26
| 2021-01-15T19:55:54
|
C
|
UTF-8
|
C
| false
| false
| 5,159
|
c
|
SDL_ps2audio.c
|
/*
Simple DirectMedia Layer
Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
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. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "SDL_internal.h"
#include "../SDL_audio_c.h"
#include "SDL_ps2audio.h"
#include <kernel.h>
#include <audsrv.h>
#include <ps2_audio_driver.h>
static int PS2AUDIO_OpenDevice(SDL_AudioDevice *device)
{
device->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, sizeof(*device->hidden));
if (device->hidden == NULL) {
return SDL_OutOfMemory();
}
// These are the native supported audio PS2 configs
switch (device->spec.freq) {
case 11025:
case 12000:
case 22050:
case 24000:
case 32000:
case 44100:
case 48000:
break; // acceptable value, keep it
default:
device->spec.freq = 48000;
break;
}
device->sample_frames = 512;
device->spec.channels = device->spec.channels == 1 ? 1 : 2;
device->spec.format = device->spec.format == SDL_AUDIO_S8 ? SDL_AUDIO_S8 : SDL_AUDIO_S16;
struct audsrv_fmt_t format;
format.bits = device->spec.format == SDL_AUDIO_S8 ? 8 : 16;
format.freq = device->spec.freq;
format.channels = device->spec.channels;
device->hidden->channel = audsrv_set_format(&format);
audsrv_set_volume(MAX_VOLUME);
if (device->hidden->channel < 0) {
return SDL_SetError("Couldn't reserve hardware channel");
}
// Update the fragment size as size in bytes.
SDL_UpdatedAudioDeviceFormat(device);
/* Allocate the mixing buffer. Its size and starting address must
be a multiple of 64 bytes. Our sample count is already a multiple of
64, so spec->size should be a multiple of 64 as well. */
const int mixlen = device->buffer_size * NUM_BUFFERS;
device->hidden->rawbuf = (Uint8 *)SDL_aligned_alloc(64, mixlen);
if (device->hidden->rawbuf == NULL) {
return SDL_SetError("Couldn't allocate mixing buffer");
}
SDL_memset(device->hidden->rawbuf, device->silence_value, mixlen);
for (int i = 0; i < NUM_BUFFERS; i++) {
device->hidden->mixbufs[i] = &device->hidden->rawbuf[i * device->buffer_size];
}
return 0;
}
static int PS2AUDIO_PlayDevice(SDL_AudioDevice *device, const Uint8 *buffer, int buflen)
{
// this returns number of bytes accepted or a negative error. We assume anything other than buflen is a fatal error.
return (audsrv_play_audio((char *)buffer, buflen) != buflen) ? -1 : 0;
}
static void PS2AUDIO_WaitDevice(SDL_AudioDevice *device)
{
audsrv_wait_audio(device->buffer_size);
}
static Uint8 *PS2AUDIO_GetDeviceBuf(SDL_AudioDevice *device, int *buffer_size)
{
Uint8 *buffer = device->hidden->mixbufs[device->hidden->next_buffer];
device->hidden->next_buffer = (device->hidden->next_buffer + 1) % NUM_BUFFERS;
return buffer;
}
static void PS2AUDIO_CloseDevice(SDL_AudioDevice *device)
{
if (device->hidden) {
if (device->hidden->channel >= 0) {
audsrv_stop_audio();
device->hidden->channel = -1;
}
if (device->hidden->rawbuf != NULL) {
SDL_aligned_free(device->hidden->rawbuf);
device->hidden->rawbuf = NULL;
}
SDL_free(device->hidden);
device->hidden = NULL;
}
}
static void PS2AUDIO_ThreadInit(SDL_AudioDevice *device)
{
/* Increase the priority of this audio thread by 1 to put it
ahead of other SDL threads. */
const int32_t thid = GetThreadId();
ee_thread_status_t status;
if (ReferThreadStatus(thid, &status) == 0) {
ChangeThreadPriority(thid, status.current_priority - 1);
}
}
static void PS2AUDIO_Deinitialize(void)
{
deinit_audio_driver();
}
static SDL_bool PS2AUDIO_Init(SDL_AudioDriverImpl *impl)
{
if (init_audio_driver() < 0) {
return SDL_FALSE;
}
impl->OpenDevice = PS2AUDIO_OpenDevice;
impl->PlayDevice = PS2AUDIO_PlayDevice;
impl->WaitDevice = PS2AUDIO_WaitDevice;
impl->GetDeviceBuf = PS2AUDIO_GetDeviceBuf;
impl->CloseDevice = PS2AUDIO_CloseDevice;
impl->ThreadInit = PS2AUDIO_ThreadInit;
impl->Deinitialize = PS2AUDIO_Deinitialize;
impl->OnlyHasDefaultOutputDevice = SDL_TRUE;
return SDL_TRUE; // this audio target is available.
}
AudioBootStrap PS2AUDIO_bootstrap = {
"ps2", "PS2 audio driver", PS2AUDIO_Init, SDL_FALSE
};
|
192fc4a154144dd34bcfa24a60cc66819fe5fcd8
|
94096248c1de2dcf46e69ca913cedfa290e44224
|
/tests/api/test-instanceof.c
|
86483787402492d28ad02d9a1135610b52293f7d
|
[
"LicenseRef-scancode-unknown-license-reference",
"MIT"
] |
permissive
|
svaarala/duktape
|
612110d1a6db46226c171cfd222974b1b3651ad5
|
5e169deafbbd12823665f5d30fb4c4c04e3dfa26
|
refs/heads/master
| 2023-08-06T16:43:33.014729
| 2022-11-17T21:02:08
| 2022-11-17T21:02:08
| 15,852,088
| 4,796
| 610
|
MIT
| 2023-09-11T17:13:01
| 2014-01-12T22:16:14
|
JavaScript
|
UTF-8
|
C
| false
| false
| 3,198
|
c
|
test-instanceof.c
|
/*
* duk_instanceof()
*/
/*===
*** test_1 (duk_safe_call)
0 instanceof 1: 1
0 instanceof 2: 1
0 instanceof 3: 0
0 instanceof 4: 1
0 instanceof 5: 0
final top: 6
==> rc=0, result='undefined'
*** test_2 (duk_safe_call)
==> rc=1, result='TypeError: invalid instanceof rval'
*** test_3a (duk_safe_call)
==> rc=1, result='RangeError: invalid stack index -1'
*** test_3b (duk_safe_call)
==> rc=1, result='RangeError: invalid stack index 0'
*** test_3c (duk_safe_call)
==> rc=1, result='RangeError: invalid stack index 1'
*** test_3d (duk_safe_call)
==> rc=1, result='RangeError: invalid stack index 0'
*** test_3e (duk_safe_call)
==> rc=1, result='RangeError: invalid stack index -2147483648'
===*/
/* Basic test. */
static duk_ret_t test_1(duk_context *ctx, void *udata) {
int i;
(void) udata;
duk_eval_string(ctx, "new RangeError('test error')"); /* 0 */
duk_eval_string(ctx, "Error"); /* 1 */
duk_eval_string(ctx, "RangeError"); /* 2 */
duk_eval_string(ctx, "TypeError"); /* 3 */
duk_eval_string(ctx, "Object"); /* 4 */
duk_eval_string(ctx, "Function"); /* 5 */
for (i = 1; i <= 5; i++) {
printf("0 instanceof %d: %d\n", i, (int) duk_instanceof(ctx, 0, i));
}
printf("final top: %ld\n", (long) duk_get_top(ctx));
return 0;
}
/* duk_instanceof() inherits the ECMAScript type requirements for lval and rval.
* In particular, rval must be a -callable- object. Here, for example, trying
* to do the equivalent of: "new Error() instanceof new Error()" is a TypeError
* because the rval is a non-callable object.
*/
static duk_ret_t test_2(duk_context *ctx, void *udata) {
(void) udata;
duk_eval_string(ctx, "new Error('test error')");
duk_instanceof(ctx, 0, 0); /* -> TypeError */
printf("final top: %ld\n", (long) duk_get_top(ctx));
return 0;
}
/* Strict behavior is also used for indices to match the strictness of
* instanceof. (This differs from e.g. duk_equals() on purpose.)
*/
static duk_ret_t test_3a(duk_context *ctx, void *udata) {
(void) udata;
printf("%d\n", duk_instanceof(ctx, -1, 0)); /* -1 is out of stack */
printf("final top: %ld\n", (long) duk_get_top(ctx));
return 0;
}
static duk_ret_t test_3b(duk_context *ctx, void *udata) {
(void) udata;
printf("%d\n", duk_instanceof(ctx, 0, -1)); /* -1 is out of stack */
printf("final top: %ld\n", (long) duk_get_top(ctx));
return 0;
}
static duk_ret_t test_3c(duk_context *ctx, void *udata) {
(void) udata;
printf("%d\n", duk_instanceof(ctx, 1, 0)); /* 1 is out of stack */
printf("final top: %ld\n", (long) duk_get_top(ctx));
return 0;
}
static duk_ret_t test_3d(duk_context *ctx, void *udata) {
(void) udata;
printf("%d\n", duk_instanceof(ctx, 0, 1)); /* 1 is out of stack */
printf("final top: %ld\n", (long) duk_get_top(ctx));
return 0;
}
static duk_ret_t test_3e(duk_context *ctx, void *udata) {
(void) udata;
printf("%d\n", duk_instanceof(ctx, DUK_INVALID_INDEX, DUK_INVALID_INDEX));
printf("final top: %ld\n", (long) duk_get_top(ctx));
return 0;
}
void test(duk_context *ctx) {
TEST_SAFE_CALL(test_1);
TEST_SAFE_CALL(test_2);
TEST_SAFE_CALL(test_3a);
TEST_SAFE_CALL(test_3b);
TEST_SAFE_CALL(test_3c);
TEST_SAFE_CALL(test_3d);
TEST_SAFE_CALL(test_3e);
}
|
d0a17fe682511d4dd8b543212ef4c13282872af4
|
fbef550c1f0206aac0582a58f7e3db945f442a9a
|
/Pods/Sentry/Sources/SentryCrash/Recording/Tools/SentryCrashFileUtils.h
|
1218e645c45c3a6131f475df70f8cbd8a8a77fc7
|
[
"MIT"
] |
permissive
|
Hammerspoon/hammerspoon
|
0f03b4dd2ef3b44ea4c0a1cd0b94fcb513b5f2b7
|
0ccc9d07641a660140d1d2f05b76f682b501a0e8
|
refs/heads/master
| 2023-08-19T01:26:41.898873
| 2023-06-20T22:52:50
| 2023-06-20T22:52:50
| 24,956,772
| 11,379
| 676
|
MIT
| 2023-06-09T02:51:33
| 2014-10-08T19:24:44
|
Objective-C
|
UTF-8
|
C
| false
| false
| 7,879
|
h
|
SentryCrashFileUtils.h
|
//
// SentryCrashFileUtils.h
//
// Created by Karl Stenerud on 2012-01-28.
//
// Copyright (c) 2012 Karl Stenerud. 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 remain in place
// in this source code.
//
// 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.
//
/* Basic file reading/writing functions.
*/
#ifndef HDR_SentryCrashFileUtils_h
#define HDR_SentryCrashFileUtils_h
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
#include <stdbool.h>
#define SentryCrashFU_MAX_PATH_LENGTH 500
/** Get the last entry in a file path. Assumes UNIX style separators.
*
* @param path The file path.
*
* @return the last entry in the path.
*/
const char *sentrycrashfu_lastPathEntry(const char *path);
/** Write bytes to a file descriptor.
*
* @param fd The file descriptor.
*
* @param bytes Buffer containing the bytes.
*
* @param length The number of bytes to write.
*
* @return true if the operation was successful.
*/
bool sentrycrashfu_writeBytesToFD(const int fd, const char *bytes, int length);
/** Read bytes from a file descriptor.
*
* @param fd The file descriptor.
*
* @param bytes Buffer to store the bytes in.
*
* @param length The number of bytes to read.
*
* @return true if the operation was successful.
*/
bool sentrycrashfu_readBytesFromFD(const int fd, char *bytes, int length);
/** Read an entire file. Returns a buffer of file size + 1, null terminated.
*
* @param path The path to the file.
*
* @param data Place to store a pointer to the loaded data (must be freed).
*
* @param length Place to store the length of the loaded data (can be NULL).
*
* @param maxLength the maximum amount of bytes to read. It will skip beginning
* bytes if necessary, and always get the latter part of the
* file. 0 = no maximum.
*
* @return true if the operation was successful.
*/
bool sentrycrashfu_readEntireFile(const char *path, char **data, int *length, int maxLength);
/** Write a string to a file.
*
* @param fd The file descriptor.
*
* @param string The string to write.
*
* @return true if successful.
*/
bool sentrycrashfu_writeStringToFD(const int fd, const char *string);
/** Write a formatted string to a file.
*
* @param fd The file descriptor.
*
* @param fmt The format specifier, followed by its arguments.
*
* @return true if successful.
*/
bool sentrycrashfu_writeFmtToFD(const int fd, const char *fmt, ...);
/** Write a formatted string to a file.
*
* @param fd The file descriptor.
*
* @param fmt The format specifier.
*
* @param args The arguments list.
*
* @return true if successful.
*/
bool sentrycrashfu_writeFmtArgsToFD(const int fd, const char *fmt, va_list args);
/** Read a single line from a file.
*
* @param fd The file descriptor.
*
* @param buffer The buffer to read into.
*
* @param maxLength The maximum length to read.
*
* @return The number of bytes read.
*/
int sentrycrashfu_readLineFromFD(const int fd, char *buffer, int maxLength);
/** Make all directories in a path.
*
* @param absolutePath The full, absolute path to create.
*
* @return true if successful.
*/
bool sentrycrashfu_makePath(const char *absolutePath);
/** Remove a file or directory.
*
* @param path Path to the file to remove.
*
* @param mustExist If true, and the path doesn't exist, log an error.
*
* @return true if successful.
*/
bool sentrycrashfu_removeFile(const char *path, bool mustExist);
/** Delete the contents of a directory.
*
* @param path The path of the directory whose contents to delete.
*
* @return true if successful.
*/
bool sentrycrashfu_deleteContentsOfPath(const char *path);
/** Buffered writer structure. Everything inside should be considered internal
* use only. */
typedef struct {
char *buffer;
int bufferLength;
int position;
int fd;
} SentryCrashBufferedWriter;
/** Open a file for buffered writing.
*
* @param writer The writer to initialize.
*
* @param path The path of the file to open.
*
* @param writeBuffer Memory to use as the write buffer.
*
* @param writeBufferLength Length of the memory to use as the write buffer.
*
* @return True if the file was successfully opened.
*/
bool sentrycrashfu_openBufferedWriter(SentryCrashBufferedWriter *writer, const char *const path,
char *writeBuffer, int writeBufferLength);
/** Close a buffered writer.
*
* @param writer The writer to close.
*/
void sentrycrashfu_closeBufferedWriter(SentryCrashBufferedWriter *writer);
/** Write to a buffered writer.
*
* @param writer The writer to write to.
*
* @param data The data to write.
*
* @param length The length of the data to write.
*
* @return True if the data was successfully written.
*/
bool sentrycrashfu_writeBufferedWriter(
SentryCrashBufferedWriter *writer, const char *restrict const data, const int length);
/** Flush a buffered writer, writing all uncommitted data to disk.
*
* @param writer The writer to flush.
*
* @return True if the buffer was successfully flushed.
*/
bool sentrycrashfu_flushBufferedWriter(SentryCrashBufferedWriter *writer);
/** Buffered reader structure. Everything inside should be considered internal
* use only. */
typedef struct {
char *buffer;
int bufferLength;
int dataStartPos;
int dataEndPos;
int fd;
} SentryCrashBufferedReader;
/** Open a file for buffered reading.
*
* @param reader The reader to initialize.
*
* @param path The path to the file to open.
*
* @param readBuffer The memory to use for buffered reading.
*
* @param readBufferLength The length of the memory to use for buffered reading.
*
* @return True if the file was successfully opened.
*/
bool sentrycrashfu_openBufferedReader(SentryCrashBufferedReader *reader, const char *const path,
char *readBuffer, int readBufferLength);
/** Close a buffered reader.
*
* @param reader The reader to close.
*/
void sentrycrashfu_closeBufferedReader(SentryCrashBufferedReader *reader);
/** Read from a buffered reader.
*
* @param reader The reader to read from.
*
* @param dstBuffer The buffer to read into.
*
* @param byteCount The number of bytes to read.
*
* @return The number of bytes actually read.
*/
int sentrycrashfu_readBufferedReader(
SentryCrashBufferedReader *reader, char *dstBuffer, int byteCount);
/** Read from a buffered reader until the specified character is encountered.
* All bytes up to and including the character will be read.
*
* @param reader The reader to read from.
*
* @param ch The character to look for.
*
* @param dstBuffer The buffer to read into.
*
* @param length in: The maximum number of bytes to read before giving up the
* search. out: The actual number of bytes read.
*
* @return True if the character was found before giving up.
*/
bool sentrycrashfu_readBufferedReaderUntilChar(
SentryCrashBufferedReader *reader, int ch, char *dstBuffer, int *length);
#ifdef __cplusplus
}
#endif
#endif // HDR_SentryCrashFileUtils_h
|
8f75b0980cfd5ab834d198eccea85a75a5620fea
|
3c76f1d8d548863f4a92209da9758c3f86ac5b72
|
/tests/fail-incompatible.c
|
57446a4e9dc855ec70a72bbdf406b7c081abfd6d
|
[
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
P-p-H-d/mlib
|
57ba169f11dbaf425b6b87c24b654df1e67a5af0
|
469239adcd1c37f09e208b7c09fe7f749de84892
|
refs/heads/master
| 2023-09-04T11:07:23.155619
| 2023-08-24T21:32:47
| 2023-08-24T21:32:47
| 82,404,078
| 749
| 67
|
BSD-2-Clause
| 2023-06-13T21:46:59
| 2017-02-18T17:35:25
|
C
|
UTF-8
|
C
| false
| false
| 7,139
|
c
|
fail-incompatible.c
|
/*
* Copyright (c) 2017-2023, Patrick Pelissier
* 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.
*
* 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 AND 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.
*/
/* The goal of this test file is to check that invalid constructs
are properly rejected, and that it generates a helpfull error
message in this case.
It tests incompatible type and oplist.
*/
#include "m-core.h"
// The test is only robust in C11 mode.
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
#if !defined(TEST)
# warning Please define TEST variable to select the test to run
#elif TEST == 1
#include "m-array.h"
ARRAY_DEF(array, int)
ARRAY_DEF(array2, int)
ARRAY_DEF(array3, array_t, ARRAY_OPLIST(array2, M_BASIC_OPLIST))
#elif TEST == 2
#include "m-list.h"
LIST_DEF(list, int)
LIST_DEF(list2, int)
LIST_DEF(list3, list_t, LIST_OPLIST(list2, M_BASIC_OPLIST))
#elif TEST == 3
#include "m-deque.h"
DEQUE_DEF(deque, int)
DEQUE_DEF(deque2, int)
DEQUE_DEF(deque3, deque_t, DEQUE_OPLIST(deque2, M_BASIC_OPLIST))
#elif TEST == 4
#include "m-bptree.h"
BPTREE_DEF(bptree, 4, int)
BPTREE_DEF(bptree2, 4, int)
BPTREE_DEF(bptree3, 5, bptree_t, BPTREE_OPLIST(bptree2, M_BASIC_OPLIST))
#elif TEST == 5
#include "m-bptree.h"
BPTREE_DEF2(bptree, 4, int, int)
BPTREE_DEF2(bptree2, 4, int, int)
BPTREE_DEF2(bptree3, 5, bptree_t, BPTREE_OPLIST2(bptree2, M_BASIC_OPLIST, M_BASIC_OPLIST), int, M_BASIC_OPLIST)
#elif TEST == 6
#include "m-bptree.h"
BPTREE_DEF2(bptree, 4, int, int)
BPTREE_DEF2(bptree2, 4, int, int)
BPTREE_DEF2(bptree3, 5, bptree_t, BPTREE_OPLIST2(bptree2, M_BASIC_OPLIST, M_BASIC_OPLIST), int, M_BASIC_OPLIST)
#elif TEST == 7
#include "m-buffer.h"
BUFFER_DEF(buffer, int, 4, BUFFER_THREAD_UNSAFE)
BUFFER_DEF(buffer2, int, 4, BUFFER_THREAD_UNSAFE)
BUFFER_DEF(buffer3, buffer_t, 5, BUFFER_QUEUE, BUFFER_OPLIST(buffer2, M_BASIC_OPLIST))
#elif TEST == 8
#include "m-array.h"
#include "m-concurrent.h"
ARRAY_DEF(array, int)
ARRAY_DEF(array2, int)
CONCURRENT_DEF(array3, array_t, ARRAY_OPLIST(array2, M_BASIC_OPLIST))
#elif TEST == 9
#include "m-dict.h"
DICT_DEF2(dict, int, int)
DICT_DEF2(dict2, int, int)
DICT_DEF2(dict3, int, M_BASIC_OPLIST, dict_t, DICT_OPLIST(dict2, M_BASIC_OPLIST, M_BASIC_OPLIST) )
#elif TEST == 10
#include "m-dict.h"
DICT_STOREHASH_DEF2(dict, int, int)
DICT_STOREHASH_DEF2(dict2, int, int)
DICT_STOREHASH_DEF2(dict3, int, M_BASIC_OPLIST, dict_t, DICT_OPLIST(dict2, M_BASIC_OPLIST, M_BASIC_OPLIST) )
#elif TEST == 11
#include "m-dict.h"
#include "m-array.h"
ARRAY_DEF(array, int)
ARRAY_DEF(array2, int)
DICT_SET_DEF(dict, array_t, ARRAY_OPLIST(array2, M_BASIC_OPLIST) )
#elif TEST == 12
#include "m-i-list.h"
#include "m-concurrent.h"
typedef struct tmp_str_s {
ILIST_INTERFACE(tmpstr, struct tmp_str_s);
int n;
} tmp_str_t;
ILIST_DEF(tmpstr, tmp_str_t, (TYPE(struct toto), CLEAR(M_NOTHING_DEFAULT)))
#elif TEST == 13
#include "m-i-shared.h"
#include "m-concurrent.h"
typedef struct tmp_str_s {
ISHARED_PTR_INTERFACE(tmpstr, struct tmp_str_s);
int n;
} tmp_str_t;
ISHARED_PTR_DEF(tmpstr, tmp_str_t, (TYPE(struct toto), CLEAR(M_NOTHING_DEFAULT)))
#elif TEST == 14
#include "m-prioqueue.h"
PRIOQUEUE_DEF(prioqueue, int)
PRIOQUEUE_DEF(prioqueue2, int)
PRIOQUEUE_DEF(prioqueue3, prioqueue_t, PRIOQUEUE_OPLIST(prioqueue2, M_BASIC_OPLIST ))
#elif TEST == 15
#include "m-rbtree.h"
RBTREE_DEF(rbtree, int)
RBTREE_DEF(rbtree2, int)
RBTREE_DEF(rbtree3, rbtree_t, RBTREE_OPLIST(rbtree2, M_BASIC_OPLIST))
#elif TEST == 16
#include "m-shared.h"
SHARED_PTR_DEF(shared, int)
SHARED_PTR_DEF(shared2, int)
SHARED_PTR_DEF(shared3, shared_t, SHARED_PTR_OPLIST(shared2, M_BASIC_OPLIST))
#elif TEST == 17
#include "m-snapshot.h"
SNAPSHOT_SPSC_DEF(shared, int)
SNAPSHOT_SPSC_DEF(shared2, int)
SNAPSHOT_SPSC_DEF(shared3, shared_t, SNAPSHOT_OPLIST(shared2, M_BASIC_OPLIST))
#elif TEST == 18
#include "m-snapshot.h"
SNAPSHOT_SPMC_DEF(shared, int)
SNAPSHOT_SPMC_DEF(shared2, int)
SNAPSHOT_SPMC_DEF(shared3, shared_t, SNAPSHOT_OPLIST(shared2, M_BASIC_OPLIST))
#elif TEST == 19
#include "m-snapshot.h"
SNAPSHOT_MPMC_DEF(shared, int)
SNAPSHOT_MPMC_DEF(shared2, int)
SNAPSHOT_MPMC_DEF(shared3, shared_t, SNAPSHOT_OPLIST(shared2, M_BASIC_OPLIST))
#elif TEST == 20
#include "m-tuple.h"
TUPLE_DEF2(aggregate, (x, int), (z, float))
TUPLE_DEF2(aggregate2, (x, int), (z, float))
TUPLE_DEF2(struct2,
(a, aggregate_t, TUPLE_OPLIST(aggregate, M_BASIC_OPLIST, M_BASIC_OPLIST)),
(b, aggregate_t, TUPLE_OPLIST(aggregate2, M_BASIC_OPLIST, M_BASIC_OPLIST))
)
#elif TEST == 21
#include "m-tuple.h"
TUPLE_DEF2(aggregate, (x, int), (z, float))
TUPLE_DEF2(aggregate2, (x, int), (z, float))
TUPLE_DEF2(struct2,
(a, aggregate_t, TUPLE_OPLIST(aggregate2, M_BASIC_OPLIST, M_BASIC_OPLIST)),
(b, aggregate_t, TUPLE_OPLIST(aggregate, M_BASIC_OPLIST, M_BASIC_OPLIST))
)
#elif TEST == 22
#include "m-variant.h"
VARIANT_DEF2(aggregate, (x, int), (z, float))
VARIANT_DEF2(aggregate2, (x, int), (z, float))
VARIANT_DEF2(struct2,
(a, aggregate_t, VARIANT_OPLIST(aggregate, M_BASIC_OPLIST, M_BASIC_OPLIST)),
(b, aggregate_t, VARIANT_OPLIST(aggregate2, M_BASIC_OPLIST, M_BASIC_OPLIST))
)
#elif TEST == 23
#include "m-variant.h"
VARIANT_DEF2(aggregate, (x, int), (z, float))
VARIANT_DEF2(aggregate2, (x, int), (z, float))
VARIANT_DEF2(struct2,
(a, aggregate_t, VARIANT_OPLIST(aggregate2, M_BASIC_OPLIST, M_BASIC_OPLIST)),
(b, aggregate_t, VARIANT_OPLIST(aggregate, M_BASIC_OPLIST, M_BASIC_OPLIST))
)
#elif TEST == 24
#include "m-array.h"
#include "m-funcobj.h"
ARRAY_DEF(array, int)
ARRAY_DEF(array2, int)
FUNC_OBJ_ITF_DEF(itf, int, int)
FUNC_OBJ_INS_DEF(ins, itf, (x), {
return x ;
},
(a, array_t, ARRAY_OPLIST(array)),
(b, array_t, ARRAY_OPLIST(array2)))
#else
# warning TEST variable is out of range.
#endif
#else
#error Test shall be run in C11 mode.
#endif
|
bac45c6a9d1b680e66622c9d9d075bc89c44c122
|
0744dcc5394cebf57ebcba343747af6871b67017
|
/os/board/rtl8730e/src/component/usb/host_new/cdc_ecm/usbh_cdc_ecm_hal.h
|
750b835e2b0128973150eae22c403c12e01c1816
|
[
"Apache-2.0",
"GPL-1.0-or-later",
"BSD-3-Clause",
"ISC",
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-permissive"
] |
permissive
|
Samsung/TizenRT
|
96abf62f1853f61fcf91ff14671a5e0c6ca48fdb
|
1a5c2e00a4b1bbf4c505bbf5cc6a8259e926f686
|
refs/heads/master
| 2023-08-31T08:59:33.327998
| 2023-08-08T06:09:20
| 2023-08-31T04:38:20
| 82,517,252
| 590
| 719
|
Apache-2.0
| 2023-09-14T06:54:49
| 2017-02-20T04:38:30
|
C
|
UTF-8
|
C
| false
| false
| 1,521
|
h
|
usbh_cdc_ecm_hal.h
|
/**
******************************************************************************
* The header file for usbh_cdc_ecm_hal.c
*
* This module is a confidential and proprietary property of RealTek and
* possession or use of this module requires written permission of RealTek.
*
* Copyright(c) 2023, Realtek Semiconductor Corporation. All rights reserved.
******************************************************************************
*/
#ifndef USBH_CDC_ECM_HAL_H
#define USBH_CDC_ECM_HAL_H
/* Includes ------------------------------------------------------------------*/
/* Exported defines ----------------------------------------------------------*/
/* */
/* Exported types ------------------------------------------------------------*/
typedef void (*usb_report_usbdata)(u8 *buf, u32 len);
/* Exported macros -----------------------------------------------------------*/
/* Exported variables --------------------------------------------------------*/
/* Exported functions --------------------------------------------------------*/
u8 usbh_cdc_ecm_do_init(usb_report_usbdata cb_handle);
u8 usbh_cdc_ecm_do_deinit(void);
const u8 *usbh_cdc_ecm_process_mac_str(void);
u8 usbh_cdc_ecm_senddata(u8 *buf, u32 len);
u8 usbh_cdc_ecm_get_sendflag(void);
u8 usbh_cdc_ecm_get_connect_status(void);
u16 usbh_cdc_ecm_get_receive_mps(void);
//u8 set_usbh_cdc_ecm_data_report_func(usb_report_usbdata handle);
#endif /* USBH_CDC_ECM_HAL_H */
|
5fe21ab8754a282e71271821c120125390f4483e
|
e62d77c7a56a04e73b1bb8f8759afa0e37d1cb41
|
/ArtemisPS3-PRX/inc/vsh.h
|
2765cc6f92fd2c0b3a7f1f4b2c27b6a6d3901138
|
[
"MIT"
] |
permissive
|
bucanero/ArtemisPS3
|
29ef96ecaf5cefafd8778ebe7bafc310ea7c3f1b
|
50dac6e00550931e8148218822faf8ff11a0877f
|
refs/heads/master
| 2023-01-10T18:12:22.778543
| 2022-12-20T21:52:36
| 2022-12-20T21:52:36
| 224,701,674
| 137
| 44
|
MIT
| 2022-05-16T20:04:32
| 2019-11-28T17:32:59
|
C
|
UTF-8
|
C
| false
| false
| 6,141
|
h
|
vsh.h
|
#ifndef __VSH_H__
#define __VSH_H__
// vsh_015910A0 // ? Pool_Destroy()
// vsh_01DFD97E // ?
// vsh_0D5CCC40 // ? int_sys_fs_fcntl...
// vsh_0F48562D // ?
// vsh_0F80B71F // ?
// vsh_13A5BE24 // ?
// vsh_145991B4 // AIMManagerIF: 0x19002 (Get Device Type)
extern int vsh_1714D098(uint32_t *size); // sys_fs_get_mount_info_size()
#define sys_fs_get_mount_info_size vsh_1714D098
extern int vsh_172B05CD(uint32_t offset, uint8_t value); // UpdateManagerIF_WriteEEPROM()
#define UpdateManagerIF_WriteEEPROM vsh_172B05CD
// vsh_18EF767F // ?
// vsh_196DB98B // SecureRTCManagerIF_SetRTC
// vsh_1B890AD2 // UpdateManagerIF_GetTokenSeed
extern int vsh_1B8D4287(const char *dir); // sys_fs_sync, Param: Device Path (e.g. /dev_hdd0)
#define sys_fs_sync vsh_1B8D4287
// vsh_1C68CC75 // ?
// vsh_1EAC97C3 // ?
// vsh_1F80C608 // UpdateManagerIF_GetFixInstruction
// vsh_1F80E287 // AIMManagerIF: 0x19002 (Get Device Type)
// vsh_20215547 // ? file check/load
// vsh_2068CBF3 // sys_ss_get_boot_device
// vsh_233791FE // ? sys_fs_mount
// vsh_26709B91 // StorageManagerIF_AuthenticateBDDrive
// vsh_278A6AF7 // ?
// vsh_2A91BB1D // UpdateManagerIF_ExtractPackageTophalf
// vsh_2B58A92C // StorageManagerIF_AuthenticatePS3Game
extern int vsh_2C563C92(uint32_t offset, uint8_t *value); // UpdateManagerIF_ReadEEPROM()
#define UpdateManagerIF_ReadEEPROM vsh_2C563C92
// vsh_3065B3C3 // GamesaveStorageManagerIF_0x08
// vsh_3231E012 // VTRMManagerIF_DecryptMaster
// vsh_339A7508 // ? (char const* mount, int ?) -> sys_fs_unmount(char const* mount, int, int 1)
// vsh_33ACD759 // ? (char const* mount, int ?) -> sys_fs_unmount(char const* mount, int, int 0)
// vsh_3473377C // ?
// vsh_349F1535 // UpdateManagerIF_SetToken
// vsh_37857F3F // create_vsh_memory_container_by_id (int id)
// vsh_38565603 // GamesaveStorageManagerIF_0x0B
// vsh_38EA9A58 // ?
// vsh_3AE8D802 // UpdateManagerIF_InspectPackageTophalf
// vsh_3B4A1AC4 // AIMManagerIF_GetDeviceID
// vsh_3C186420 // ?
// vsh_3F062337 // AIMManagerIF_GetPSCode
// vsh_40E51FD1 // (void) return 0
// vsh_42FEA6FB // UpdateManagerIF_GetPackageInfo
// vsh_44F4A936 // ?
// vsh_47FB5A92 // GamesaveStorageManagerIF_0x05
// vsh_489102C6 // sys_ss_random_number_generator_2
// vsh_4B0523C4 // ? io_kb_
// vsh_4CE8E544 // ?
// vsh_4DB8DD87 // ?
// vsh_4F3A5866 // StorageManagerIF_control_bd_drive_HW_ps3_disc_change
// vsh_4FD63C1D // VTRMManagerIF_Encrypt
// vsh_50C2962C // VTRMManagerIF_Retrieve
// vsh_535A7222 // GamesaveStorageManagerIF_0x02
// vsh_53E57474 // ? (char const* mount, int ?) -> sys_fs_unmount(char const* mount, int, int 1)
// vsh_55C6366A // ?
// vsh_5649626F // ? io_kb_
// vsh_5A351A0A // GamesaveStorageManagerIF_0x13
// vsh_5C5D84C1 // ?
// vsh_609635AB // ?
// vsh_612496AA // sys_fs_get_mount_info(CellFsMountInformation *, unsigned long, unsigned long *)
// vsh_63F9074F // ?
// vsh_6B65C37C // GamesaveStorageManagerIF_0x0C
// vsh_6D840716 // GamesaveStorageManagerIF_0x0F
// vsh_703393A2 // sys_ss_access_control_engine
// vsh_71BBE625 // ?
// vsh_772E1A24 // VTRManagerIF_Store
// vsh_7C5A1812 // ?
// vsh_7CB16AA0 // GamesaveStorageManagerIF_0x12
// vsh_7D73E7CD // ?
// vsh_80F5B53C // Read EEPROM: 0x00048C07 (Product Mode flag)
// vsh_8443023A // ?
// vsh_8A86B77C // UpdateManagerrIF_AllocateBuffer
// vsh_8A9529BA // ?
// vsh_8AD55D80 // AIMManagerIF: 0x19002 (Get Device Type)
// vsh_8B0BC111 // VTRManagerIF_Free
// vsh_8BC98CB9 // ?
// vsh_8C4215ED // GamesaveStorageManagerIF_0x0D
// vsh_8E2AF83C // Write EEPROM: 0x00048C18 (System Language),
// vsh_8F29A4A4 // ?
// vsh_8F71C2DF // ?
// vsh_9121C0C6 // UpdateManagerIF_ReleaseBuffer
// vsh_91C2E500 // ?
// vsh_92A609B2 // Write EEPROM: 0x00048C42 (HDD Copy Mode)
// vsh_93A6A450 // GamesaveStorageManagerIF_0x0E
// vsh_986EC8D3 // StorageManagerIF_control_bd_drive_HW_ps3_disc_auth
// vsh_99A5F404 // StorageManagerIF_control_bd_drive_HW_ps3_hdd_game_auth
//extern int vsh_9AD2E524(u8 *open_psid[8]); // sys_ss_get_open_psid
// vsh_9AF9918E // SecureRTCManagerIF_SetTime
// vsh_9B1FEAA3 // VTRManagerIF_Encrypt_With_Portability
// vsh_9C279BCF // Read EEPROM: 0x00048C18 (System Language)
// vsh_9C4E9B5C // ? sys_fs_sync...
// vsh_9C6EEE24 // ?
// vsh_9FC0AA39 // ?
// vsh_A10195F4 // UpdateManagerIF_GetStatus
// vsh_A21246C2 // GamesaveStorageManagerIF_0x06
// vsh_A51FFBF9 // (void) return 0
// vsh_A79070D5 // VTRManagerIF_Decrypt
// vsh_ACDDC98E // (void) return 1
// vsh_AF44BFBF // return string "CELL_FS_UTILITY:HDD0"
// vsh_B517EC40 // ?
// vsh_B84451B2 // ? io_kb_
// vsh_C0A2CB93 // ?
// vsh_C0E39B97 // ?
// vsh_C13930A7 // GamesaveStorageManagerIF_0x12 (with r6 = 3)
// vsh_C85E47B8 // GamesaveStorageManagerIF_0x12 (with r5 = 0x42, with r6 = 3)
// vsh_CAA3E8E7 // SecureRTCManagerIF_GetTime
// vsh_CBF8BC6E // GamesaveStorageManagerIF_0x04
// vsh_CC31BBCF // sys_ss_random_number_generator_1
// vsh_CFD2CA7D // ? sys_fs_unmount...
// vsh_D42045F9 // return string "CELL_FS_UTILITY:HDD1"
// vsh_D477DB73 // ?
// vsh_D5B38646 // ?
// vsh_D68351F0 // ?
// vsh_DC2A512E // UpdateManagerIF_GetExtractPackage
// vsh_DC980E61 // sys_ss_get_cache_of_flash_ext_flag
// vsh_DDB635E1 // Write EEPROM: 0x00048C06 (FSELF Control Flag / toggles release mode)
// vsh_E20104BE // StorageManagerIF_control_bd_drive_HW_ps3_disc_auth_disc_id
// vsh_E35D54E3 // ?
// vsh_E413CD78 // sys_fs_disk_free
// vsh_E44F29F4 // ?
// vsh_E4A68606 // ?
// vsh_E65867F4 // UpdateManagerIF_UpdatePackageTophalf
extern int vsh_E7C34044(int mc_id); // vsh_memory_container_by_id()
#define vsh_memory_container_by_id vsh_E7C34044
// vsh_E836E451 // sys_get_cache_of_product_mode
// vsh_E932A8C0 // reboot_show_min_version
// vsh_ED372406 // Export_vsh_update_manager_if_get_token_seed
// vsh_ED9E5178 // ?
extern int vsh_F399CA36(int mc_id); // destroy_vsh_memory_container_by_id()
#define destroy_vsh_memory_container_by_id vsh_F399CA36
// vsh_F4AD1B8A // ?
// vsh_FE92A9D8 // GamesaveStorageManagerIF_0x07
// vsh_FF0309A5 // ?
// vsh_FF4A1633 // ?
#endif // __VSH_H__
|
6a60fa3eb07f8851a8c164c7a4844431b3aa2957
|
aa3befea459382dc5c01c925653d54f435b3fb0f
|
/boards/arm/samd5e5/metro-m4/scripts/nvm.c
|
d3c386d227ec789a2737bb6a24de851ef0b26c2b
|
[
"MIT-open-group",
"BSD-3-Clause",
"HPND-sell-variant",
"BSD-4-Clause-UC",
"LicenseRef-scancode-warranty-disclaimer",
"MIT-0",
"LicenseRef-scancode-bsd-atmel",
"LicenseRef-scancode-gary-s-brown",
"LicenseRef-scancode-proprietary-license",
"SunPro",
"MIT",
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-other-permissive",
"HPND",
"ISC",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"GPL-1.0-or-later",
"CC-BY-2.0",
"CC-BY-4.0"
] |
permissive
|
apache/nuttx
|
14519a7bff4a87935d94fb8fb2b19edb501c7cec
|
606b6d9310fb25c7d92c6f95bf61737e3c79fa0f
|
refs/heads/master
| 2023-08-25T06:55:45.822534
| 2023-08-23T16:03:31
| 2023-08-24T21:25:47
| 228,103,273
| 407
| 241
|
Apache-2.0
| 2023-09-14T18:26:05
| 2019-12-14T23:27:55
|
C
|
UTF-8
|
C
| false
| false
| 1,977
|
c
|
nvm.c
|
/****************************************************************************
* boards/arm/samd5e5/metro-m4/scripts/nvm.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <stdio.h>
#include <stdint.h>
const uint8_t nvm[20] =
{
0x14, /* Count 20 bytes */
0x80, 0x40, 0x00, /* 24-address : 804000 */
0x39, 0x92, 0x9a, 0xfe, 0x80, 0xff, 0xec, 0xae, /* 16-bytes of NVM data */
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
/****************************************************************************
* Public Functions
****************************************************************************/
int main(int argc, char **argv)
{
unsigned int csum;
int i;
printf("S2");
for (i = 0, csum = 0; i < 20; i++)
{
csum += nvm[i];
printf("%02X", (unsigned int)nvm[i]);
}
printf("%02X\r\n", ~csum & 0xff);
printf("S9030000FC\r\n");
return 0;
}
|
eb02bea044f119b48fb00296d5b323f037c7d68a
|
baebc58f60922dacf155483597c91a1fab090fc0
|
/src/common/XAssert.h
|
ab9b8c6ef1ae24ad85c26cbf3ca8e322767e6d40
|
[] |
no_license
|
jwcpp/jwEngine
|
87248ae3cf5c66e18c4914b9b05d94e4e6a56631
|
a02f21f6615cfc658e2321ca73fd38426b284378
|
refs/heads/master
| 2023-04-30T14:36:46.357396
| 2023-04-13T07:30:03
| 2023-04-13T07:30:03
| 222,865,696
| 309
| 79
| null | null | null | null |
UTF-8
|
C
| false
| false
| 245
|
h
|
XAssert.h
|
#pragma once
void IAssert(char const* file, int line, char const* function, char const* message, char const* format, ...);
#define XAssert(cond, ...) do { if (!(cond)) IAssert(__FILE__, __LINE__, __FUNCTION__, #cond, ##__VA_ARGS__); } while(0)
|
ffa7992eb724ee6de7b6ee9257d15922f6e52cee
|
f3eed0234b4d0ad2bbb2abd700cf1e2c7a0e8a1d
|
/AKWF-c/AKWF_bw_squ/AKWF_squ_0040.h
|
2d4ad46f797428fe2f7c7d4f2df0fb6d0eefec9d
|
[
"CC0-1.0"
] |
permissive
|
KristofferKarlAxelEkstrand/AKWF-FREE
|
b2defa1a2d389d309be6dd2e9f968923daf80d1b
|
cf8171df36e9fec25416b5f568b72a6e2cb69194
|
refs/heads/master
| 2023-07-23T18:22:36.939705
| 2023-07-10T17:14:40
| 2023-07-10T17:14:40
| 145,817,187
| 359
| 59
|
CC0-1.0
| 2023-07-10T17:14:41
| 2018-08-23T07:26:56
| null |
UTF-8
|
C
| false
| false
| 4,680
|
h
|
AKWF_squ_0040.h
|
/* Adventure Kid Waveforms (AKWF) converted for use with Teensy Audio Library
*
* Adventure Kid Waveforms(AKWF) Open waveforms library
* https://www.adventurekid.se/akrt/waveforms/adventure-kid-waveforms/
*
* This code is in the public domain, CC0 1.0 Universal (CC0 1.0)
* https://creativecommons.org/publicdomain/zero/1.0/
*
* Converted by Brad Roy, https://github.com/prosper00
*/
/* AKWF_squ_0040 256 samples
+-----------------------------------------------------------------------------------------------------------------+
|****** |
| ***** |
| ***** |
| **** |
| * |
| * |
| * |
| * |
| * |
| * |
| * |
| * **************************************|
| * ************************** |
| * ***************** |
| * ************* |
+-----------------------------------------------------------------------------------------------------------------+
*/
const uint16_t AKWF_squ_0040 [] = {
36842, 60137, 65535, 64181, 64816, 63667, 63978, 63032, 63211, 62381, 62470, 61740, 61744, 61111, 61026, 60499,
60321, 59895, 59630, 59303, 58951, 58721, 58282, 58149, 57629, 57582, 56996, 57018, 56377, 56461, 55769, 55910,
55177, 55365, 54594, 54844, 53958, 54593, 49501, 25865, 19446, 21125, 20279, 21143, 20632, 21292, 20930, 21468,
21208, 21652, 21472, 21838, 21730, 22025, 21982, 22210, 22226, 22397, 22461, 22588, 22689, 22779, 22906, 22971,
23119, 23164, 23320, 23359, 23517, 23553, 23707, 23745, 23893, 23936, 24072, 24125, 24248, 24311, 24422, 24493,
24594, 24672, 24763, 24846, 24929, 25017, 25094, 25184, 25257, 25347, 25418, 25507, 25577, 25664, 25733, 25818,
25888, 25970, 26039, 26119, 26189, 26265, 26335, 26407, 26479, 26550, 26619, 26689, 26759, 26825, 26893, 26960,
27026, 27091, 27157, 27222, 27286, 27350, 27412, 27474, 27536, 27597, 27658, 27719, 27778, 27838, 27897, 27955,
28013, 28071, 28127, 28184, 28240, 28295, 28348, 28403, 28456, 28510, 28562, 28614, 28667, 28718, 28768, 28818,
28868, 28918, 28966, 29016, 29063, 29112, 29158, 29205, 29252, 29298, 29344, 29389, 29434, 29478, 29522, 29566,
29609, 29651, 29694, 29736, 29778, 29819, 29860, 29897, 29938, 29977, 30016, 30056, 30095, 30133, 30170, 30208,
30245, 30281, 30318, 30355, 30389, 30426, 30460, 30496, 30529, 30564, 30598, 30631, 30666, 30698, 30730, 30762,
30794, 30827, 30858, 30889, 30919, 30950, 30979, 31010, 31040, 31068, 31097, 31125, 31153, 31181, 31210, 31238,
31266, 31292, 31320, 31345, 31372, 31398, 31423, 31449, 31474, 31499, 31524, 31547, 31574, 31597, 31622, 31645,
31668, 31691, 31714, 31737, 31758, 31781, 31802, 31825, 31845, 31869, 31887, 31910, 31928, 31951, 31967, 31992,
32006, 32031, 32045, 32068, 32083, 32106, 32120, 32145, 32158, 32179, 32198, 32214, 32243, 32248, 32288, 32284,
};
|
3d9a7b2d4e027fb1f3fe105a19c455c8a72582dc
|
010279e2ba272d09e9d2c4e903722e5faba2cf7a
|
/contrib/tools/python3/src/Modules/clinic/_weakref.c.h
|
541cba75e6813c8c2ea8ebefc390ba9b04e88021
|
[
"LicenseRef-scancode-python-cwi",
"LicenseRef-scancode-other-copyleft",
"Python-2.0",
"BSD-3-Clause",
"0BSD",
"GPL-1.0-or-later",
"LicenseRef-scancode-free-unknown",
"Apache-2.0"
] |
permissive
|
catboost/catboost
|
854c1a1f439a96f1ae6b48e16644be20aa04dba2
|
f5042e35b945aded77b23470ead62d7eacefde92
|
refs/heads/master
| 2023-09-01T12:14:14.174108
| 2023-09-01T10:01:01
| 2023-09-01T10:22:12
| 97,556,265
| 8,012
| 1,425
|
Apache-2.0
| 2023-09-11T03:32:32
| 2017-07-18T05:29:04
|
Python
|
UTF-8
|
C
| false
| false
| 3,266
|
h
|
_weakref.c.h
|
/*[clinic input]
preserve
[clinic start generated code]*/
PyDoc_STRVAR(_weakref_getweakrefcount__doc__,
"getweakrefcount($module, object, /)\n"
"--\n"
"\n"
"Return the number of weak references to \'object\'.");
#define _WEAKREF_GETWEAKREFCOUNT_METHODDEF \
{"getweakrefcount", (PyCFunction)_weakref_getweakrefcount, METH_O, _weakref_getweakrefcount__doc__},
static Py_ssize_t
_weakref_getweakrefcount_impl(PyObject *module, PyObject *object);
static PyObject *
_weakref_getweakrefcount(PyObject *module, PyObject *object)
{
PyObject *return_value = NULL;
Py_ssize_t _return_value;
_return_value = _weakref_getweakrefcount_impl(module, object);
if ((_return_value == -1) && PyErr_Occurred()) {
goto exit;
}
return_value = PyLong_FromSsize_t(_return_value);
exit:
return return_value;
}
PyDoc_STRVAR(_weakref__remove_dead_weakref__doc__,
"_remove_dead_weakref($module, dct, key, /)\n"
"--\n"
"\n"
"Atomically remove key from dict if it points to a dead weakref.");
#define _WEAKREF__REMOVE_DEAD_WEAKREF_METHODDEF \
{"_remove_dead_weakref", _PyCFunction_CAST(_weakref__remove_dead_weakref), METH_FASTCALL, _weakref__remove_dead_weakref__doc__},
static PyObject *
_weakref__remove_dead_weakref_impl(PyObject *module, PyObject *dct,
PyObject *key);
static PyObject *
_weakref__remove_dead_weakref(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *dct;
PyObject *key;
if (!_PyArg_CheckPositional("_remove_dead_weakref", nargs, 2, 2)) {
goto exit;
}
if (!PyDict_Check(args[0])) {
_PyArg_BadArgument("_remove_dead_weakref", "argument 1", "dict", args[0]);
goto exit;
}
dct = args[0];
key = args[1];
return_value = _weakref__remove_dead_weakref_impl(module, dct, key);
exit:
return return_value;
}
PyDoc_STRVAR(_weakref_getweakrefs__doc__,
"getweakrefs($module, object, /)\n"
"--\n"
"\n"
"Return a list of all weak reference objects pointing to \'object\'.");
#define _WEAKREF_GETWEAKREFS_METHODDEF \
{"getweakrefs", (PyCFunction)_weakref_getweakrefs, METH_O, _weakref_getweakrefs__doc__},
PyDoc_STRVAR(_weakref_proxy__doc__,
"proxy($module, object, callback=None, /)\n"
"--\n"
"\n"
"Create a proxy object that weakly references \'object\'.\n"
"\n"
"\'callback\', if given, is called with a reference to the\n"
"proxy when \'object\' is about to be finalized.");
#define _WEAKREF_PROXY_METHODDEF \
{"proxy", _PyCFunction_CAST(_weakref_proxy), METH_FASTCALL, _weakref_proxy__doc__},
static PyObject *
_weakref_proxy_impl(PyObject *module, PyObject *object, PyObject *callback);
static PyObject *
_weakref_proxy(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
PyObject *object;
PyObject *callback = NULL;
if (!_PyArg_CheckPositional("proxy", nargs, 1, 2)) {
goto exit;
}
object = args[0];
if (nargs < 2) {
goto skip_optional;
}
callback = args[1];
skip_optional:
return_value = _weakref_proxy_impl(module, object, callback);
exit:
return return_value;
}
/*[clinic end generated code: output=f4be6b8177fbceb8 input=a9049054013a1b77]*/
|
ece18d492c5c56c0f71ac4578594657f76ac1b78
|
19a9f2c19bcb81c4a14ba17831d3098de7731fb5
|
/ni/src/examples/contourplot/cn04c.c
|
5a367899d197717fe01703c3289812086f34a9e0
|
[
"Apache-2.0"
] |
permissive
|
NCAR/ncl
|
243c30eaefce642d53373aa583b73df72eb59f22
|
8a96101fe14d0cf0f5ed66a5e6b1733084bc69df
|
refs/heads/develop
| 2023-03-17T07:53:18.883458
| 2022-05-11T16:01:03
| 2022-05-11T16:01:03
| 67,087,395
| 254
| 68
|
NOASSERTION
| 2022-10-08T07:20:06
| 2016-09-01T01:34:28
|
C
|
UTF-8
|
C
| false
| false
| 13,724
|
c
|
cn04c.c
|
/*
* $Id: cn04c.c,v 1.9 2010-03-15 22:49:23 haley Exp $
*/
/************************************************************************
* *
* Copyright (C) 1993 *
* University Corporation for Atmospheric Research *
* All Rights Reserved *
* *
************************************************************************/
/*
* File: cn04c.c
*
* Author: David Brown
* National Center for Atmospheric Research
* PO 3000, Boulder, Colorado
*
* Date: Wed Oct 12 13:18:13 MDT 1994
*
* Description: Emulates the output of the Conpack example 'cpex02.f'
* using the HLU library.
*/
#include <stdio.h>
#include <math.h>
#include <ncarg/gks.h>
#include <ncarg/ncargC.h>
#include <ncarg/hlu/hlu.h>
/*
* Include a header file for each object created
*/
#include <ncarg/hlu/App.h>
#include <ncarg/hlu/NcgmWorkstation.h>
#include <ncarg/hlu/PSWorkstation.h>
#include <ncarg/hlu/PDFWorkstation.h>
#include <ncarg/hlu/CairoWorkstation.h>
#include <ncarg/hlu/ScalarField.h>
#include <ncarg/hlu/ContourPlot.h>
#include <ncarg/hlu/TextItem.h>
#define M 33
#define N 33
int main(int argc, char *argv[])
{
int appid,wid,dataid,cnid,txid;
int rlist,grlist;
int gkswid;
float z[N*M];
int mlow = 20, mhigh = 20;
float dlow = .000025, dhigh = .000075;
ng_size_t len_dims[2];
int i;
int *lvlflags, *pats;
float *levels, *thicknesses;
ng_size_t lvlflag_count, pat_count, level_count,thick_count;
extern void bndary();
extern void gendat (float *,int,int,int,int,int,float,float);
char const *wks_type = "x11";
/*
* This program emulates the output of cpex02 with a few differences:
* 1. Because the information label is implemented as an HLU Annotation
* object, Conpack is unaware of its existence, much less its location.
* Therefore it is not possible to have Conpack remove the high/low
* labels that occupy the same space as the info label.
* 2. Line labels do not appear in the same positions.
*/
/*
* Initialize the high level utility library
*/
NhlInitialize();
/*
* Create an application context. Set the app dir to the current directory
* so the application looks for a resource file in the working directory.
* The resource file sets most of the ContourPlot resources that remain fixed
* throughout the life of the ContourPlot object.
*/
rlist = NhlRLCreate(NhlSETRL);
NhlRLClear(rlist);
NhlRLSetString(rlist,NhlNappUsrDir,"./");
NhlCreate(&appid,"cn04",NhlappClass,NhlDEFAULT_APP,rlist);
if (!strcmp(wks_type,"ncgm") || !strcmp(wks_type,"NCGM")) {
/*
* Create a meta file workstation.
*/
NhlRLClear(rlist);
NhlRLSetString(rlist,NhlNwkMetaName,"./cn04c.ncgm");
NhlCreate(&wid,"cn04Work",
NhlncgmWorkstationClass,NhlDEFAULT_APP,rlist);
}
else if (!strcmp(wks_type,"x11") || !strcmp(wks_type,"X11")) {
/*
* Create an X workstation.
*/
NhlRLClear(rlist);
NhlRLSetInteger(rlist,NhlNwkPause,True);
NhlCreate(&wid,"cn04Work",
NhlcairoWindowWorkstationClass,NhlDEFAULT_APP,rlist);
}
else if (!strcmp(wks_type,"oldps") || !strcmp(wks_type,"OLDPS")) {
/*
* Create an older-style PostScript workstation.
*/
NhlRLClear(rlist);
NhlRLSetString(rlist,NhlNwkPSFileName,"./cn04c.ps");
NhlCreate(&wid,"cn04Work",
NhlpsWorkstationClass,NhlDEFAULT_APP,rlist);
}
else if (!strcmp(wks_type,"oldpdf") || !strcmp(wks_type,"OLDPDF")) {
/*
* Create an older-style PDF workstation.
*/
NhlRLClear(rlist);
NhlRLSetString(rlist,NhlNwkPDFFileName,"./cn04c.pdf");
NhlCreate(&wid,"cn04Work",
NhlpdfWorkstationClass,NhlDEFAULT_APP,rlist);
}
else if (!strcmp(wks_type,"pdf") || !strcmp(wks_type,"PDF") ||
!strcmp(wks_type,"ps") || !strcmp(wks_type,"PS")) {
/*
* Create a cairo PS/PDF workstation.
*/
NhlRLClear(rlist);
NhlRLSetString(rlist,NhlNwkFileName,"./cn04c");
NhlRLSetString(rlist,NhlNwkFormat,(char*)wks_type);
NhlCreate(&wid,"cn04Work",
NhlcairoDocumentWorkstationClass,NhlDEFAULT_APP,rlist);
}
else if (!strcmp(wks_type,"png") || !strcmp(wks_type,"PNG")) {
/*
* Create a cairo PNG workstation.
*/
NhlRLClear(rlist);
NhlRLSetString(rlist,NhlNwkFileName,"./cn04c");
NhlRLSetString(rlist,NhlNwkFormat,(char*)wks_type);
NhlCreate(&wid,"cn04Work",
NhlcairoImageWorkstationClass,NhlDEFAULT_APP,rlist);
}
/*
* Call the Fortran routine 'GENDAT' to create the first array of contour
* data. Create a ScalarField data object and hand it the data created by
* 'GENDAT'.
*/
NhlRLClear(rlist);
len_dims[0] = N;
len_dims[1] = M;
gendat(z,M,M,N,mlow,mhigh,dlow,dhigh);
NhlRLSetMDFloatArray(rlist,NhlNsfDataArray,z,2,len_dims);
NhlCreate(&dataid,"Gendat",NhlscalarFieldClass,appid,rlist);
/*
* Create a ContourPlot object, supplying the ScalarField object as data,
* and setting the size of the viewport.
*/
NhlRLClear(rlist);
NhlRLSetInteger(rlist,NhlNcnScalarFieldData,dataid);
NhlRLSetString(rlist,NhlNtiMainString,"EXAMPLE 2-1");
NhlRLSetFloat(rlist,NhlNvpWidthF,0.4625);
NhlRLSetFloat(rlist,NhlNvpHeightF,0.4625);
NhlCreate(&cnid,"ContourPlot1",NhlcontourPlotClass,wid,rlist);
/*
* In order to set the contour array resources of interest, you must
* allocate memory for the arrays and fill in the correct value for each
* element. But by calling GetValues for the arrays the ContourPlot object
* allocates the space and fills in the current values for you. Then all
* that is necessary is to modify the values that you want to change.
* Remember, however, that you are responsible for freeing the memory
* after you are done with it. Note also that a GetValues resource list is
* different that a SetValues list.
*/
grlist = NhlRLCreate(NhlGETRL);
NhlRLClear(grlist);
NhlRLGetIntegerArray(grlist,NhlNcnLevelFlags,&lvlflags,&lvlflag_count);
NhlRLGetIntegerArray(grlist,NhlNcnFillPatterns,&pats,&pat_count);
NhlRLGetFloatArray(grlist,NhlNcnLevels,&levels,&level_count);
NhlRLGetFloatArray(grlist,NhlNcnLineThicknesses,
&thicknesses,&thick_count);
NhlGetValues(cnid,grlist);
/*
* Depending on the level flag for each contour line, widen the line if
* there is a label on the line. Also set the fill style to pattern #6
* if the level is between certain values. Note that there is always one
* more element in the fill resource arrays than there are ContourPlot line
* levels: the first element of these arrays specifies the attributes
* of areas less than the minimum contour level and the last element
* specifies attributes of areas greater than the maximum contour level.
*/
for (i = 0; i < level_count; i++) {
if (lvlflags[i] == NhlLINEANDLABEL)
thicknesses[i] = 2.0;
if (levels[i] >= .000045 && levels[i] < .000055)
pats[i] = 6;
else
pats[i] = NhlHOLLOWFILL;
}
pats[pat_count-1] = NhlHOLLOWFILL;
/*
* Now that the arrays are correctly filled in set the arrays that have
* been modified. Also set the position of the first ContourPlot plot and
* the label scaling mode.
*/
NhlRLClear(rlist);
NhlRLSetIntegerArray(rlist,NhlNcnFillPatterns,pats,pat_count);
NhlRLSetFloatArray(rlist,NhlNcnLineThicknesses,
thicknesses,thick_count);
NhlRLSetFloat(rlist,NhlNvpXF,0.0250);
NhlRLSetFloat(rlist,NhlNvpYF,0.9750);
NhlRLSetString(rlist,NhlNcnLabelScalingMode,"ConfineToRange");
NhlRLSetFloat(rlist,NhlNcnLabelScaleValueF,10.0);
NhlSetValues(cnid,rlist);
NhlDraw(cnid);
/*
* Plot 2 - Set the Scalar Field object with a newly generated data set;
* Set the ContourPlot object with a new title, position, and a new label
* scaling mode.
*/
NhlRLClear(rlist);
gendat(z,M,M,N,mlow,mhigh,dlow,dhigh);
NhlRLSetMDFloatArray(rlist,NhlNsfDataArray,z,2,len_dims);
NhlSetValues(dataid,rlist);
NhlRLClear(rlist);
NhlRLSetString(rlist,NhlNtiMainString,"EXAMPLE 2-2");
NhlRLSetFloat(rlist,NhlNvpXF,0.5125);
NhlRLSetInteger(rlist,NhlNcnScalarFieldData,dataid);
NhlRLSetString(rlist,NhlNcnLabelScalingMode,"MaxSigDigitsLeft");
NhlSetValues(cnid,rlist);
NhlDraw(cnid);
/*
* Plot 3 - Set the Scalar Field object with a newly generated data set;
* Set the ContourPlot object with a new title, position, and a new label
* scaling mode.
*/
NhlRLClear(rlist);
gendat(z,M,M,N,mlow,mhigh,dlow,dhigh);
NhlRLSetMDFloatArray(rlist,NhlNsfDataArray,z,2,len_dims);
NhlSetValues(dataid,rlist);
NhlRLClear(rlist);
NhlRLSetString(rlist,NhlNtiMainString,"EXAMPLE 2-3");
NhlRLSetFloat(rlist,NhlNvpXF,0.0250);
NhlRLSetFloat(rlist,NhlNvpYF,0.4875);
NhlRLSetInteger(rlist,NhlNcnScalarFieldData,dataid);
NhlRLSetString(rlist,NhlNcnLabelScalingMode,"TrimZeros");
NhlSetValues(cnid,rlist);
NhlDraw(cnid);
/*
* Plot 4 - Set the Scalar Field object with a newly generated data set;
* Set the ContourPlot object with a new title, position, and a new label
* scaling mode.
*/
NhlRLClear(rlist);
gendat(z,M,M,N,mlow,mhigh,dlow,dhigh);
NhlRLSetMDFloatArray(rlist,NhlNsfDataArray,z,2,len_dims);
NhlSetValues(dataid,rlist);
NhlRLClear(rlist);
NhlRLSetString(rlist,NhlNtiMainString,"EXAMPLE 2-4");
NhlRLSetFloat(rlist,NhlNvpXF,0.5125);
NhlRLSetInteger(rlist,NhlNcnScalarFieldData,dataid);
NhlRLSetString(rlist,NhlNcnLabelScalingMode,"IntegerLineLabels");
NhlSetValues(cnid,rlist);
NhlDraw(cnid);
/*
* Activate the GKS workstation and use the low-level routine that cpex02
* uses to draw the line around the edge of the plotter frame.
*/
NhlRLClear(grlist);
NhlRLGetInteger(grlist,NhlNwkGksWorkId,&gkswid);
NhlGetValues(wid,grlist);
gactivate_ws(gkswid);
bndary();
gdeactivate_ws(gkswid);
/*
* Label the plot as an emulation
*/
NhlRLClear(rlist);
NhlCreate(&txid,"TextItem1",NhltextItemClass,wid,rlist);
NhlDraw(txid);
NhlFrame(wid);
/*
* Free dynamic arrays, destroy the objects created,
* close the HLU library and exit.
*/
NhlFree(pats);
NhlFree(thicknesses);
NhlFree(levels);
NhlFree(lvlflags);
NhlDestroy(dataid);
NhlDestroy(cnid);
NhlDestroy(wid);
NhlDestroy(appid);
NhlClose();
exit(0);
}
#define max(x,y) ((x) > (y) ? (x) : (y) )
#define min(x,y) ((x) < (y) ? (x) : (y) )
#define pow2(x) ((x)*(x))
void gendat (float *data,int idim,int m,int n,int mlow,int mhgh,float dlow,float dhgh)
{
/*
* This is a routine to generate test data for two-dimensional graphics
* routines. Given a linear array "data", of length at least m x n, it fills
* the array with a field representing a two-dimensional array stored
* in C order of "n" rows and "m" columns. The array will have
* approximately "mlow" lows and "mhgh" highs, a minimum
* value of exactly "dlow" and a maximum value of exactly "dhgh".
*
* "mlow" and "mhgh" are each forced to be greater than or equal to 1
* and less than or equal to 25.
*
* The function used is a sum of exponentials.
*/
float ccnt[3][50], fovm, fovn, dmin, dmax, temp;
extern float fran();
int nlow, nhgh, ncnt, i, j, k, ii;
fovm=9./(float)m;
fovn=9./(float)n;
nlow=max(1,min(25,mlow));
nhgh=max(1,min(25,mhgh));
ncnt=nlow+nhgh;
for( k=1; k <= ncnt; k++ ) {
ccnt[0][k-1]=1.+((float)m-1.)*fran();
ccnt[1][k-1]=1.+((float)n-1.)*fran();
if (k <= nlow) {
ccnt[2][k-1]= -1.;
}
else {
ccnt[2][k-1] = 1.;
}
}
dmin = 1.e36;
dmax = -1.e36;
ii = 0;
for( j = 1; j <= n; j++ ) {
for( i = 1; i <= m; i++ ) {
data[ii]=.5*(dlow+dhgh);
for( k = 1; k <= ncnt; k++ ) {
temp = -(pow2((fovm*((float)(i)-ccnt[0][k-1])))+
pow2(fovn*((float)(j)-ccnt[1][k-1])));
if (temp >= -20.) data[ii]=data[ii]+.5*(dhgh-dlow)
*ccnt[2][k-1]*exp(temp);
}
dmin=min(dmin,data[ii]);
dmax=max(dmax,data[ii]);
ii++;
}
}
for( j = 0; j < m*n; j++ ) {
data[j]=(data[j]-dmin)/(dmax-dmin)*(dhgh-dlow)+dlow;
}
}
float rseq[] = { .749, .973, .666, .804, .081, .483, .919, .903, .951, .960,
.039, .269, .270, .756, .222, .478, .621, .063, .550, .798, .027, .569,
.149, .697, .451, .738, .508, .041, .266, .249, .019, .191, .266, .625,
.492, .940, .508, .406, .972, .311, .757, .378, .299, .536, .619, .844,
.342, .295, .447, .499, .688, .193, .225, .520, .954, .749, .997, .693,
.217, .273, .961, .948, .902, .104, .495, .257, .524, .100, .492, .347,
.981, .019, .225, .806, .678, .710, .235, .600, .994, .758, .682, .373,
.009, .469, .203, .730, .588, .603, .213, .495, .884, .032, .185, .127,
.010, .180, .689, .354, .372, .429 };
float fran()
{
static int iseq = 0;
iseq = (iseq % 100) + 1;
return(rseq[iseq-1]);
}
void bndary()
{
/*
* Draw a line showing where the edge of the plotter frame is.
*/
c_plotif (0.,0.,0);
c_plotif (1.,0.,1);
c_plotif (1.,1.,1);
c_plotif (0.,1.,1);
c_plotif (0.,0.,1);
c_plotif (0.,0.,2);
}
|
ff0c31027129b8038c2dbc0302a7f4ab4f15a49c
|
cf56b5fcf51fddb219c47f5f006d8595a4483c57
|
/src/components/ec/cuda/ec_cuda.c
|
2357023fedbefaaa9077a815c143a0417ad0962c
|
[
"BSD-3-Clause"
] |
permissive
|
openucx/ucc
|
3b39fbd849a7850c559b60eaec7882292f8a5eca
|
f89cd7557e6ebb19b4c6ebd529647d8b42c30657
|
refs/heads/master
| 2023-08-18T03:18:54.072899
| 2023-08-17T18:05:44
| 2023-08-17T18:05:44
| 282,490,868
| 150
| 57
|
BSD-3-Clause
| 2023-09-12T09:49:18
| 2020-07-25T17:18:51
|
C
|
UTF-8
|
C
| false
| false
| 16,645
|
c
|
ec_cuda.c
|
/**
* Copyright (c) 2020-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* See file LICENSE for terms.
*/
#include "ec_cuda.h"
#include "ec_cuda_executor.h"
#include "utils/ucc_malloc.h"
#include "utils/arch/cpu.h"
#include <cuda_runtime.h>
#include <cuda.h>
static const char *stream_task_modes[] = {
[UCC_EC_CUDA_TASK_KERNEL] = "kernel",
[UCC_EC_CUDA_TASK_MEM_OPS] = "driver",
[UCC_EC_CUDA_TASK_AUTO] = "auto",
[UCC_EC_CUDA_TASK_LAST] = NULL
};
static ucc_config_field_t ucc_ec_cuda_config_table[] = {
{"", "", NULL, ucc_offsetof(ucc_ec_cuda_config_t, super),
UCC_CONFIG_TYPE_TABLE(ucc_ec_config_table)},
{"STREAM_TASK_MODE", "auto",
"Mechanism to create stream dependency\n"
"kernel - use waiting kernel\n"
"driver - use driver MEM_OPS\n"
"auto - runtime automatically chooses best one",
ucc_offsetof(ucc_ec_cuda_config_t, strm_task_mode),
UCC_CONFIG_TYPE_ENUM(stream_task_modes)},
{"EXEC_NUM_WORKERS", "1",
"Number of thread blocks to use for cuda persistent executor",
ucc_offsetof(ucc_ec_cuda_config_t, exec_num_workers),
UCC_CONFIG_TYPE_ULUNITS},
{"EXEC_NUM_THREADS", "512",
"Number of threads per block to use for cuda persistent executor",
ucc_offsetof(ucc_ec_cuda_config_t, exec_num_threads),
UCC_CONFIG_TYPE_ULUNITS},
{"EXEC_MAX_TASKS", "128",
"Maximum number of outstanding tasks per executor",
ucc_offsetof(ucc_ec_cuda_config_t, exec_max_tasks),
UCC_CONFIG_TYPE_ULUNITS},
{"EXEC_NUM_STREAMS", "16",
"Number of streams used by interruptible executor",
ucc_offsetof(ucc_ec_cuda_config_t, exec_num_streams),
UCC_CONFIG_TYPE_ULUNITS},
{"EXEC_COPY_LARGE_THRESH", "1M",
"Single memcopy size to switch from kernel copy to cudaMemcpy",
ucc_offsetof(ucc_ec_cuda_config_t, exec_copy_thresh),
UCC_CONFIG_TYPE_MEMUNITS},
{"REDUCE_NUM_BLOCKS", "auto",
"Number of thread blocks to use for reduction in interruptible mode",
ucc_offsetof(ucc_ec_cuda_config_t, reduce_num_blocks),
UCC_CONFIG_TYPE_ULUNITS},
{"REDUCE_NUM_THREADS", "auto",
"Number of threads per block to use for reduction in interruptible "
"executor",
ucc_offsetof(ucc_ec_cuda_config_t, reduce_num_threads),
UCC_CONFIG_TYPE_ULUNITS},
{"USE_COOPERATIVE_LAUNCH", "0",
"whether to use cooperative launch in persistent kernel executor",
ucc_offsetof(ucc_ec_cuda_config_t, use_cooperative_launch),
UCC_CONFIG_TYPE_BOOL},
{NULL}
};
static ucc_status_t ucc_ec_cuda_ee_executor_mpool_chunk_malloc(ucc_mpool_t *mp, //NOLINT: mp is unused
size_t *size_p,
void ** chunk_p)
{
return CUDA_FUNC(cudaHostAlloc((void**)chunk_p, *size_p,
cudaHostAllocMapped));
}
static void ucc_ec_cuda_ee_executor_mpool_chunk_free(ucc_mpool_t *mp, //NOLINT: mp is unused
void *chunk)
{
CUDA_FUNC(cudaFreeHost(chunk));
}
static void ucc_ec_cuda_executor_chunk_init(ucc_mpool_t *mp, void *obj, //NOLINT: mp is unused
void *chunk) //NOLINT: chunk is unused
{
ucc_ec_cuda_executor_t *eee = (ucc_ec_cuda_executor_t*) obj;
int max_tasks = EC_CUDA_CONFIG->exec_max_tasks;
CUDA_FUNC(cudaHostGetDevicePointer(
(void**)(&eee->dev_state), (void *)&eee->state, 0));
CUDA_FUNC(cudaHostGetDevicePointer(
(void**)(&eee->dev_pidx), (void *)&eee->pidx, 0));
CUDA_FUNC(cudaMalloc((void**)&eee->dev_cidx, sizeof(*eee->dev_cidx)));
CUDA_FUNC(cudaHostAlloc((void**)&eee->tasks,
max_tasks * MAX_SUBTASKS *
sizeof(ucc_ee_executor_task_args_t),
cudaHostAllocMapped));
CUDA_FUNC(cudaHostGetDevicePointer(
(void**)(&eee->dev_tasks), (void *)eee->tasks, 0));
if (ucc_ec_cuda.thread_mode == UCC_THREAD_MULTIPLE) {
ucc_spinlock_init(&eee->tasks_lock, 0);
}
}
static void ucc_ec_cuda_executor_chunk_cleanup(ucc_mpool_t *mp, void *obj) //NOLINT: mp is unused
{
ucc_ec_cuda_executor_t *eee = (ucc_ec_cuda_executor_t*) obj;
CUDA_FUNC(cudaFree((void*)eee->dev_cidx));
CUDA_FUNC(cudaFreeHost((void*)eee->tasks));
if (ucc_ec_cuda.thread_mode == UCC_THREAD_MULTIPLE) {
ucc_spinlock_destroy(&eee->tasks_lock);
}
}
static ucc_mpool_ops_t ucc_ec_cuda_ee_executor_mpool_ops = {
.chunk_alloc = ucc_ec_cuda_ee_executor_mpool_chunk_malloc,
.chunk_release = ucc_ec_cuda_ee_executor_mpool_chunk_free,
.obj_init = ucc_ec_cuda_executor_chunk_init,
.obj_cleanup = ucc_ec_cuda_executor_chunk_cleanup,
};
static void ucc_ec_cuda_event_init(ucc_mpool_t *mp, void *obj, void *chunk) //NOLINT: mp is unused
{
ucc_ec_cuda_event_t *base = (ucc_ec_cuda_event_t *) obj;
CUDA_FUNC(cudaEventCreateWithFlags(&base->event, cudaEventDisableTiming));
}
static void ucc_ec_cuda_event_cleanup(ucc_mpool_t *mp, void *obj) //NOLINT: mp is unused
{
ucc_ec_cuda_event_t *base = (ucc_ec_cuda_event_t *) obj;
CUDA_FUNC(cudaEventDestroy(base->event));
}
static ucc_mpool_ops_t ucc_ec_cuda_event_mpool_ops = {
.chunk_alloc = ucc_mpool_hugetlb_malloc,
.chunk_release = ucc_mpool_hugetlb_free,
.obj_init = ucc_ec_cuda_event_init,
.obj_cleanup = ucc_ec_cuda_event_cleanup,
};
static void ucc_ec_cuda_graph_init(ucc_mpool_t *mp, void *obj, void *chunk) //NOLINT: mp is unused
{
ucc_ec_cuda_executor_interruptible_task_t *task =
(ucc_ec_cuda_executor_interruptible_task_t *) obj;
cudaGraphNode_t memcpy_node;
int i;
CUDA_FUNC(cudaGraphCreate(&task->graph, 0));
for (i = 0; i < UCC_EE_EXECUTOR_MULTI_OP_NUM_BUFS; i++) {
CUDA_FUNC(
cudaGraphAddMemcpyNode1D(&memcpy_node, task->graph, NULL, 0,
(void*)1, (void*)1, 1, cudaMemcpyDefault));
}
CUDA_FUNC(
cudaGraphInstantiateWithFlags(&task->graph_exec, task->graph, 0));
}
static void ucc_ec_cuda_graph_cleanup(ucc_mpool_t *mp, void *obj) //NOLINT: mp is unused
{
ucc_ec_cuda_executor_interruptible_task_t *task =
(ucc_ec_cuda_executor_interruptible_task_t *) obj;
CUDA_FUNC(cudaGraphExecDestroy(task->graph_exec));
CUDA_FUNC(cudaGraphDestroy(task->graph));
}
static ucc_mpool_ops_t ucc_ec_cuda_interruptible_task_mpool_ops = {
.chunk_alloc = ucc_mpool_hugetlb_malloc,
.chunk_release = ucc_mpool_hugetlb_free,
.obj_init = ucc_ec_cuda_graph_init,
.obj_cleanup = ucc_ec_cuda_graph_cleanup,
};
static inline void ucc_ec_cuda_set_threads_nbr(int *nt, int maxThreadsPerBlock)
{
if (*nt != UCC_ULUNITS_AUTO) {
if (maxThreadsPerBlock < *nt) {
ec_warn(
&ucc_ec_cuda.super,
"number of threads per block is too large, max supported is %d",
maxThreadsPerBlock);
} else if ((*nt % WARP_SIZE) != 0) {
ec_warn(&ucc_ec_cuda.super,
"number of threads per block must be divisible by "
"WARP_SIZE(=%d)",
WARP_SIZE);
} else {
return;
}
}
*nt = (maxThreadsPerBlock / WARP_SIZE) * WARP_SIZE;
}
static ucc_status_t ucc_ec_cuda_init(const ucc_ec_params_t *ec_params)
{
ucc_ec_cuda_config_t *cfg = EC_CUDA_CONFIG;
ucc_status_t status;
int device, num_devices;
cudaError_t cuda_st;
struct cudaDeviceProp prop;
int supportsCoopLaunch = 0;
ucc_ec_cuda.stream = NULL;
ucc_ec_cuda.stream_initialized = 0;
ucc_ec_cuda.exec_streams_initialized = 0;
ucc_strncpy_safe(ucc_ec_cuda.super.config->log_component.name,
ucc_ec_cuda.super.super.name,
sizeof(ucc_ec_cuda.super.config->log_component.name));
ucc_ec_cuda.thread_mode = ec_params->thread_mode;
cuda_st = cudaGetDeviceCount(&num_devices);
if ((cuda_st != cudaSuccess) || (num_devices == 0)) {
ec_debug(&ucc_ec_cuda.super, "CUDA devices are not found");
return UCC_ERR_NO_RESOURCE;
}
CUDA_CHECK(cudaGetDevice(&device));
CUDA_CHECK(cudaGetDeviceProperties(&prop, device));
ucc_ec_cuda_set_threads_nbr((int *)&cfg->exec_num_threads,
prop.maxThreadsPerBlock);
ucc_ec_cuda_set_threads_nbr(&cfg->reduce_num_threads,
prop.maxThreadsPerBlock);
if (cfg->reduce_num_blocks != UCC_ULUNITS_AUTO) {
if (prop.maxGridSize[0] < cfg->reduce_num_blocks) {
ec_warn(&ucc_ec_cuda.super,
"number of blocks is too large, max supported is %d",
prop.maxGridSize[0]);
cfg->reduce_num_blocks = prop.maxGridSize[0];
}
} else {
cfg->reduce_num_blocks = prop.maxGridSize[0];
}
if (cfg->exec_num_streams < 1) {
ec_warn(&ucc_ec_cuda.super,
"number of streams is too small, min supported 1");
cfg->exec_num_streams = 1;
}
/*create event pool */
ucc_ec_cuda.exec_streams = ucc_calloc(cfg->exec_num_streams,
sizeof(cudaStream_t),
"ec cuda streams");
if (!ucc_ec_cuda.exec_streams) {
ec_error(&ucc_ec_cuda.super, "failed to allocate streams array");
return UCC_ERR_NO_MEMORY;
}
status = ucc_mpool_init(&ucc_ec_cuda.events, 0, sizeof(ucc_ec_cuda_event_t),
0, UCC_CACHE_LINE_SIZE, 16, UINT_MAX,
&ucc_ec_cuda_event_mpool_ops, UCC_THREAD_MULTIPLE,
"CUDA Event Objects");
if (status != UCC_OK) {
ec_error(&ucc_ec_cuda.super, "failed to create event pool");
return status;
}
status = ucc_mpool_init(
&ucc_ec_cuda.executors, 0, sizeof(ucc_ec_cuda_executor_t), 0,
UCC_CACHE_LINE_SIZE, 16, UINT_MAX, &ucc_ec_cuda_ee_executor_mpool_ops,
UCC_THREAD_MULTIPLE, "EE executor Objects");
if (status != UCC_OK) {
ec_error(&ucc_ec_cuda.super, "failed to create executors pool");
return status;
}
status = ucc_mpool_init(
&ucc_ec_cuda.executor_interruptible_tasks, 0,
sizeof(ucc_ec_cuda_executor_interruptible_task_t), 0, UCC_CACHE_LINE_SIZE,
16, UINT_MAX, &ucc_ec_cuda_interruptible_task_mpool_ops,
UCC_THREAD_MULTIPLE, "interruptible executor tasks");
if (status != UCC_OK) {
ec_error(&ucc_ec_cuda.super, "failed to create interruptible tasks pool");
return status;
}
status = ucc_mpool_init(
&ucc_ec_cuda.executor_persistent_tasks, 0,
sizeof(ucc_ec_cuda_executor_persistent_task_t), 0, UCC_CACHE_LINE_SIZE,
16, UINT_MAX, NULL, UCC_THREAD_MULTIPLE,
"persistent executor tasks");
if (status != UCC_OK) {
ec_error(&ucc_ec_cuda.super, "failed to create persistent tasks pool");
return status;
}
if (cfg->strm_task_mode == UCC_EC_CUDA_TASK_KERNEL) {
ucc_ec_cuda.strm_task_mode = UCC_EC_CUDA_TASK_KERNEL;
} else {
ucc_ec_cuda.strm_task_mode = UCC_EC_CUDA_TASK_MEM_OPS;
#if CUDA_VERSION < 12000
CUresult cu_st;
CUdevice cu_dev;
int attr;
cu_st = cuCtxGetDevice(&cu_dev);
if (cu_st != CUDA_SUCCESS){
const char *cu_err_st_str;
cuGetErrorString(cu_st, &cu_err_st_str);
ec_debug(&ucc_ec_cuda.super, "cuCtxGetDevice() failed: %s",
cu_err_st_str);
attr = 0;
} else {
CUDADRV_FUNC(cuDeviceGetAttribute(&attr,
CU_DEVICE_ATTRIBUTE_CAN_USE_STREAM_MEM_OPS,
cu_dev));
}
if (cfg->strm_task_mode == UCC_EC_CUDA_TASK_AUTO) {
if (attr == 0) {
ec_debug(&ucc_ec_cuda.super,
"CUDA MEM OPS are not supported or disabled");
ucc_ec_cuda.strm_task_mode = UCC_EC_CUDA_TASK_KERNEL;
}
} else if (attr == 0) {
ec_error(&ucc_ec_cuda.super,
"CUDA MEM OPS are not supported or disabled");
return UCC_ERR_NOT_SUPPORTED;
}
#endif
}
if (cfg->use_cooperative_launch == 1) {
cudaDeviceGetAttribute(&supportsCoopLaunch,
cudaDevAttrCooperativeLaunch, device);
if (!supportsCoopLaunch) {
cfg->use_cooperative_launch = 0;
ec_warn(&ucc_ec_cuda.super,
"CUDA cooperative groups are not supported. "
"Fall back to non cooperative launch.");
}
}
ucc_spinlock_init(&ucc_ec_cuda.init_spinlock, 0);
return UCC_OK;
}
static ucc_status_t ucc_ec_cuda_get_attr(ucc_ec_attr_t *ec_attr)
{
if (ec_attr->field_mask & UCC_EC_ATTR_FIELD_THREAD_MODE) {
ec_attr->thread_mode = ucc_ec_cuda.thread_mode;
}
return UCC_OK;
}
ucc_status_t ucc_ec_cuda_event_create(void **event)
{
ucc_ec_cuda_event_t *cuda_event;
cuda_event = ucc_mpool_get(&ucc_ec_cuda.events);
if (ucc_unlikely(!cuda_event)) {
ec_error(&ucc_ec_cuda.super, "failed to get event from mpool");
return UCC_ERR_NO_MEMORY;
}
*event = cuda_event;
return UCC_OK;
}
ucc_status_t ucc_ec_cuda_event_destroy(void *event)
{
ucc_ec_cuda_event_t *cuda_event = event;
ucc_mpool_put(cuda_event);
return UCC_OK;
}
ucc_status_t ucc_ec_cuda_event_post(void *ee_context, void *event)
{
cudaStream_t stream = (cudaStream_t )ee_context;
ucc_ec_cuda_event_t *cuda_event = event;
CUDA_CHECK(cudaEventRecord(cuda_event->event, stream));
return UCC_OK;
}
ucc_status_t ucc_ec_cuda_event_test(void *event)
{
cudaError_t cu_err;
ucc_ec_cuda_event_t *cuda_event = event;
cu_err = cudaEventQuery(cuda_event->event);
if (ucc_unlikely((cu_err != cudaSuccess) &&
(cu_err != cudaErrorNotReady))) {
CUDA_CHECK(cu_err);
}
return cuda_error_to_ucc_status(cu_err);
}
static ucc_status_t ucc_ec_cuda_finalize()
{
int i;
if (ucc_ec_cuda.stream_initialized) {
CUDA_FUNC(cudaStreamDestroy(ucc_ec_cuda.stream));
ucc_ec_cuda.stream_initialized = 0;
}
if (ucc_ec_cuda.exec_streams_initialized) {
for (i = 0; i < EC_CUDA_CONFIG->exec_num_streams; i++) {
CUDA_FUNC(cudaStreamDestroy(ucc_ec_cuda.exec_streams[i]));
}
ucc_ec_cuda.exec_streams_initialized = 0;
}
ucc_mpool_cleanup(&ucc_ec_cuda.events, 1);
ucc_mpool_cleanup(&ucc_ec_cuda.executors, 1);
ucc_mpool_cleanup(&ucc_ec_cuda.executor_interruptible_tasks, 1);
ucc_mpool_cleanup(&ucc_ec_cuda.executor_persistent_tasks, 1);
ucc_free(ucc_ec_cuda.exec_streams);
return UCC_OK;
}
ucc_ec_cuda_t ucc_ec_cuda = {
.super.super.name = "cuda ec",
.super.ref_cnt = 0,
.super.type = UCC_EE_CUDA_STREAM,
.super.init = ucc_ec_cuda_init,
.super.get_attr = ucc_ec_cuda_get_attr,
.super.finalize = ucc_ec_cuda_finalize,
.super.config_table =
{
.name = "CUDA execution component",
.prefix = "EC_CUDA_",
.table = ucc_ec_cuda_config_table,
.size = sizeof(ucc_ec_cuda_config_t),
},
.super.ops.create_event = ucc_ec_cuda_event_create,
.super.ops.destroy_event = ucc_ec_cuda_event_destroy,
.super.ops.event_post = ucc_ec_cuda_event_post,
.super.ops.event_test = ucc_ec_cuda_event_test,
.super.executor_ops.init = ucc_cuda_executor_init,
.super.executor_ops.start = ucc_cuda_executor_start,
.super.executor_ops.status = ucc_cuda_executor_status,
.super.executor_ops.stop = ucc_cuda_executor_stop,
.super.executor_ops.task_post = ucc_cuda_executor_task_post,
.super.executor_ops.task_test = ucc_cuda_executor_task_test,
.super.executor_ops.task_finalize = ucc_cuda_executor_task_finalize,
.super.executor_ops.finalize = ucc_cuda_executor_finalize,
};
UCC_CONFIG_REGISTER_TABLE_ENTRY(&ucc_ec_cuda.super.config_table,
&ucc_config_global_list);
|
9e8785cecf6dc84eda9f03b36c84e1ea50aac97c
|
e1ea5f615a2ee3130926cdb506d4804742bc9fee
|
/plugins/experimental/cookie_remap/hash.cc
|
a1bdbb5ba4f6e432e3f10b406241fb1e73353f8c
|
[
"TCL",
"LicenseRef-scancode-proprietary-license",
"BSD-3-Clause",
"LicenseRef-scancode-openssl",
"LicenseRef-scancode-ssleay-windows",
"ISC",
"OpenSSL",
"MIT",
"HPND",
"Apache-2.0",
"BSD-2-Clause",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unknown"
] |
permissive
|
apache/trafficserver
|
1507804151ab2c2ac50012fdecee6200f2c52c1f
|
c5d7b19d60646de902fc847f80f57030779a4bfc
|
refs/heads/master
| 2023-08-31T20:10:00.381763
| 2023-08-31T19:15:34
| 2023-08-31T19:15:34
| 356,066
| 1,570
| 981
|
Apache-2.0
| 2023-09-14T21:04:36
| 2009-10-31T08:00:10
|
C++
|
UTF-8
|
C
| false
| false
| 3,021
|
cc
|
hash.cc
|
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you 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 "hash.h"
#include <string.h>
#include <ctype.h>
////////////////////////////////////////////////////////////////////////////////
// Implementation of the Fowler–Noll–Vo hash function //
// More Details at: http://www.isthe.com/chongo/tech/comp/fnv/ //
////////////////////////////////////////////////////////////////////////////////
/*
* 32/64 bit magic FNV primes
* The main secret of the algorithm is in these prime numbers
* and their special relation to 2^32 (or 2^64) [a word]
* and 2^8 [a byte].
*/
#define FNV_32_PRIME ((uint32_t)0x01000193UL)
#define FNV_64_PRIME ((uint64_t)0x100000001b3ULL)
/*
* The init value is quite arbitrary, but these seem to perform
* well on both web2 and sequential integers represented as strings.
*/
#define FNV1_32_INIT ((uint32_t)33554467UL)
#define FNV1_64_INIT ((uint64_t)0xcbf29ce484222325ULL)
#define MAX_UINT32 (~((uint32_t)0))
#define MAX_UINT64 (~((uint64_t)0))
#define MASK(x) (((uint32_t)1 << (x)) - 1)
static uint32_t
fnv32_nbits(const char *buf, int len, int nbits)
{
uint32_t hash;
hash = hash_fnv32_buf(buf, len);
if (nbits <= 16) {
hash = ((hash >> nbits) ^ hash) & MASK(nbits);
} else {
hash = (hash >> nbits) ^ (hash & MASK(nbits));
}
return hash;
}
uint32_t
hash_fnv32_buckets(const char *buf, size_t len, uint32_t num_buckets)
{
uint32_t hash;
uint32_t retry;
int first_bit;
if (num_buckets < 1) {
return 0;
}
first_bit = ffs(num_buckets);
if (num_buckets >> first_bit == 0) { /* Power of two */
/* Yay we can xor fold */
hash = fnv32_nbits(buf, len, first_bit - 1);
return hash;
}
/* Can't xor fold so use the retry method */
hash = hash_fnv32_buf(buf, len);
/* This code ensures there is no bias against larger values */
retry = (MAX_UINT32 / num_buckets) * num_buckets;
while (hash >= retry) {
hash = (hash * FNV_32_PRIME) + FNV1_32_INIT;
}
hash %= num_buckets;
return hash;
}
/* 32-bit version */
uint32_t
hash_fnv32_buf(const char *buf, size_t len)
{
uint32_t val; /* initial hash value */
for (val = FNV1_32_INIT; len > 0; --len) {
val *= FNV_32_PRIME;
val ^= (uint32_t)(*buf);
++buf;
}
return val;
}
|
40a2126034973c62b447a5c2214185c016b9b63a
|
e3acfc4f06840e23ef1185dcf367f40d3e3f59b4
|
/tests/regression/31-ikind-aware-ints/05-shift.c
|
a0cf2182d8f968a974b20e717c67ee72b85876ef
|
[
"MIT"
] |
permissive
|
goblint/analyzer
|
d62d3c610b86ed288849371b41c330c30678abc7
|
69ee7163eef0bfbfd6a4f3b9fda7cea5ce9ab79f
|
refs/heads/master
| 2023-08-16T21:58:53.013737
| 2023-08-16T08:49:18
| 2023-08-16T08:49:18
| 2,066,905
| 141
| 62
|
MIT
| 2023-09-14T18:48:34
| 2011-07-18T15:10:56
|
OCaml
|
UTF-8
|
C
| false
| false
| 210
|
c
|
05-shift.c
|
// PARAM: --enable ana.int.interval
int main(void) {
// Shifting by a negative number is UB, but we should still not crash on it, but go to top instead
int v = -1;
int r = 17;
int u = r >> v;
}
|
acd111bee0fe43ca8f225e2d163151ae0ce8b07c
|
6432ea7a083ff6ba21ea17af9ee47b9c371760f7
|
/stage0/stdlib/Lean/Elab/PreDefinition/Structural/FindRecArg.c
|
3319e0a29b3a6531460b64bbb1af25c0c9ad7556
|
[
"Apache-2.0",
"LLVM-exception",
"NCSA",
"LGPL-3.0-only",
"LicenseRef-scancode-inner-net-2.0",
"BSD-3-Clause",
"LGPL-2.0-or-later",
"Spencer-94",
"LGPL-2.1-or-later",
"HPND",
"LicenseRef-scancode-pcre",
"ISC",
"LGPL-2.1-only",
"LicenseRef-scancode-other-permissive",
"SunPro",
"CMU-Mach"
] |
permissive
|
leanprover/lean4
|
4bdf9790294964627eb9be79f5e8f6157780b4cc
|
f1f9dc0f2f531af3312398999d8b8303fa5f096b
|
refs/heads/master
| 2023-08-30T01:57:45.786981
| 2023-08-29T23:14:28
| 2023-08-29T23:14:28
| 129,571,436
| 2,827
| 311
|
Apache-2.0
| 2023-09-14T18:29:16
| 2018-04-15T02:49:20
|
Lean
|
UTF-8
|
C
| false
| false
| 293,387
|
c
|
FindRecArg.c
|
// Lean compiler output
// Module: Lean.Elab.PreDefinition.Structural.FindRecArg
// Imports: Init Lean.Elab.PreDefinition.Structural.Basic
#include <lean/lean.h>
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wunused-label"
#elif defined(__GNUC__) && !defined(__CLANG__)
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wunused-label"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
#ifdef __cplusplus
extern "C" {
#endif
LEAN_EXPORT lean_object* l_Lean_Meta_withLetDecl___at_Lean_Elab_Structural_findRecArg___spec__13___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_anyMUnsafe_any___at_Lean_Elab_Structural_findRecArg___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__11(lean_object*);
LEAN_EXPORT lean_object* l_Lean_PersistentArray_anyMAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__6___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_PersistentArray_anyM___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__13___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__5___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_mk_empty_array_with_capacity(lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__5___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT uint8_t l_Array_anyMUnsafe_any___at_Lean_Elab_Structural_findRecArg_go___spec__10(lean_object*, size_t, size_t);
lean_object* l___private_Lean_Expr_0__Lean_Expr_getAppNumArgsAux(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_ReaderT_bind___at_Lean_Elab_Structural_findRecArg_go___spec__4(lean_object*, lean_object*);
static lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg___closed__1;
LEAN_EXPORT lean_object* l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_shouldVisit(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__16___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__7;
lean_object* l_Lean_MetavarContext_getDecl(lean_object*, lean_object*);
lean_object* l_Lean_indentD(lean_object*);
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___boxed(lean_object*, lean_object*);
static lean_object* l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___closed__2;
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__4;
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Expr_sort___override(lean_object*);
lean_object* l_Lean_PersistentArray_push___rarg(lean_object*, lean_object*);
lean_object* lean_array_push(lean_object*, lean_object*);
lean_object* l_Array_toSubarray___rarg(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__11;
lean_object* l_Lean_mkHashSetImp___rarg(lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__3(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__6___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_mk_array(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Subarray_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__14___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__15___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t lean_usize_dec_eq(size_t, size_t);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__11___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_ST_Prim_Ref_get___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__9___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__3;
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__5;
lean_object* lean_array_fget(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_indexOfAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos___spec__1___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_visitLet___at_Lean_Elab_Structural_findRecArg___spec__11(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT uint8_t l___private_Init_Data_Array_Basic_0__Array_allDiffAuxAux___at_Lean_Elab_Structural_findRecArg_go___spec__8(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Expr_fvarId_x21(lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__1;
lean_object* lean_environment_find(lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___closed__9;
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___closed__1;
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__18___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_anyMUnsafe_any___at_Lean_Elab_Structural_findRecArg_go___spec__10___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7(lean_object*, lean_object*);
lean_object* l_Lean_stringToMessageData(lean_object*);
lean_object* l_Lean_HashMap_insert___at_Lean_Meta_forEachExpr_x27_visit___spec__12(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__8;
LEAN_EXPORT lean_object* l___private_Init_Data_Array_Basic_0__Array_allDiffAuxAux___at_Lean_Elab_Structural_findRecArg_go___spec__8___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l___private_Lean_Util_Trace_0__Lean_checkTraceOption(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT uint8_t l_Lean_PersistentArray_anyM___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__5(lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___closed__10;
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___spec__1___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__1;
uint8_t l_Lean_Expr_hasMVar(lean_object*);
static lean_object* l_Lean_isTracingEnabledFor___at_Lean_Elab_Structural_findRecArg_go___spec__1___closed__1;
LEAN_EXPORT lean_object* l_Lean_Meta_visitLambda___at_Lean_Elab_Structural_findRecArg___spec__5(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__9___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Name_mkStr3(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_forEachExpr___at_Lean_Elab_Structural_findRecArg___spec__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_visitForall_visit___at_Lean_Elab_Structural_findRecArg___spec__9___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
size_t lean_usize_of_nat(lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__6;
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__10;
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_visitForall___at_Lean_Elab_Structural_findRecArg___spec__8(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_panic___at_String_toNat_x21___spec__1(lean_object*);
extern lean_object* l_Lean_binductionOnSuffix;
static lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg___closed__1;
LEAN_EXPORT lean_object* l_Lean_hasConst___at_Lean_Elab_Structural_findRecArg_go___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Subarray_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__14___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Array_contains___at_Lean_Meta_setMVarUserNamesAt___spec__1(lean_object*, lean_object*);
lean_object* lean_st_ref_take(lean_object*, lean_object*);
lean_object* l___private_Lean_Meta_Basic_0__Lean_Meta_withLetDeclImp___rarg(lean_object*, lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__15___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t lean_nat_dec_eq(lean_object*, lean_object*);
uint8_t lean_expr_eqv(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__3___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos___boxed(lean_object*, lean_object*);
lean_object* l_Lean_HashMapImp_find_x3f___at_Lean_Meta_forEachExpr_x27_visit___spec__1(lean_object*, lean_object*);
lean_object* l_Lean_instantiateMVars___at___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___spec__7(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__11(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___closed__4;
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__4;
LEAN_EXPORT lean_object* l_Lean_throwError___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___spec__1___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f___spec__2(lean_object*, lean_object*, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l___private_Lean_Meta_Basic_0__Lean_Meta_withLocalDeclImp___rarg(lean_object*, uint8_t, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Subarray_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__14___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__15;
LEAN_EXPORT lean_object* l_Lean_Meta_visitLambda_visit___at_Lean_Elab_Structural_findRecArg___spec__6___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_forEachExpr___at_Lean_Elab_Structural_findRecArg___spec__2___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_Expr_isMVar(lean_object*);
lean_object* l_Lean_Meta_isInductivePredicate(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___closed__6;
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBNode_findCore___at_Lean_Elab_Structural_findRecArg_go___spec__12(lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__16;
lean_object* lean_st_ref_get(lean_object*, lean_object*);
lean_object* l_Lean_setEnv___at_Lean_Meta_setInlineAttribute___spec__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT uint8_t l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__17(lean_object*, lean_object*, size_t, size_t);
LEAN_EXPORT uint8_t l_Lean_PersistentArray_anyMAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__6(lean_object*, lean_object*);
lean_object* lean_st_mk_ref(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_visitLet_visit___at_Lean_Elab_Structural_findRecArg___spec__12___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__10___rarg(lean_object*, uint8_t, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__4;
LEAN_EXPORT uint8_t l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__15(lean_object*, lean_object*, size_t, size_t);
LEAN_EXPORT uint8_t l___private_Init_Data_Array_Basic_0__Array_allDiffAux___at_Lean_Elab_Structural_findRecArg_go___spec__7(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__8___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_ST_Prim_Ref_modifyGetUnsafe___rarg___boxed(lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_levelZero;
LEAN_EXPORT lean_object* l_Lean_Meta_visitLambda_visit___at_Lean_Elab_Structural_findRecArg___spec__6(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed(lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__14;
lean_object* l_Lean_Meta_whnfD(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__18(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___closed__13;
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___closed__12;
uint8_t lean_name_eq(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__15(lean_object*, lean_object*, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Name_str___override(lean_object*, lean_object*);
static lean_object* l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__3;
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___closed__8;
LEAN_EXPORT lean_object* l_Lean_Meta_withLetDecl___at_Lean_Elab_Structural_findRecArg___spec__13___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l___private_Init_Util_0__mkPanicMessageWithDecl(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_LocalDecl_isLet(lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__2;
LEAN_EXPORT uint8_t l_Lean_PersistentArray_anyM___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__13(lean_object*, lean_object*);
lean_object* l_Lean_LocalDecl_fvarId(lean_object*);
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3(lean_object*, size_t, size_t, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7___rarg___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___closed__1;
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg(lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__19___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT uint8_t l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__16(lean_object*, lean_object*, size_t, size_t);
LEAN_EXPORT lean_object* l_Lean_isTracingEnabledFor___at_Lean_Elab_Structural_findRecArg_go___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__9(lean_object*);
LEAN_EXPORT uint8_t l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__7(lean_object*, lean_object*, size_t, size_t);
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_Environment_contains(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_exprDependsOn___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_inheritedTraceOptions;
lean_object* l_Lean_MessageData_ofExpr(lean_object*);
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg_go(lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__3;
lean_object* l_Array_extract___rarg(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___lambda__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__5(lean_object*);
LEAN_EXPORT lean_object* l_Lean_PersistentArray_anyMAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__14___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__6(lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4___lambda__1(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__10___boxed(lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__9;
LEAN_EXPORT lean_object* l_Lean_Meta_withLetDecl___at_Lean_Elab_Structural_findRecArg___spec__13(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitApp___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__12___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__11___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_visitForall_visit___at_Lean_Elab_Structural_findRecArg___spec__9(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___closed__3;
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__15___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_withLetDecl___at_Lean_Elab_Structural_findRecArg___spec__13___rarg(lean_object*, lean_object*, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___lambda__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_exprDependsOn___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_mapErrorImp___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7___rarg(lean_object*, uint8_t, lean_object*, lean_object*, uint8_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___closed__7;
uint8_t lean_nat_dec_eq(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_hasConst___at_Lean_Elab_Structural_findRecArg_go___spec__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_Meta_getFVarLocalDecl(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
extern lean_object* l_Lean_brecOnSuffix;
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__18;
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__19(lean_object*, lean_object*, lean_object*, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t lean_nat_dec_lt(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l___private_Init_Data_Array_Basic_0__Array_allDiffAux___at_Lean_Elab_Structural_findRecArg_go___spec__7___boxed(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_PersistentArray_anyM___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__5___boxed(lean_object*, lean_object*);
lean_object* l_Lean_indentExpr(lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___closed__5;
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__17;
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__6___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13___closed__1;
lean_object* l_Lean_addMessageContextFull___at_Lean_Meta_instAddMessageContextMetaM___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_ReaderT_bind___at_Lean_Elab_Structural_findRecArg_go___spec__4___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg___closed__2;
lean_object* l_Lean_LocalDecl_type(lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitApp___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__4___boxed(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f___spec__2___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__2;
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__6;
lean_object* lean_nat_sub(lean_object*, lean_object*);
lean_object* l_Lean_Expr_getAppFn(lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitApp___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__12(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__17___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__9___rarg(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___closed__2;
lean_object* l_Lean_RBNode_insert___at_Lean_FVarIdSet_insert___spec__1(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f___spec__1___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_expr_instantiate_rev(lean_object*, lean_object*);
LEAN_EXPORT uint8_t l_Array_anyMUnsafe_any___at_Lean_Elab_Structural_findRecArg___spec__1(lean_object*, lean_object*, size_t, size_t);
lean_object* l_Lean_mkHashMapImp___rarg(lean_object*);
LEAN_EXPORT uint8_t l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__9(lean_object*, lean_object*, size_t, size_t);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___closed__14;
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__2;
LEAN_EXPORT lean_object* l_Array_indexOfAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos___spec__1(lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_Name_quickCmp(lean_object*, lean_object*);
size_t lean_usize_add(size_t, size_t);
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10(lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_Expr_hasFVar(lean_object*);
LEAN_EXPORT uint8_t l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__8(lean_object*, lean_object*, size_t, size_t);
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27(lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_array_uget(lean_object*, size_t);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___closed__11;
lean_object* lean_st_ref_set(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_isTracingEnabledFor___at_Lean_Elab_Structural_findRecArg_go___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__2(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__12;
lean_object* l___private_Lean_Expr_0__Lean_Expr_getAppArgsAux(lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos___spec__2(lean_object*, lean_object*, size_t, size_t, lean_object*);
static lean_object* l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__1;
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__11___boxed(lean_object*, lean_object*, lean_object*);
lean_object* lean_array_get_size(lean_object*);
static lean_object* l_Lean_exprDependsOn___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__1___closed__1;
lean_object* lean_infer_type(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t lean_nat_dec_le(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_RBNode_findCore___at_Lean_Elab_Structural_findRecArg_go___spec__12___boxed(lean_object*, lean_object*);
uint8_t lean_usize_dec_lt(size_t, size_t);
LEAN_EXPORT lean_object* l_Lean_Meta_visitLet_visit___at_Lean_Elab_Structural_findRecArg___spec__12(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* l_Lean_getExprMVarAssignment_x3f___at___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___spec__1(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__10___rarg___boxed(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_nat_add(lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__5;
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f___spec__1(lean_object*, lean_object*, lean_object*, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4(lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
uint8_t l_Lean_Expr_isFVar(lean_object*);
LEAN_EXPORT lean_object* l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__7___boxed(lean_object*, lean_object*, lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_throwError___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___spec__1(lean_object*);
LEAN_EXPORT lean_object* l_Subarray_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__14(lean_object*, lean_object*, lean_object*, size_t, size_t, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*, lean_object*);
lean_object* lean_array_uset(lean_object*, size_t, lean_object*);
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitApp___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__4(lean_object*, lean_object*, lean_object*);
static lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__13;
lean_object* l_Nat_repr(lean_object*);
static lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___closed__1;
LEAN_EXPORT uint8_t l_Lean_PersistentArray_anyMAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__14(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__10(lean_object*, lean_object*);
LEAN_EXPORT lean_object* l_Array_indexOfAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; uint8_t x_5;
x_4 = lean_array_get_size(x_1);
x_5 = lean_nat_dec_lt(x_3, x_4);
lean_dec(x_4);
if (x_5 == 0)
{
lean_object* x_6;
lean_dec(x_3);
x_6 = lean_box(0);
return x_6;
}
else
{
lean_object* x_7; uint8_t x_8;
x_7 = lean_array_fget(x_1, x_3);
x_8 = lean_expr_eqv(x_7, x_2);
lean_dec(x_7);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10;
x_9 = lean_unsigned_to_nat(1u);
x_10 = lean_nat_add(x_3, x_9);
lean_dec(x_3);
x_3 = x_10;
goto _start;
}
else
{
lean_object* x_12;
x_12 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_12, 0, x_3);
return x_12;
}
}
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos___spec__2(lean_object* x_1, lean_object* x_2, size_t x_3, size_t x_4, lean_object* x_5) {
_start:
{
uint8_t x_6;
x_6 = lean_usize_dec_lt(x_4, x_3);
if (x_6 == 0)
{
return x_5;
}
else
{
lean_object* x_7; lean_object* x_8; lean_object* x_9;
x_7 = lean_array_uget(x_2, x_4);
x_8 = lean_unsigned_to_nat(0u);
x_9 = l_Array_indexOfAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos___spec__1(x_1, x_7, x_8);
lean_dec(x_7);
if (lean_obj_tag(x_9) == 0)
{
size_t x_10; size_t x_11;
x_10 = 1;
x_11 = lean_usize_add(x_4, x_10);
x_4 = x_11;
goto _start;
}
else
{
lean_object* x_13; uint8_t x_14;
x_13 = lean_ctor_get(x_9, 0);
lean_inc(x_13);
lean_dec(x_9);
x_14 = lean_nat_dec_lt(x_13, x_5);
if (x_14 == 0)
{
size_t x_15; size_t x_16;
lean_dec(x_13);
x_15 = 1;
x_16 = lean_usize_add(x_4, x_15);
x_4 = x_16;
goto _start;
}
else
{
size_t x_18; size_t x_19;
lean_dec(x_5);
x_18 = 1;
x_19 = lean_usize_add(x_4, x_18);
x_4 = x_19;
x_5 = x_13;
goto _start;
}
}
}
}
}
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; size_t x_5; size_t x_6; lean_object* x_7;
x_3 = lean_array_get_size(x_1);
x_4 = lean_array_get_size(x_2);
x_5 = lean_usize_of_nat(x_4);
lean_dec(x_4);
x_6 = 0;
x_7 = l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos___spec__2(x_1, x_2, x_5, x_6, x_3);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Array_indexOfAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l_Array_indexOfAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos___spec__1(x_1, x_2, x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
size_t x_6; size_t x_7; lean_object* x_8;
x_6 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_7 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_8 = l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos___spec__2(x_1, x_2, x_6, x_7, x_5);
lean_dec(x_2);
lean_dec(x_1);
return x_8;
}
}
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitApp___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__4(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_2) == 5)
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_4 = lean_ctor_get(x_2, 0);
lean_inc(x_4);
x_5 = lean_ctor_get(x_2, 1);
lean_inc(x_5);
lean_dec(x_2);
x_6 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitApp___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__4(x_1, x_4, x_3);
x_7 = lean_ctor_get(x_6, 0);
lean_inc(x_7);
x_8 = lean_unbox(x_7);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10;
lean_dec(x_7);
x_9 = lean_ctor_get(x_6, 1);
lean_inc(x_9);
lean_dec(x_6);
x_10 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2(x_1, x_5, x_9);
return x_10;
}
else
{
uint8_t x_11;
lean_dec(x_5);
x_11 = !lean_is_exclusive(x_6);
if (x_11 == 0)
{
lean_object* x_12;
x_12 = lean_ctor_get(x_6, 0);
lean_dec(x_12);
return x_6;
}
else
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_ctor_get(x_6, 1);
lean_inc(x_13);
lean_dec(x_6);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_7);
lean_ctor_set(x_14, 1, x_13);
return x_14;
}
}
}
else
{
lean_object* x_15;
x_15 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2(x_1, x_2, x_3);
return x_15;
}
}
}
LEAN_EXPORT uint8_t l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__7(lean_object* x_1, lean_object* x_2, size_t x_3, size_t x_4) {
_start:
{
uint8_t x_5;
x_5 = lean_usize_dec_eq(x_3, x_4);
if (x_5 == 0)
{
lean_object* x_6; uint8_t x_7;
x_6 = lean_array_uget(x_2, x_3);
x_7 = l_Lean_PersistentArray_anyMAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__6(x_1, x_6);
if (x_7 == 0)
{
size_t x_8; size_t x_9;
x_8 = 1;
x_9 = lean_usize_add(x_3, x_8);
x_3 = x_9;
goto _start;
}
else
{
uint8_t x_11;
x_11 = 1;
return x_11;
}
}
else
{
uint8_t x_12;
x_12 = 0;
return x_12;
}
}
}
LEAN_EXPORT uint8_t l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__8(lean_object* x_1, lean_object* x_2, size_t x_3, size_t x_4) {
_start:
{
uint8_t x_5;
x_5 = lean_usize_dec_eq(x_3, x_4);
if (x_5 == 0)
{
lean_object* x_6;
x_6 = lean_array_uget(x_2, x_3);
if (lean_obj_tag(x_6) == 0)
{
size_t x_7; size_t x_8;
x_7 = 1;
x_8 = lean_usize_add(x_3, x_7);
x_3 = x_8;
goto _start;
}
else
{
lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_10 = lean_ctor_get(x_6, 0);
lean_inc(x_10);
lean_dec(x_6);
x_11 = l_Lean_LocalDecl_fvarId(x_10);
lean_dec(x_10);
x_12 = lean_name_eq(x_1, x_11);
lean_dec(x_11);
if (x_12 == 0)
{
size_t x_13; size_t x_14;
x_13 = 1;
x_14 = lean_usize_add(x_3, x_13);
x_3 = x_14;
goto _start;
}
else
{
uint8_t x_16;
x_16 = 1;
return x_16;
}
}
}
else
{
uint8_t x_17;
x_17 = 0;
return x_17;
}
}
}
LEAN_EXPORT uint8_t l_Lean_PersistentArray_anyMAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__6(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; uint8_t x_6;
x_3 = lean_ctor_get(x_2, 0);
lean_inc(x_3);
lean_dec(x_2);
x_4 = lean_array_get_size(x_3);
x_5 = lean_unsigned_to_nat(0u);
x_6 = lean_nat_dec_lt(x_5, x_4);
if (x_6 == 0)
{
uint8_t x_7;
lean_dec(x_4);
lean_dec(x_3);
x_7 = 0;
return x_7;
}
else
{
uint8_t x_8;
x_8 = lean_nat_dec_le(x_4, x_4);
if (x_8 == 0)
{
uint8_t x_9;
lean_dec(x_4);
lean_dec(x_3);
x_9 = 0;
return x_9;
}
else
{
size_t x_10; size_t x_11; uint8_t x_12;
x_10 = 0;
x_11 = lean_usize_of_nat(x_4);
lean_dec(x_4);
x_12 = l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__7(x_1, x_3, x_10, x_11);
lean_dec(x_3);
return x_12;
}
}
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; uint8_t x_16;
x_13 = lean_ctor_get(x_2, 0);
lean_inc(x_13);
lean_dec(x_2);
x_14 = lean_array_get_size(x_13);
x_15 = lean_unsigned_to_nat(0u);
x_16 = lean_nat_dec_lt(x_15, x_14);
if (x_16 == 0)
{
uint8_t x_17;
lean_dec(x_14);
lean_dec(x_13);
x_17 = 0;
return x_17;
}
else
{
uint8_t x_18;
x_18 = lean_nat_dec_le(x_14, x_14);
if (x_18 == 0)
{
uint8_t x_19;
lean_dec(x_14);
lean_dec(x_13);
x_19 = 0;
return x_19;
}
else
{
size_t x_20; size_t x_21; uint8_t x_22;
x_20 = 0;
x_21 = lean_usize_of_nat(x_14);
lean_dec(x_14);
x_22 = l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__8(x_1, x_13, x_20, x_21);
lean_dec(x_13);
return x_22;
}
}
}
}
}
LEAN_EXPORT uint8_t l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__9(lean_object* x_1, lean_object* x_2, size_t x_3, size_t x_4) {
_start:
{
uint8_t x_5;
x_5 = lean_usize_dec_eq(x_3, x_4);
if (x_5 == 0)
{
lean_object* x_6;
x_6 = lean_array_uget(x_2, x_3);
if (lean_obj_tag(x_6) == 0)
{
size_t x_7; size_t x_8;
x_7 = 1;
x_8 = lean_usize_add(x_3, x_7);
x_3 = x_8;
goto _start;
}
else
{
lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_10 = lean_ctor_get(x_6, 0);
lean_inc(x_10);
lean_dec(x_6);
x_11 = l_Lean_LocalDecl_fvarId(x_10);
lean_dec(x_10);
x_12 = lean_name_eq(x_1, x_11);
lean_dec(x_11);
if (x_12 == 0)
{
size_t x_13; size_t x_14;
x_13 = 1;
x_14 = lean_usize_add(x_3, x_13);
x_3 = x_14;
goto _start;
}
else
{
uint8_t x_16;
x_16 = 1;
return x_16;
}
}
}
else
{
uint8_t x_17;
x_17 = 0;
return x_17;
}
}
}
LEAN_EXPORT uint8_t l_Lean_PersistentArray_anyM___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__5(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; uint8_t x_4;
x_3 = lean_ctor_get(x_2, 0);
lean_inc(x_3);
x_4 = l_Lean_PersistentArray_anyMAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__6(x_1, x_3);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_5 = lean_ctor_get(x_2, 1);
lean_inc(x_5);
lean_dec(x_2);
x_6 = lean_array_get_size(x_5);
x_7 = lean_unsigned_to_nat(0u);
x_8 = lean_nat_dec_lt(x_7, x_6);
if (x_8 == 0)
{
uint8_t x_9;
lean_dec(x_6);
lean_dec(x_5);
x_9 = 0;
return x_9;
}
else
{
uint8_t x_10;
x_10 = lean_nat_dec_le(x_6, x_6);
if (x_10 == 0)
{
uint8_t x_11;
lean_dec(x_6);
lean_dec(x_5);
x_11 = 0;
return x_11;
}
else
{
size_t x_12; size_t x_13; uint8_t x_14;
x_12 = 0;
x_13 = lean_usize_of_nat(x_6);
lean_dec(x_6);
x_14 = l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__9(x_1, x_5, x_12, x_13);
lean_dec(x_5);
return x_14;
}
}
}
else
{
lean_dec(x_2);
return x_4;
}
}
}
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__3(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
switch (lean_obj_tag(x_2)) {
case 1:
{
lean_object* x_4; uint8_t x_5; lean_object* x_6; lean_object* x_7;
x_4 = lean_ctor_get(x_2, 0);
lean_inc(x_4);
lean_dec(x_2);
x_5 = lean_name_eq(x_1, x_4);
lean_dec(x_4);
x_6 = lean_box(x_5);
x_7 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_7, 0, x_6);
lean_ctor_set(x_7, 1, x_3);
return x_7;
}
case 2:
{
lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_8 = lean_ctor_get(x_2, 0);
lean_inc(x_8);
lean_dec(x_2);
lean_inc(x_8);
x_9 = l_Lean_getExprMVarAssignment_x3f___at___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___spec__1(x_8, x_3);
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
if (lean_obj_tag(x_10) == 0)
{
uint8_t x_11;
x_11 = !lean_is_exclusive(x_9);
if (x_11 == 0)
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; uint8_t x_18; lean_object* x_19;
x_12 = lean_ctor_get(x_9, 1);
x_13 = lean_ctor_get(x_9, 0);
lean_dec(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
x_15 = l_Lean_MetavarContext_getDecl(x_14, x_8);
x_16 = lean_ctor_get(x_15, 1);
lean_inc(x_16);
lean_dec(x_15);
x_17 = lean_ctor_get(x_16, 1);
lean_inc(x_17);
lean_dec(x_16);
x_18 = l_Lean_PersistentArray_anyM___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__5(x_1, x_17);
x_19 = lean_box(x_18);
lean_ctor_set(x_9, 0, x_19);
return x_9;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; uint8_t x_25; lean_object* x_26; lean_object* x_27;
x_20 = lean_ctor_get(x_9, 1);
lean_inc(x_20);
lean_dec(x_9);
x_21 = lean_ctor_get(x_20, 1);
lean_inc(x_21);
x_22 = l_Lean_MetavarContext_getDecl(x_21, x_8);
x_23 = lean_ctor_get(x_22, 1);
lean_inc(x_23);
lean_dec(x_22);
x_24 = lean_ctor_get(x_23, 1);
lean_inc(x_24);
lean_dec(x_23);
x_25 = l_Lean_PersistentArray_anyM___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__5(x_1, x_24);
x_26 = lean_box(x_25);
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_27, 1, x_20);
return x_27;
}
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
lean_dec(x_8);
x_28 = lean_ctor_get(x_9, 1);
lean_inc(x_28);
lean_dec(x_9);
x_29 = lean_ctor_get(x_10, 0);
lean_inc(x_29);
lean_dec(x_10);
x_30 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2(x_1, x_29, x_28);
return x_30;
}
}
case 5:
{
lean_object* x_31; uint8_t x_32;
x_31 = l_Lean_Expr_getAppFn(x_2);
x_32 = l_Lean_Expr_isMVar(x_31);
if (x_32 == 0)
{
lean_object* x_33;
lean_dec(x_31);
x_33 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitApp___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__4(x_1, x_2, x_3);
return x_33;
}
else
{
lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; uint8_t x_38;
lean_inc(x_2);
x_34 = l_Lean_instantiateMVars___at___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___spec__7(x_2, x_3);
x_35 = lean_ctor_get(x_34, 0);
lean_inc(x_35);
x_36 = lean_ctor_get(x_34, 1);
lean_inc(x_36);
lean_dec(x_34);
x_37 = l_Lean_Expr_getAppFn(x_35);
x_38 = lean_expr_eqv(x_37, x_31);
lean_dec(x_31);
lean_dec(x_37);
if (x_38 == 0)
{
lean_dec(x_2);
x_2 = x_35;
x_3 = x_36;
goto _start;
}
else
{
lean_object* x_40;
lean_dec(x_35);
x_40 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitApp___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__4(x_1, x_2, x_36);
return x_40;
}
}
}
case 6:
{
lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; uint8_t x_45;
x_41 = lean_ctor_get(x_2, 1);
lean_inc(x_41);
x_42 = lean_ctor_get(x_2, 2);
lean_inc(x_42);
lean_dec(x_2);
x_43 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2(x_1, x_41, x_3);
x_44 = lean_ctor_get(x_43, 0);
lean_inc(x_44);
x_45 = lean_unbox(x_44);
if (x_45 == 0)
{
lean_object* x_46; lean_object* x_47;
lean_dec(x_44);
x_46 = lean_ctor_get(x_43, 1);
lean_inc(x_46);
lean_dec(x_43);
x_47 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2(x_1, x_42, x_46);
return x_47;
}
else
{
uint8_t x_48;
lean_dec(x_42);
x_48 = !lean_is_exclusive(x_43);
if (x_48 == 0)
{
lean_object* x_49;
x_49 = lean_ctor_get(x_43, 0);
lean_dec(x_49);
return x_43;
}
else
{
lean_object* x_50; lean_object* x_51;
x_50 = lean_ctor_get(x_43, 1);
lean_inc(x_50);
lean_dec(x_43);
x_51 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_51, 0, x_44);
lean_ctor_set(x_51, 1, x_50);
return x_51;
}
}
}
case 7:
{
lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; uint8_t x_56;
x_52 = lean_ctor_get(x_2, 1);
lean_inc(x_52);
x_53 = lean_ctor_get(x_2, 2);
lean_inc(x_53);
lean_dec(x_2);
x_54 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2(x_1, x_52, x_3);
x_55 = lean_ctor_get(x_54, 0);
lean_inc(x_55);
x_56 = lean_unbox(x_55);
if (x_56 == 0)
{
lean_object* x_57; lean_object* x_58;
lean_dec(x_55);
x_57 = lean_ctor_get(x_54, 1);
lean_inc(x_57);
lean_dec(x_54);
x_58 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2(x_1, x_53, x_57);
return x_58;
}
else
{
uint8_t x_59;
lean_dec(x_53);
x_59 = !lean_is_exclusive(x_54);
if (x_59 == 0)
{
lean_object* x_60;
x_60 = lean_ctor_get(x_54, 0);
lean_dec(x_60);
return x_54;
}
else
{
lean_object* x_61; lean_object* x_62;
x_61 = lean_ctor_get(x_54, 1);
lean_inc(x_61);
lean_dec(x_54);
x_62 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_62, 0, x_55);
lean_ctor_set(x_62, 1, x_61);
return x_62;
}
}
}
case 8:
{
lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67; uint8_t x_68;
x_63 = lean_ctor_get(x_2, 1);
lean_inc(x_63);
x_64 = lean_ctor_get(x_2, 2);
lean_inc(x_64);
x_65 = lean_ctor_get(x_2, 3);
lean_inc(x_65);
lean_dec(x_2);
x_66 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2(x_1, x_63, x_3);
x_67 = lean_ctor_get(x_66, 0);
lean_inc(x_67);
x_68 = lean_unbox(x_67);
if (x_68 == 0)
{
lean_object* x_69; lean_object* x_70; lean_object* x_71; uint8_t x_72;
lean_dec(x_67);
x_69 = lean_ctor_get(x_66, 1);
lean_inc(x_69);
lean_dec(x_66);
x_70 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2(x_1, x_64, x_69);
x_71 = lean_ctor_get(x_70, 0);
lean_inc(x_71);
x_72 = lean_unbox(x_71);
if (x_72 == 0)
{
lean_object* x_73; lean_object* x_74;
lean_dec(x_71);
x_73 = lean_ctor_get(x_70, 1);
lean_inc(x_73);
lean_dec(x_70);
x_74 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2(x_1, x_65, x_73);
return x_74;
}
else
{
uint8_t x_75;
lean_dec(x_65);
x_75 = !lean_is_exclusive(x_70);
if (x_75 == 0)
{
lean_object* x_76;
x_76 = lean_ctor_get(x_70, 0);
lean_dec(x_76);
return x_70;
}
else
{
lean_object* x_77; lean_object* x_78;
x_77 = lean_ctor_get(x_70, 1);
lean_inc(x_77);
lean_dec(x_70);
x_78 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_78, 0, x_71);
lean_ctor_set(x_78, 1, x_77);
return x_78;
}
}
}
else
{
uint8_t x_79;
lean_dec(x_65);
lean_dec(x_64);
x_79 = !lean_is_exclusive(x_66);
if (x_79 == 0)
{
lean_object* x_80;
x_80 = lean_ctor_get(x_66, 0);
lean_dec(x_80);
return x_66;
}
else
{
lean_object* x_81; lean_object* x_82;
x_81 = lean_ctor_get(x_66, 1);
lean_inc(x_81);
lean_dec(x_66);
x_82 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_82, 0, x_67);
lean_ctor_set(x_82, 1, x_81);
return x_82;
}
}
}
case 10:
{
lean_object* x_83; lean_object* x_84;
x_83 = lean_ctor_get(x_2, 1);
lean_inc(x_83);
lean_dec(x_2);
x_84 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2(x_1, x_83, x_3);
return x_84;
}
case 11:
{
lean_object* x_85; lean_object* x_86;
x_85 = lean_ctor_get(x_2, 2);
lean_inc(x_85);
lean_dec(x_2);
x_86 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2(x_1, x_85, x_3);
return x_86;
}
default:
{
uint8_t x_87; lean_object* x_88; lean_object* x_89;
lean_dec(x_2);
x_87 = 0;
x_88 = lean_box(x_87);
x_89 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_89, 0, x_88);
lean_ctor_set(x_89, 1, x_3);
return x_89;
}
}
}
}
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; uint8_t x_6;
lean_inc(x_2);
x_4 = l___private_Lean_MetavarContext_0__Lean_DependsOn_shouldVisit(x_2, x_3);
x_5 = lean_ctor_get(x_4, 0);
lean_inc(x_5);
x_6 = lean_unbox(x_5);
lean_dec(x_5);
if (x_6 == 0)
{
uint8_t x_7;
lean_dec(x_2);
x_7 = !lean_is_exclusive(x_4);
if (x_7 == 0)
{
lean_object* x_8; uint8_t x_9; lean_object* x_10;
x_8 = lean_ctor_get(x_4, 0);
lean_dec(x_8);
x_9 = 0;
x_10 = lean_box(x_9);
lean_ctor_set(x_4, 0, x_10);
return x_4;
}
else
{
lean_object* x_11; uint8_t x_12; lean_object* x_13; lean_object* x_14;
x_11 = lean_ctor_get(x_4, 1);
lean_inc(x_11);
lean_dec(x_4);
x_12 = 0;
x_13 = lean_box(x_12);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_14, 1, x_11);
return x_14;
}
}
else
{
lean_object* x_15; lean_object* x_16;
x_15 = lean_ctor_get(x_4, 1);
lean_inc(x_15);
lean_dec(x_4);
x_16 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__3(x_1, x_2, x_15);
return x_16;
}
}
}
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitApp___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__12(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
if (lean_obj_tag(x_2) == 5)
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_4 = lean_ctor_get(x_2, 0);
lean_inc(x_4);
x_5 = lean_ctor_get(x_2, 1);
lean_inc(x_5);
lean_dec(x_2);
x_6 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitApp___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__12(x_1, x_4, x_3);
x_7 = lean_ctor_get(x_6, 0);
lean_inc(x_7);
x_8 = lean_unbox(x_7);
if (x_8 == 0)
{
lean_object* x_9; lean_object* x_10;
lean_dec(x_7);
x_9 = lean_ctor_get(x_6, 1);
lean_inc(x_9);
lean_dec(x_6);
x_10 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10(x_1, x_5, x_9);
return x_10;
}
else
{
uint8_t x_11;
lean_dec(x_5);
x_11 = !lean_is_exclusive(x_6);
if (x_11 == 0)
{
lean_object* x_12;
x_12 = lean_ctor_get(x_6, 0);
lean_dec(x_12);
return x_6;
}
else
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_ctor_get(x_6, 1);
lean_inc(x_13);
lean_dec(x_6);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_7);
lean_ctor_set(x_14, 1, x_13);
return x_14;
}
}
}
else
{
lean_object* x_15;
x_15 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10(x_1, x_2, x_3);
return x_15;
}
}
}
LEAN_EXPORT uint8_t l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__15(lean_object* x_1, lean_object* x_2, size_t x_3, size_t x_4) {
_start:
{
uint8_t x_5;
x_5 = lean_usize_dec_eq(x_3, x_4);
if (x_5 == 0)
{
lean_object* x_6; uint8_t x_7;
x_6 = lean_array_uget(x_2, x_3);
x_7 = l_Lean_PersistentArray_anyMAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__14(x_1, x_6);
if (x_7 == 0)
{
size_t x_8; size_t x_9;
x_8 = 1;
x_9 = lean_usize_add(x_3, x_8);
x_3 = x_9;
goto _start;
}
else
{
uint8_t x_11;
x_11 = 1;
return x_11;
}
}
else
{
uint8_t x_12;
x_12 = 0;
return x_12;
}
}
}
LEAN_EXPORT uint8_t l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__16(lean_object* x_1, lean_object* x_2, size_t x_3, size_t x_4) {
_start:
{
uint8_t x_5;
x_5 = lean_usize_dec_eq(x_3, x_4);
if (x_5 == 0)
{
lean_object* x_6;
x_6 = lean_array_uget(x_2, x_3);
if (lean_obj_tag(x_6) == 0)
{
size_t x_7; size_t x_8;
x_7 = 1;
x_8 = lean_usize_add(x_3, x_7);
x_3 = x_8;
goto _start;
}
else
{
lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_10 = lean_ctor_get(x_6, 0);
lean_inc(x_10);
lean_dec(x_6);
x_11 = l_Lean_LocalDecl_fvarId(x_10);
lean_dec(x_10);
x_12 = lean_name_eq(x_1, x_11);
lean_dec(x_11);
if (x_12 == 0)
{
size_t x_13; size_t x_14;
x_13 = 1;
x_14 = lean_usize_add(x_3, x_13);
x_3 = x_14;
goto _start;
}
else
{
uint8_t x_16;
x_16 = 1;
return x_16;
}
}
}
else
{
uint8_t x_17;
x_17 = 0;
return x_17;
}
}
}
LEAN_EXPORT uint8_t l_Lean_PersistentArray_anyMAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__14(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_2) == 0)
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; uint8_t x_6;
x_3 = lean_ctor_get(x_2, 0);
lean_inc(x_3);
lean_dec(x_2);
x_4 = lean_array_get_size(x_3);
x_5 = lean_unsigned_to_nat(0u);
x_6 = lean_nat_dec_lt(x_5, x_4);
if (x_6 == 0)
{
uint8_t x_7;
lean_dec(x_4);
lean_dec(x_3);
x_7 = 0;
return x_7;
}
else
{
uint8_t x_8;
x_8 = lean_nat_dec_le(x_4, x_4);
if (x_8 == 0)
{
uint8_t x_9;
lean_dec(x_4);
lean_dec(x_3);
x_9 = 0;
return x_9;
}
else
{
size_t x_10; size_t x_11; uint8_t x_12;
x_10 = 0;
x_11 = lean_usize_of_nat(x_4);
lean_dec(x_4);
x_12 = l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__15(x_1, x_3, x_10, x_11);
lean_dec(x_3);
return x_12;
}
}
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; uint8_t x_16;
x_13 = lean_ctor_get(x_2, 0);
lean_inc(x_13);
lean_dec(x_2);
x_14 = lean_array_get_size(x_13);
x_15 = lean_unsigned_to_nat(0u);
x_16 = lean_nat_dec_lt(x_15, x_14);
if (x_16 == 0)
{
uint8_t x_17;
lean_dec(x_14);
lean_dec(x_13);
x_17 = 0;
return x_17;
}
else
{
uint8_t x_18;
x_18 = lean_nat_dec_le(x_14, x_14);
if (x_18 == 0)
{
uint8_t x_19;
lean_dec(x_14);
lean_dec(x_13);
x_19 = 0;
return x_19;
}
else
{
size_t x_20; size_t x_21; uint8_t x_22;
x_20 = 0;
x_21 = lean_usize_of_nat(x_14);
lean_dec(x_14);
x_22 = l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__16(x_1, x_13, x_20, x_21);
lean_dec(x_13);
return x_22;
}
}
}
}
}
LEAN_EXPORT uint8_t l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__17(lean_object* x_1, lean_object* x_2, size_t x_3, size_t x_4) {
_start:
{
uint8_t x_5;
x_5 = lean_usize_dec_eq(x_3, x_4);
if (x_5 == 0)
{
lean_object* x_6;
x_6 = lean_array_uget(x_2, x_3);
if (lean_obj_tag(x_6) == 0)
{
size_t x_7; size_t x_8;
x_7 = 1;
x_8 = lean_usize_add(x_3, x_7);
x_3 = x_8;
goto _start;
}
else
{
lean_object* x_10; lean_object* x_11; uint8_t x_12;
x_10 = lean_ctor_get(x_6, 0);
lean_inc(x_10);
lean_dec(x_6);
x_11 = l_Lean_LocalDecl_fvarId(x_10);
lean_dec(x_10);
x_12 = lean_name_eq(x_1, x_11);
lean_dec(x_11);
if (x_12 == 0)
{
size_t x_13; size_t x_14;
x_13 = 1;
x_14 = lean_usize_add(x_3, x_13);
x_3 = x_14;
goto _start;
}
else
{
uint8_t x_16;
x_16 = 1;
return x_16;
}
}
}
else
{
uint8_t x_17;
x_17 = 0;
return x_17;
}
}
}
LEAN_EXPORT uint8_t l_Lean_PersistentArray_anyM___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__13(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; uint8_t x_4;
x_3 = lean_ctor_get(x_2, 0);
lean_inc(x_3);
x_4 = l_Lean_PersistentArray_anyMAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__14(x_1, x_3);
if (x_4 == 0)
{
lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_5 = lean_ctor_get(x_2, 1);
lean_inc(x_5);
lean_dec(x_2);
x_6 = lean_array_get_size(x_5);
x_7 = lean_unsigned_to_nat(0u);
x_8 = lean_nat_dec_lt(x_7, x_6);
if (x_8 == 0)
{
uint8_t x_9;
lean_dec(x_6);
lean_dec(x_5);
x_9 = 0;
return x_9;
}
else
{
uint8_t x_10;
x_10 = lean_nat_dec_le(x_6, x_6);
if (x_10 == 0)
{
uint8_t x_11;
lean_dec(x_6);
lean_dec(x_5);
x_11 = 0;
return x_11;
}
else
{
size_t x_12; size_t x_13; uint8_t x_14;
x_12 = 0;
x_13 = lean_usize_of_nat(x_6);
lean_dec(x_6);
x_14 = l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__17(x_1, x_5, x_12, x_13);
lean_dec(x_5);
return x_14;
}
}
}
else
{
lean_dec(x_2);
return x_4;
}
}
}
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__11(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
switch (lean_obj_tag(x_2)) {
case 1:
{
lean_object* x_4; uint8_t x_5; lean_object* x_6; lean_object* x_7;
x_4 = lean_ctor_get(x_2, 0);
lean_inc(x_4);
lean_dec(x_2);
x_5 = lean_name_eq(x_1, x_4);
lean_dec(x_4);
x_6 = lean_box(x_5);
x_7 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_7, 0, x_6);
lean_ctor_set(x_7, 1, x_3);
return x_7;
}
case 2:
{
lean_object* x_8; lean_object* x_9; lean_object* x_10;
x_8 = lean_ctor_get(x_2, 0);
lean_inc(x_8);
lean_dec(x_2);
lean_inc(x_8);
x_9 = l_Lean_getExprMVarAssignment_x3f___at___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___spec__1(x_8, x_3);
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
if (lean_obj_tag(x_10) == 0)
{
uint8_t x_11;
x_11 = !lean_is_exclusive(x_9);
if (x_11 == 0)
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; uint8_t x_18; lean_object* x_19;
x_12 = lean_ctor_get(x_9, 1);
x_13 = lean_ctor_get(x_9, 0);
lean_dec(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
x_15 = l_Lean_MetavarContext_getDecl(x_14, x_8);
x_16 = lean_ctor_get(x_15, 1);
lean_inc(x_16);
lean_dec(x_15);
x_17 = lean_ctor_get(x_16, 1);
lean_inc(x_17);
lean_dec(x_16);
x_18 = l_Lean_PersistentArray_anyM___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__13(x_1, x_17);
x_19 = lean_box(x_18);
lean_ctor_set(x_9, 0, x_19);
return x_9;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24; uint8_t x_25; lean_object* x_26; lean_object* x_27;
x_20 = lean_ctor_get(x_9, 1);
lean_inc(x_20);
lean_dec(x_9);
x_21 = lean_ctor_get(x_20, 1);
lean_inc(x_21);
x_22 = l_Lean_MetavarContext_getDecl(x_21, x_8);
x_23 = lean_ctor_get(x_22, 1);
lean_inc(x_23);
lean_dec(x_22);
x_24 = lean_ctor_get(x_23, 1);
lean_inc(x_24);
lean_dec(x_23);
x_25 = l_Lean_PersistentArray_anyM___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__13(x_1, x_24);
x_26 = lean_box(x_25);
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_26);
lean_ctor_set(x_27, 1, x_20);
return x_27;
}
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
lean_dec(x_8);
x_28 = lean_ctor_get(x_9, 1);
lean_inc(x_28);
lean_dec(x_9);
x_29 = lean_ctor_get(x_10, 0);
lean_inc(x_29);
lean_dec(x_10);
x_30 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10(x_1, x_29, x_28);
return x_30;
}
}
case 5:
{
lean_object* x_31; uint8_t x_32;
x_31 = l_Lean_Expr_getAppFn(x_2);
x_32 = l_Lean_Expr_isMVar(x_31);
if (x_32 == 0)
{
lean_object* x_33;
lean_dec(x_31);
x_33 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitApp___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__12(x_1, x_2, x_3);
return x_33;
}
else
{
lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; uint8_t x_38;
lean_inc(x_2);
x_34 = l_Lean_instantiateMVars___at___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___spec__7(x_2, x_3);
x_35 = lean_ctor_get(x_34, 0);
lean_inc(x_35);
x_36 = lean_ctor_get(x_34, 1);
lean_inc(x_36);
lean_dec(x_34);
x_37 = l_Lean_Expr_getAppFn(x_35);
x_38 = lean_expr_eqv(x_37, x_31);
lean_dec(x_31);
lean_dec(x_37);
if (x_38 == 0)
{
lean_dec(x_2);
x_2 = x_35;
x_3 = x_36;
goto _start;
}
else
{
lean_object* x_40;
lean_dec(x_35);
x_40 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitApp___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__12(x_1, x_2, x_36);
return x_40;
}
}
}
case 6:
{
lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; uint8_t x_45;
x_41 = lean_ctor_get(x_2, 1);
lean_inc(x_41);
x_42 = lean_ctor_get(x_2, 2);
lean_inc(x_42);
lean_dec(x_2);
x_43 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10(x_1, x_41, x_3);
x_44 = lean_ctor_get(x_43, 0);
lean_inc(x_44);
x_45 = lean_unbox(x_44);
if (x_45 == 0)
{
lean_object* x_46; lean_object* x_47;
lean_dec(x_44);
x_46 = lean_ctor_get(x_43, 1);
lean_inc(x_46);
lean_dec(x_43);
x_47 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10(x_1, x_42, x_46);
return x_47;
}
else
{
uint8_t x_48;
lean_dec(x_42);
x_48 = !lean_is_exclusive(x_43);
if (x_48 == 0)
{
lean_object* x_49;
x_49 = lean_ctor_get(x_43, 0);
lean_dec(x_49);
return x_43;
}
else
{
lean_object* x_50; lean_object* x_51;
x_50 = lean_ctor_get(x_43, 1);
lean_inc(x_50);
lean_dec(x_43);
x_51 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_51, 0, x_44);
lean_ctor_set(x_51, 1, x_50);
return x_51;
}
}
}
case 7:
{
lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; uint8_t x_56;
x_52 = lean_ctor_get(x_2, 1);
lean_inc(x_52);
x_53 = lean_ctor_get(x_2, 2);
lean_inc(x_53);
lean_dec(x_2);
x_54 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10(x_1, x_52, x_3);
x_55 = lean_ctor_get(x_54, 0);
lean_inc(x_55);
x_56 = lean_unbox(x_55);
if (x_56 == 0)
{
lean_object* x_57; lean_object* x_58;
lean_dec(x_55);
x_57 = lean_ctor_get(x_54, 1);
lean_inc(x_57);
lean_dec(x_54);
x_58 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10(x_1, x_53, x_57);
return x_58;
}
else
{
uint8_t x_59;
lean_dec(x_53);
x_59 = !lean_is_exclusive(x_54);
if (x_59 == 0)
{
lean_object* x_60;
x_60 = lean_ctor_get(x_54, 0);
lean_dec(x_60);
return x_54;
}
else
{
lean_object* x_61; lean_object* x_62;
x_61 = lean_ctor_get(x_54, 1);
lean_inc(x_61);
lean_dec(x_54);
x_62 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_62, 0, x_55);
lean_ctor_set(x_62, 1, x_61);
return x_62;
}
}
}
case 8:
{
lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67; uint8_t x_68;
x_63 = lean_ctor_get(x_2, 1);
lean_inc(x_63);
x_64 = lean_ctor_get(x_2, 2);
lean_inc(x_64);
x_65 = lean_ctor_get(x_2, 3);
lean_inc(x_65);
lean_dec(x_2);
x_66 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10(x_1, x_63, x_3);
x_67 = lean_ctor_get(x_66, 0);
lean_inc(x_67);
x_68 = lean_unbox(x_67);
if (x_68 == 0)
{
lean_object* x_69; lean_object* x_70; lean_object* x_71; uint8_t x_72;
lean_dec(x_67);
x_69 = lean_ctor_get(x_66, 1);
lean_inc(x_69);
lean_dec(x_66);
x_70 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10(x_1, x_64, x_69);
x_71 = lean_ctor_get(x_70, 0);
lean_inc(x_71);
x_72 = lean_unbox(x_71);
if (x_72 == 0)
{
lean_object* x_73; lean_object* x_74;
lean_dec(x_71);
x_73 = lean_ctor_get(x_70, 1);
lean_inc(x_73);
lean_dec(x_70);
x_74 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10(x_1, x_65, x_73);
return x_74;
}
else
{
uint8_t x_75;
lean_dec(x_65);
x_75 = !lean_is_exclusive(x_70);
if (x_75 == 0)
{
lean_object* x_76;
x_76 = lean_ctor_get(x_70, 0);
lean_dec(x_76);
return x_70;
}
else
{
lean_object* x_77; lean_object* x_78;
x_77 = lean_ctor_get(x_70, 1);
lean_inc(x_77);
lean_dec(x_70);
x_78 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_78, 0, x_71);
lean_ctor_set(x_78, 1, x_77);
return x_78;
}
}
}
else
{
uint8_t x_79;
lean_dec(x_65);
lean_dec(x_64);
x_79 = !lean_is_exclusive(x_66);
if (x_79 == 0)
{
lean_object* x_80;
x_80 = lean_ctor_get(x_66, 0);
lean_dec(x_80);
return x_66;
}
else
{
lean_object* x_81; lean_object* x_82;
x_81 = lean_ctor_get(x_66, 1);
lean_inc(x_81);
lean_dec(x_66);
x_82 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_82, 0, x_67);
lean_ctor_set(x_82, 1, x_81);
return x_82;
}
}
}
case 10:
{
lean_object* x_83; lean_object* x_84;
x_83 = lean_ctor_get(x_2, 1);
lean_inc(x_83);
lean_dec(x_2);
x_84 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10(x_1, x_83, x_3);
return x_84;
}
case 11:
{
lean_object* x_85; lean_object* x_86;
x_85 = lean_ctor_get(x_2, 2);
lean_inc(x_85);
lean_dec(x_2);
x_86 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10(x_1, x_85, x_3);
return x_86;
}
default:
{
uint8_t x_87; lean_object* x_88; lean_object* x_89;
lean_dec(x_2);
x_87 = 0;
x_88 = lean_box(x_87);
x_89 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_89, 0, x_88);
lean_ctor_set(x_89, 1, x_3);
return x_89;
}
}
}
}
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; uint8_t x_6;
lean_inc(x_2);
x_4 = l___private_Lean_MetavarContext_0__Lean_DependsOn_shouldVisit(x_2, x_3);
x_5 = lean_ctor_get(x_4, 0);
lean_inc(x_5);
x_6 = lean_unbox(x_5);
lean_dec(x_5);
if (x_6 == 0)
{
uint8_t x_7;
lean_dec(x_2);
x_7 = !lean_is_exclusive(x_4);
if (x_7 == 0)
{
lean_object* x_8; uint8_t x_9; lean_object* x_10;
x_8 = lean_ctor_get(x_4, 0);
lean_dec(x_8);
x_9 = 0;
x_10 = lean_box(x_9);
lean_ctor_set(x_4, 0, x_10);
return x_4;
}
else
{
lean_object* x_11; uint8_t x_12; lean_object* x_13; lean_object* x_14;
x_11 = lean_ctor_get(x_4, 1);
lean_inc(x_11);
lean_dec(x_4);
x_12 = 0;
x_13 = lean_box(x_12);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_13);
lean_ctor_set(x_14, 1, x_11);
return x_14;
}
}
else
{
lean_object* x_15; lean_object* x_16;
x_15 = lean_ctor_get(x_4, 1);
lean_inc(x_15);
lean_dec(x_4);
x_16 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__11(x_1, x_2, x_15);
return x_16;
}
}
}
static lean_object* _init_l_Lean_exprDependsOn___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__1___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_unsigned_to_nat(8u);
x_2 = l_Lean_mkHashSetImp___rarg(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_exprDependsOn___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; uint8_t x_14;
x_8 = lean_st_ref_get(x_4, x_7);
x_9 = lean_ctor_get(x_8, 0);
lean_inc(x_9);
x_10 = lean_ctor_get(x_8, 1);
lean_inc(x_10);
lean_dec(x_8);
x_11 = lean_ctor_get(x_9, 0);
lean_inc(x_11);
lean_dec(x_9);
x_12 = l_Lean_exprDependsOn___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__1___closed__1;
lean_inc(x_11);
x_13 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_13, 0, x_12);
lean_ctor_set(x_13, 1, x_11);
x_14 = l_Lean_Expr_hasFVar(x_1);
if (x_14 == 0)
{
uint8_t x_15;
x_15 = l_Lean_Expr_hasMVar(x_1);
if (x_15 == 0)
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; uint8_t x_19;
lean_dec(x_13);
lean_dec(x_1);
x_16 = lean_st_ref_take(x_4, x_10);
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = !lean_is_exclusive(x_17);
if (x_19 == 0)
{
lean_object* x_20; lean_object* x_21; uint8_t x_22;
x_20 = lean_ctor_get(x_17, 0);
lean_dec(x_20);
lean_ctor_set(x_17, 0, x_11);
x_21 = lean_st_ref_set(x_4, x_17, x_18);
x_22 = !lean_is_exclusive(x_21);
if (x_22 == 0)
{
lean_object* x_23; uint8_t x_24; lean_object* x_25;
x_23 = lean_ctor_get(x_21, 0);
lean_dec(x_23);
x_24 = 0;
x_25 = lean_box(x_24);
lean_ctor_set(x_21, 0, x_25);
return x_21;
}
else
{
lean_object* x_26; uint8_t x_27; lean_object* x_28; lean_object* x_29;
x_26 = lean_ctor_get(x_21, 1);
lean_inc(x_26);
lean_dec(x_21);
x_27 = 0;
x_28 = lean_box(x_27);
x_29 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_29, 0, x_28);
lean_ctor_set(x_29, 1, x_26);
return x_29;
}
}
else
{
lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; uint8_t x_37; lean_object* x_38; lean_object* x_39;
x_30 = lean_ctor_get(x_17, 1);
x_31 = lean_ctor_get(x_17, 2);
x_32 = lean_ctor_get(x_17, 3);
lean_inc(x_32);
lean_inc(x_31);
lean_inc(x_30);
lean_dec(x_17);
x_33 = lean_alloc_ctor(0, 4, 0);
lean_ctor_set(x_33, 0, x_11);
lean_ctor_set(x_33, 1, x_30);
lean_ctor_set(x_33, 2, x_31);
lean_ctor_set(x_33, 3, x_32);
x_34 = lean_st_ref_set(x_4, x_33, x_18);
x_35 = lean_ctor_get(x_34, 1);
lean_inc(x_35);
if (lean_is_exclusive(x_34)) {
lean_ctor_release(x_34, 0);
lean_ctor_release(x_34, 1);
x_36 = x_34;
} else {
lean_dec_ref(x_34);
x_36 = lean_box(0);
}
x_37 = 0;
x_38 = lean_box(x_37);
if (lean_is_scalar(x_36)) {
x_39 = lean_alloc_ctor(0, 2, 0);
} else {
x_39 = x_36;
}
lean_ctor_set(x_39, 0, x_38);
lean_ctor_set(x_39, 1, x_35);
return x_39;
}
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; uint8_t x_47;
lean_dec(x_11);
x_40 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2(x_2, x_1, x_13);
x_41 = lean_ctor_get(x_40, 1);
lean_inc(x_41);
x_42 = lean_ctor_get(x_40, 0);
lean_inc(x_42);
lean_dec(x_40);
x_43 = lean_ctor_get(x_41, 1);
lean_inc(x_43);
lean_dec(x_41);
x_44 = lean_st_ref_take(x_4, x_10);
x_45 = lean_ctor_get(x_44, 0);
lean_inc(x_45);
x_46 = lean_ctor_get(x_44, 1);
lean_inc(x_46);
lean_dec(x_44);
x_47 = !lean_is_exclusive(x_45);
if (x_47 == 0)
{
lean_object* x_48; lean_object* x_49; uint8_t x_50;
x_48 = lean_ctor_get(x_45, 0);
lean_dec(x_48);
lean_ctor_set(x_45, 0, x_43);
x_49 = lean_st_ref_set(x_4, x_45, x_46);
x_50 = !lean_is_exclusive(x_49);
if (x_50 == 0)
{
lean_object* x_51;
x_51 = lean_ctor_get(x_49, 0);
lean_dec(x_51);
lean_ctor_set(x_49, 0, x_42);
return x_49;
}
else
{
lean_object* x_52; lean_object* x_53;
x_52 = lean_ctor_get(x_49, 1);
lean_inc(x_52);
lean_dec(x_49);
x_53 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_53, 0, x_42);
lean_ctor_set(x_53, 1, x_52);
return x_53;
}
}
else
{
lean_object* x_54; lean_object* x_55; lean_object* x_56; lean_object* x_57; lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61;
x_54 = lean_ctor_get(x_45, 1);
x_55 = lean_ctor_get(x_45, 2);
x_56 = lean_ctor_get(x_45, 3);
lean_inc(x_56);
lean_inc(x_55);
lean_inc(x_54);
lean_dec(x_45);
x_57 = lean_alloc_ctor(0, 4, 0);
lean_ctor_set(x_57, 0, x_43);
lean_ctor_set(x_57, 1, x_54);
lean_ctor_set(x_57, 2, x_55);
lean_ctor_set(x_57, 3, x_56);
x_58 = lean_st_ref_set(x_4, x_57, x_46);
x_59 = lean_ctor_get(x_58, 1);
lean_inc(x_59);
if (lean_is_exclusive(x_58)) {
lean_ctor_release(x_58, 0);
lean_ctor_release(x_58, 1);
x_60 = x_58;
} else {
lean_dec_ref(x_58);
x_60 = lean_box(0);
}
if (lean_is_scalar(x_60)) {
x_61 = lean_alloc_ctor(0, 2, 0);
} else {
x_61 = x_60;
}
lean_ctor_set(x_61, 0, x_42);
lean_ctor_set(x_61, 1, x_59);
return x_61;
}
}
}
else
{
lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67; lean_object* x_68; uint8_t x_69;
lean_dec(x_11);
x_62 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10(x_2, x_1, x_13);
x_63 = lean_ctor_get(x_62, 1);
lean_inc(x_63);
x_64 = lean_ctor_get(x_62, 0);
lean_inc(x_64);
lean_dec(x_62);
x_65 = lean_ctor_get(x_63, 1);
lean_inc(x_65);
lean_dec(x_63);
x_66 = lean_st_ref_take(x_4, x_10);
x_67 = lean_ctor_get(x_66, 0);
lean_inc(x_67);
x_68 = lean_ctor_get(x_66, 1);
lean_inc(x_68);
lean_dec(x_66);
x_69 = !lean_is_exclusive(x_67);
if (x_69 == 0)
{
lean_object* x_70; lean_object* x_71; uint8_t x_72;
x_70 = lean_ctor_get(x_67, 0);
lean_dec(x_70);
lean_ctor_set(x_67, 0, x_65);
x_71 = lean_st_ref_set(x_4, x_67, x_68);
x_72 = !lean_is_exclusive(x_71);
if (x_72 == 0)
{
lean_object* x_73;
x_73 = lean_ctor_get(x_71, 0);
lean_dec(x_73);
lean_ctor_set(x_71, 0, x_64);
return x_71;
}
else
{
lean_object* x_74; lean_object* x_75;
x_74 = lean_ctor_get(x_71, 1);
lean_inc(x_74);
lean_dec(x_71);
x_75 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_75, 0, x_64);
lean_ctor_set(x_75, 1, x_74);
return x_75;
}
}
else
{
lean_object* x_76; lean_object* x_77; lean_object* x_78; lean_object* x_79; lean_object* x_80; lean_object* x_81; lean_object* x_82; lean_object* x_83;
x_76 = lean_ctor_get(x_67, 1);
x_77 = lean_ctor_get(x_67, 2);
x_78 = lean_ctor_get(x_67, 3);
lean_inc(x_78);
lean_inc(x_77);
lean_inc(x_76);
lean_dec(x_67);
x_79 = lean_alloc_ctor(0, 4, 0);
lean_ctor_set(x_79, 0, x_65);
lean_ctor_set(x_79, 1, x_76);
lean_ctor_set(x_79, 2, x_77);
lean_ctor_set(x_79, 3, x_78);
x_80 = lean_st_ref_set(x_4, x_79, x_68);
x_81 = lean_ctor_get(x_80, 1);
lean_inc(x_81);
if (lean_is_exclusive(x_80)) {
lean_ctor_release(x_80, 0);
lean_ctor_release(x_80, 1);
x_82 = x_80;
} else {
lean_dec_ref(x_80);
x_82 = lean_box(0);
}
if (lean_is_scalar(x_82)) {
x_83 = lean_alloc_ctor(0, 2, 0);
} else {
x_83 = x_82;
}
lean_ctor_set(x_83, 0, x_64);
lean_ctor_set(x_83, 1, x_81);
return x_83;
}
}
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__18(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, size_t x_6, size_t x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12, lean_object* x_13) {
_start:
{
uint8_t x_14;
x_14 = lean_usize_dec_lt(x_7, x_6);
if (x_14 == 0)
{
lean_object* x_15;
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_15 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_15, 0, x_8);
lean_ctor_set(x_15, 1, x_13);
return x_15;
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; uint8_t x_19;
lean_dec(x_8);
x_16 = lean_array_uget(x_5, x_7);
lean_inc(x_16);
x_17 = l_Lean_Expr_fvarId_x21(x_16);
lean_inc(x_4);
x_18 = l_Lean_exprDependsOn___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__1(x_4, x_17, x_9, x_10, x_11, x_12, x_13);
lean_dec(x_17);
x_19 = !lean_is_exclusive(x_18);
if (x_19 == 0)
{
lean_object* x_20; lean_object* x_21; uint8_t x_22;
x_20 = lean_ctor_get(x_18, 0);
x_21 = lean_ctor_get(x_18, 1);
x_22 = l_Array_contains___at_Lean_Meta_setMVarUserNamesAt___spec__1(x_1, x_16);
if (x_22 == 0)
{
uint8_t x_23;
x_23 = lean_unbox(x_20);
lean_dec(x_20);
if (x_23 == 0)
{
size_t x_24; size_t x_25;
lean_free_object(x_18);
lean_dec(x_16);
x_24 = 1;
x_25 = lean_usize_add(x_7, x_24);
lean_inc(x_2);
{
size_t _tmp_6 = x_25;
lean_object* _tmp_7 = x_2;
lean_object* _tmp_12 = x_21;
x_7 = _tmp_6;
x_8 = _tmp_7;
x_13 = _tmp_12;
}
goto _start;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
lean_dec(x_4);
lean_dec(x_2);
x_27 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_27, 0, x_3);
lean_ctor_set(x_27, 1, x_16);
x_28 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_28, 0, x_27);
x_29 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_29, 0, x_28);
x_30 = lean_box(0);
x_31 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_31, 0, x_29);
lean_ctor_set(x_31, 1, x_30);
lean_ctor_set(x_18, 0, x_31);
return x_18;
}
}
else
{
size_t x_32; size_t x_33;
lean_free_object(x_18);
lean_dec(x_20);
lean_dec(x_16);
x_32 = 1;
x_33 = lean_usize_add(x_7, x_32);
lean_inc(x_2);
{
size_t _tmp_6 = x_33;
lean_object* _tmp_7 = x_2;
lean_object* _tmp_12 = x_21;
x_7 = _tmp_6;
x_8 = _tmp_7;
x_13 = _tmp_12;
}
goto _start;
}
}
else
{
lean_object* x_35; lean_object* x_36; uint8_t x_37;
x_35 = lean_ctor_get(x_18, 0);
x_36 = lean_ctor_get(x_18, 1);
lean_inc(x_36);
lean_inc(x_35);
lean_dec(x_18);
x_37 = l_Array_contains___at_Lean_Meta_setMVarUserNamesAt___spec__1(x_1, x_16);
if (x_37 == 0)
{
uint8_t x_38;
x_38 = lean_unbox(x_35);
lean_dec(x_35);
if (x_38 == 0)
{
size_t x_39; size_t x_40;
lean_dec(x_16);
x_39 = 1;
x_40 = lean_usize_add(x_7, x_39);
lean_inc(x_2);
{
size_t _tmp_6 = x_40;
lean_object* _tmp_7 = x_2;
lean_object* _tmp_12 = x_36;
x_7 = _tmp_6;
x_8 = _tmp_7;
x_13 = _tmp_12;
}
goto _start;
}
else
{
lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47;
lean_dec(x_4);
lean_dec(x_2);
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_3);
lean_ctor_set(x_42, 1, x_16);
x_43 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_43, 0, x_42);
x_44 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_44, 0, x_43);
x_45 = lean_box(0);
x_46 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_46, 0, x_44);
lean_ctor_set(x_46, 1, x_45);
x_47 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_47, 0, x_46);
lean_ctor_set(x_47, 1, x_36);
return x_47;
}
}
else
{
size_t x_48; size_t x_49;
lean_dec(x_35);
lean_dec(x_16);
x_48 = 1;
x_49 = lean_usize_add(x_7, x_48);
lean_inc(x_2);
{
size_t _tmp_6 = x_49;
lean_object* _tmp_7 = x_2;
lean_object* _tmp_12 = x_36;
x_7 = _tmp_6;
x_8 = _tmp_7;
x_13 = _tmp_12;
}
goto _start;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__19(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, size_t x_5, size_t x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
uint8_t x_13;
x_13 = lean_usize_dec_lt(x_6, x_5);
if (x_13 == 0)
{
lean_object* x_14;
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_3);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_7);
lean_ctor_set(x_14, 1, x_12);
return x_14;
}
else
{
lean_object* x_15; lean_object* x_16;
lean_dec(x_7);
x_15 = lean_array_uget(x_4, x_6);
lean_inc(x_11);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_15);
x_16 = lean_infer_type(x_15, x_8, x_9, x_10, x_11, x_12);
if (lean_obj_tag(x_16) == 0)
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; size_t x_20; size_t x_21; lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_19 = lean_array_get_size(x_1);
x_20 = lean_usize_of_nat(x_19);
lean_dec(x_19);
x_21 = 0;
lean_inc_n(x_3, 2);
x_22 = l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__18(x_2, x_3, x_15, x_17, x_1, x_20, x_21, x_3, x_8, x_9, x_10, x_11, x_18);
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_23, 0);
lean_inc(x_24);
lean_dec(x_23);
if (lean_obj_tag(x_24) == 0)
{
lean_object* x_25; size_t x_26; size_t x_27;
x_25 = lean_ctor_get(x_22, 1);
lean_inc(x_25);
lean_dec(x_22);
x_26 = 1;
x_27 = lean_usize_add(x_6, x_26);
lean_inc(x_3);
{
size_t _tmp_5 = x_27;
lean_object* _tmp_6 = x_3;
lean_object* _tmp_11 = x_25;
x_6 = _tmp_5;
x_7 = _tmp_6;
x_12 = _tmp_11;
}
goto _start;
}
else
{
uint8_t x_29;
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_3);
x_29 = !lean_is_exclusive(x_22);
if (x_29 == 0)
{
lean_object* x_30; uint8_t x_31;
x_30 = lean_ctor_get(x_22, 0);
lean_dec(x_30);
x_31 = !lean_is_exclusive(x_24);
if (x_31 == 0)
{
lean_object* x_32; lean_object* x_33;
x_32 = lean_box(0);
x_33 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_33, 0, x_24);
lean_ctor_set(x_33, 1, x_32);
lean_ctor_set(x_22, 0, x_33);
return x_22;
}
else
{
lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37;
x_34 = lean_ctor_get(x_24, 0);
lean_inc(x_34);
lean_dec(x_24);
x_35 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_35, 0, x_34);
x_36 = lean_box(0);
x_37 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_37, 0, x_35);
lean_ctor_set(x_37, 1, x_36);
lean_ctor_set(x_22, 0, x_37);
return x_22;
}
}
else
{
lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44;
x_38 = lean_ctor_get(x_22, 1);
lean_inc(x_38);
lean_dec(x_22);
x_39 = lean_ctor_get(x_24, 0);
lean_inc(x_39);
if (lean_is_exclusive(x_24)) {
lean_ctor_release(x_24, 0);
x_40 = x_24;
} else {
lean_dec_ref(x_24);
x_40 = lean_box(0);
}
if (lean_is_scalar(x_40)) {
x_41 = lean_alloc_ctor(1, 1, 0);
} else {
x_41 = x_40;
}
lean_ctor_set(x_41, 0, x_39);
x_42 = lean_box(0);
x_43 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_43, 0, x_41);
lean_ctor_set(x_43, 1, x_42);
x_44 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_44, 0, x_43);
lean_ctor_set(x_44, 1, x_38);
return x_44;
}
}
}
else
{
uint8_t x_45;
lean_dec(x_15);
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_3);
x_45 = !lean_is_exclusive(x_16);
if (x_45 == 0)
{
return x_16;
}
else
{
lean_object* x_46; lean_object* x_47; lean_object* x_48;
x_46 = lean_ctor_get(x_16, 0);
x_47 = lean_ctor_get(x_16, 1);
lean_inc(x_47);
lean_inc(x_46);
lean_dec(x_16);
x_48 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_48, 0, x_46);
lean_ctor_set(x_48, 1, x_47);
return x_48;
}
}
}
}
}
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
x_8 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_8, 0, x_1);
lean_ctor_set(x_8, 1, x_7);
return x_8;
}
}
static lean_object* _init_l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3;
x_1 = lean_box(0);
x_2 = lean_box(0);
x_3 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_3, 0, x_1);
lean_ctor_set(x_3, 1, x_2);
return x_3;
}
}
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; lean_object* x_9; size_t x_10; size_t x_11; lean_object* x_12; lean_object* x_13;
x_8 = lean_box(0);
x_9 = lean_array_get_size(x_2);
x_10 = lean_usize_of_nat(x_9);
lean_dec(x_9);
x_11 = 0;
x_12 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___closed__1;
x_13 = l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__19(x_1, x_2, x_12, x_2, x_10, x_11, x_12, x_3, x_4, x_5, x_6, x_7);
if (lean_obj_tag(x_13) == 0)
{
lean_object* x_14; lean_object* x_15;
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_14, 0);
lean_inc(x_15);
lean_dec(x_14);
if (lean_obj_tag(x_15) == 0)
{
uint8_t x_16;
x_16 = !lean_is_exclusive(x_13);
if (x_16 == 0)
{
lean_object* x_17;
x_17 = lean_ctor_get(x_13, 0);
lean_dec(x_17);
lean_ctor_set(x_13, 0, x_8);
return x_13;
}
else
{
lean_object* x_18; lean_object* x_19;
x_18 = lean_ctor_get(x_13, 1);
lean_inc(x_18);
lean_dec(x_13);
x_19 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_19, 0, x_8);
lean_ctor_set(x_19, 1, x_18);
return x_19;
}
}
else
{
uint8_t x_20;
x_20 = !lean_is_exclusive(x_13);
if (x_20 == 0)
{
lean_object* x_21; lean_object* x_22;
x_21 = lean_ctor_get(x_13, 0);
lean_dec(x_21);
x_22 = lean_ctor_get(x_15, 0);
lean_inc(x_22);
lean_dec(x_15);
lean_ctor_set(x_13, 0, x_22);
return x_13;
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_23 = lean_ctor_get(x_13, 1);
lean_inc(x_23);
lean_dec(x_13);
x_24 = lean_ctor_get(x_15, 0);
lean_inc(x_24);
lean_dec(x_15);
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_24);
lean_ctor_set(x_25, 1, x_23);
return x_25;
}
}
}
else
{
uint8_t x_26;
x_26 = !lean_is_exclusive(x_13);
if (x_26 == 0)
{
return x_13;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_13, 0);
x_28 = lean_ctor_get(x_13, 1);
lean_inc(x_28);
lean_inc(x_27);
lean_dec(x_13);
x_29 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_29, 0, x_27);
lean_ctor_set(x_29, 1, x_28);
return x_29;
}
}
}
}
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitApp___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__4___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitApp___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__4(x_1, x_2, x_3);
lean_dec(x_1);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__7___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; size_t x_6; uint8_t x_7; lean_object* x_8;
x_5 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_6 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_7 = l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__7(x_1, x_2, x_5, x_6);
lean_dec(x_2);
lean_dec(x_1);
x_8 = lean_box(x_7);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__8___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; size_t x_6; uint8_t x_7; lean_object* x_8;
x_5 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_6 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_7 = l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__8(x_1, x_2, x_5, x_6);
lean_dec(x_2);
lean_dec(x_1);
x_8 = lean_box(x_7);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentArray_anyMAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__6___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; lean_object* x_4;
x_3 = l_Lean_PersistentArray_anyMAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__6(x_1, x_2);
lean_dec(x_1);
x_4 = lean_box(x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__9___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; size_t x_6; uint8_t x_7; lean_object* x_8;
x_5 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_6 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_7 = l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__9(x_1, x_2, x_5, x_6);
lean_dec(x_2);
lean_dec(x_1);
x_8 = lean_box(x_7);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentArray_anyM___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__5___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; lean_object* x_4;
x_3 = l_Lean_PersistentArray_anyM___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__5(x_1, x_2);
lean_dec(x_1);
x_4 = lean_box(x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__3___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__3(x_1, x_2, x_3);
lean_dec(x_1);
return x_4;
}
}
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__2(x_1, x_2, x_3);
lean_dec(x_1);
return x_4;
}
}
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitApp___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__12___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitApp___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__12(x_1, x_2, x_3);
lean_dec(x_1);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__15___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; size_t x_6; uint8_t x_7; lean_object* x_8;
x_5 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_6 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_7 = l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__15(x_1, x_2, x_5, x_6);
lean_dec(x_2);
lean_dec(x_1);
x_8 = lean_box(x_7);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__16___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; size_t x_6; uint8_t x_7; lean_object* x_8;
x_5 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_6 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_7 = l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__16(x_1, x_2, x_5, x_6);
lean_dec(x_2);
lean_dec(x_1);
x_8 = lean_box(x_7);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentArray_anyMAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__14___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; lean_object* x_4;
x_3 = l_Lean_PersistentArray_anyMAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__14(x_1, x_2);
lean_dec(x_1);
x_4 = lean_box(x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__17___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; size_t x_6; uint8_t x_7; lean_object* x_8;
x_5 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_6 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_7 = l_Array_anyMUnsafe_any___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__17(x_1, x_2, x_5, x_6);
lean_dec(x_2);
lean_dec(x_1);
x_8 = lean_box(x_7);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_PersistentArray_anyM___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__13___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; lean_object* x_4;
x_3 = l_Lean_PersistentArray_anyM___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__13(x_1, x_2);
lean_dec(x_1);
x_4 = lean_box(x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__11___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visitMain___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__11(x_1, x_2, x_3);
lean_dec(x_1);
return x_4;
}
}
LEAN_EXPORT lean_object* l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4;
x_4 = l___private_Lean_MetavarContext_0__Lean_DependsOn_dep_visit___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__10(x_1, x_2, x_3);
lean_dec(x_1);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_exprDependsOn___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
x_8 = l_Lean_exprDependsOn___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__1(x_1, x_2, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__18___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12, lean_object* x_13) {
_start:
{
size_t x_14; size_t x_15; lean_object* x_16;
x_14 = lean_unbox_usize(x_6);
lean_dec(x_6);
x_15 = lean_unbox_usize(x_7);
lean_dec(x_7);
x_16 = l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__18(x_1, x_2, x_3, x_4, x_5, x_14, x_15, x_8, x_9, x_10, x_11, x_12, x_13);
lean_dec(x_12);
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_5);
lean_dec(x_1);
return x_16;
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__19___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
size_t x_13; size_t x_14; lean_object* x_15;
x_13 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_14 = lean_unbox_usize(x_6);
lean_dec(x_6);
x_15 = l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__19(x_1, x_2, x_3, x_4, x_13, x_14, x_7, x_8, x_9, x_10, x_11, x_12);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
return x_15;
}
}
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
x_8 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___lambda__1(x_1, x_2, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_8;
}
}
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
x_8 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f(x_1, x_2, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_2);
lean_dec(x_1);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, size_t x_5, size_t x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
uint8_t x_13;
x_13 = lean_usize_dec_lt(x_6, x_5);
if (x_13 == 0)
{
lean_object* x_14;
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_7);
lean_ctor_set(x_14, 1, x_12);
return x_14;
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18; uint8_t x_19;
lean_dec(x_7);
x_15 = lean_array_uget(x_4, x_6);
lean_inc(x_15);
x_16 = l_Lean_Expr_fvarId_x21(x_15);
lean_inc(x_3);
x_17 = l_Lean_exprDependsOn___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__1(x_3, x_16, x_8, x_9, x_10, x_11, x_12);
lean_dec(x_16);
x_18 = lean_ctor_get(x_17, 0);
lean_inc(x_18);
x_19 = lean_unbox(x_18);
lean_dec(x_18);
if (x_19 == 0)
{
lean_object* x_20; size_t x_21; size_t x_22;
lean_dec(x_15);
x_20 = lean_ctor_get(x_17, 1);
lean_inc(x_20);
lean_dec(x_17);
x_21 = 1;
x_22 = lean_usize_add(x_6, x_21);
lean_inc(x_1);
{
size_t _tmp_5 = x_22;
lean_object* _tmp_6 = x_1;
lean_object* _tmp_11 = x_20;
x_6 = _tmp_5;
x_7 = _tmp_6;
x_12 = _tmp_11;
}
goto _start;
}
else
{
uint8_t x_24;
lean_dec(x_3);
lean_dec(x_1);
x_24 = !lean_is_exclusive(x_17);
if (x_24 == 0)
{
lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_25 = lean_ctor_get(x_17, 0);
lean_dec(x_25);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_2);
lean_ctor_set(x_26, 1, x_15);
x_27 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_27, 0, x_26);
x_28 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_28, 0, x_27);
x_29 = lean_box(0);
x_30 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_30, 0, x_28);
lean_ctor_set(x_30, 1, x_29);
lean_ctor_set(x_17, 0, x_30);
return x_17;
}
else
{
lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37;
x_31 = lean_ctor_get(x_17, 1);
lean_inc(x_31);
lean_dec(x_17);
x_32 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_32, 0, x_2);
lean_ctor_set(x_32, 1, x_15);
x_33 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_33, 0, x_32);
x_34 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_34, 0, x_33);
x_35 = lean_box(0);
x_36 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_36, 0, x_34);
lean_ctor_set(x_36, 1, x_35);
x_37 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_37, 0, x_36);
lean_ctor_set(x_37, 1, x_31);
return x_37;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f___spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, size_t x_4, size_t x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11) {
_start:
{
uint8_t x_12;
x_12 = lean_usize_dec_lt(x_5, x_4);
if (x_12 == 0)
{
lean_object* x_13;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_2);
x_13 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_13, 0, x_6);
lean_ctor_set(x_13, 1, x_11);
return x_13;
}
else
{
lean_object* x_14; lean_object* x_15;
lean_dec(x_6);
x_14 = lean_array_uget(x_3, x_5);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_14);
x_15 = lean_infer_type(x_14, x_7, x_8, x_9, x_10, x_11);
if (lean_obj_tag(x_15) == 0)
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; size_t x_19; size_t x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23;
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = lean_array_get_size(x_1);
x_19 = lean_usize_of_nat(x_18);
lean_dec(x_18);
x_20 = 0;
lean_inc_n(x_2, 2);
x_21 = l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f___spec__1(x_2, x_14, x_16, x_1, x_19, x_20, x_2, x_7, x_8, x_9, x_10, x_17);
x_22 = lean_ctor_get(x_21, 0);
lean_inc(x_22);
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
lean_dec(x_22);
if (lean_obj_tag(x_23) == 0)
{
lean_object* x_24; size_t x_25; size_t x_26;
x_24 = lean_ctor_get(x_21, 1);
lean_inc(x_24);
lean_dec(x_21);
x_25 = 1;
x_26 = lean_usize_add(x_5, x_25);
lean_inc(x_2);
{
size_t _tmp_4 = x_26;
lean_object* _tmp_5 = x_2;
lean_object* _tmp_10 = x_24;
x_5 = _tmp_4;
x_6 = _tmp_5;
x_11 = _tmp_10;
}
goto _start;
}
else
{
uint8_t x_28;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_2);
x_28 = !lean_is_exclusive(x_21);
if (x_28 == 0)
{
lean_object* x_29; uint8_t x_30;
x_29 = lean_ctor_get(x_21, 0);
lean_dec(x_29);
x_30 = !lean_is_exclusive(x_23);
if (x_30 == 0)
{
lean_object* x_31; lean_object* x_32;
x_31 = lean_box(0);
x_32 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_32, 0, x_23);
lean_ctor_set(x_32, 1, x_31);
lean_ctor_set(x_21, 0, x_32);
return x_21;
}
else
{
lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36;
x_33 = lean_ctor_get(x_23, 0);
lean_inc(x_33);
lean_dec(x_23);
x_34 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_34, 0, x_33);
x_35 = lean_box(0);
x_36 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_36, 0, x_34);
lean_ctor_set(x_36, 1, x_35);
lean_ctor_set(x_21, 0, x_36);
return x_21;
}
}
else
{
lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43;
x_37 = lean_ctor_get(x_21, 1);
lean_inc(x_37);
lean_dec(x_21);
x_38 = lean_ctor_get(x_23, 0);
lean_inc(x_38);
if (lean_is_exclusive(x_23)) {
lean_ctor_release(x_23, 0);
x_39 = x_23;
} else {
lean_dec_ref(x_23);
x_39 = lean_box(0);
}
if (lean_is_scalar(x_39)) {
x_40 = lean_alloc_ctor(1, 1, 0);
} else {
x_40 = x_39;
}
lean_ctor_set(x_40, 0, x_38);
x_41 = lean_box(0);
x_42 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_42, 0, x_40);
lean_ctor_set(x_42, 1, x_41);
x_43 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_43, 0, x_42);
lean_ctor_set(x_43, 1, x_37);
return x_43;
}
}
}
else
{
uint8_t x_44;
lean_dec(x_14);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_2);
x_44 = !lean_is_exclusive(x_15);
if (x_44 == 0)
{
return x_15;
}
else
{
lean_object* x_45; lean_object* x_46; lean_object* x_47;
x_45 = lean_ctor_get(x_15, 0);
x_46 = lean_ctor_get(x_15, 1);
lean_inc(x_46);
lean_inc(x_45);
lean_dec(x_15);
x_47 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_47, 0, x_45);
lean_ctor_set(x_47, 1, x_46);
return x_47;
}
}
}
}
}
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; lean_object* x_9; size_t x_10; size_t x_11; lean_object* x_12; lean_object* x_13;
x_8 = lean_box(0);
x_9 = lean_array_get_size(x_2);
x_10 = lean_usize_of_nat(x_9);
lean_dec(x_9);
x_11 = 0;
x_12 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___closed__1;
x_13 = l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f___spec__2(x_1, x_12, x_2, x_10, x_11, x_12, x_3, x_4, x_5, x_6, x_7);
if (lean_obj_tag(x_13) == 0)
{
lean_object* x_14; lean_object* x_15;
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_14, 0);
lean_inc(x_15);
lean_dec(x_14);
if (lean_obj_tag(x_15) == 0)
{
uint8_t x_16;
x_16 = !lean_is_exclusive(x_13);
if (x_16 == 0)
{
lean_object* x_17;
x_17 = lean_ctor_get(x_13, 0);
lean_dec(x_17);
lean_ctor_set(x_13, 0, x_8);
return x_13;
}
else
{
lean_object* x_18; lean_object* x_19;
x_18 = lean_ctor_get(x_13, 1);
lean_inc(x_18);
lean_dec(x_13);
x_19 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_19, 0, x_8);
lean_ctor_set(x_19, 1, x_18);
return x_19;
}
}
else
{
uint8_t x_20;
x_20 = !lean_is_exclusive(x_13);
if (x_20 == 0)
{
lean_object* x_21; lean_object* x_22;
x_21 = lean_ctor_get(x_13, 0);
lean_dec(x_21);
x_22 = lean_ctor_get(x_15, 0);
lean_inc(x_22);
lean_dec(x_15);
lean_ctor_set(x_13, 0, x_22);
return x_13;
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_23 = lean_ctor_get(x_13, 1);
lean_inc(x_23);
lean_dec(x_13);
x_24 = lean_ctor_get(x_15, 0);
lean_inc(x_24);
lean_dec(x_15);
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_24);
lean_ctor_set(x_25, 1, x_23);
return x_25;
}
}
}
else
{
uint8_t x_26;
x_26 = !lean_is_exclusive(x_13);
if (x_26 == 0)
{
return x_13;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_13, 0);
x_28 = lean_ctor_get(x_13, 1);
lean_inc(x_28);
lean_inc(x_27);
lean_dec(x_13);
x_29 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_29, 0, x_27);
lean_ctor_set(x_29, 1, x_28);
return x_29;
}
}
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
size_t x_13; size_t x_14; lean_object* x_15;
x_13 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_14 = lean_unbox_usize(x_6);
lean_dec(x_6);
x_15 = l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f___spec__1(x_1, x_2, x_3, x_4, x_13, x_14, x_7, x_8, x_9, x_10, x_11, x_12);
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_4);
return x_15;
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11) {
_start:
{
size_t x_12; size_t x_13; lean_object* x_14;
x_12 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_13 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_14 = l_Array_forInUnsafe_loop___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f___spec__2(x_1, x_2, x_3, x_12, x_13, x_6, x_7, x_8, x_9, x_10, x_11);
lean_dec(x_3);
lean_dec(x_1);
return x_14;
}
}
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
x_8 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f(x_1, x_2, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_2);
lean_dec(x_1);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___spec__1___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7; lean_object* x_8; uint8_t x_9;
x_7 = lean_ctor_get(x_4, 5);
x_8 = l_Lean_addMessageContextFull___at_Lean_Meta_instAddMessageContextMetaM___spec__1(x_1, x_2, x_3, x_4, x_5, x_6);
x_9 = !lean_is_exclusive(x_8);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11;
x_10 = lean_ctor_get(x_8, 0);
lean_inc(x_7);
x_11 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_11, 0, x_7);
lean_ctor_set(x_11, 1, x_10);
lean_ctor_set_tag(x_8, 1);
lean_ctor_set(x_8, 0, x_11);
return x_8;
}
else
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_12 = lean_ctor_get(x_8, 0);
x_13 = lean_ctor_get(x_8, 1);
lean_inc(x_13);
lean_inc(x_12);
lean_dec(x_8);
lean_inc(x_7);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_7);
lean_ctor_set(x_14, 1, x_12);
x_15 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_15, 0, x_14);
lean_ctor_set(x_15, 1, x_13);
return x_15;
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___spec__1(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_throwError___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___spec__1___rarg___boxed), 6, 0);
return x_2;
}
}
static lean_object* _init_l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("structural recursion cannot be used", 35);
return x_1;
}
}
static lean_object* _init_l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg___closed__1;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5) {
_start:
{
lean_object* x_6; lean_object* x_7;
x_6 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg___closed__2;
x_7 = l_Lean_throwError___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___spec__1___rarg(x_6, x_1, x_2, x_3, x_4, x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
return x_7;
}
}
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg), 5, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___spec__1___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6) {
_start:
{
lean_object* x_7;
x_7 = l_Lean_throwError___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___spec__1___rarg(x_1, x_2, x_3, x_4, x_5, x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_7;
}
}
static lean_object* _init_l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_box(1);
x_2 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_22; lean_object* x_23; lean_object* x_24; lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_9 = lean_st_ref_get(x_3, x_8);
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
x_11 = lean_ctor_get(x_9, 1);
lean_inc(x_11);
lean_dec(x_9);
x_22 = lean_st_ref_get(x_7, x_11);
x_23 = lean_ctor_get(x_22, 0);
lean_inc(x_23);
x_24 = lean_ctor_get(x_22, 1);
lean_inc(x_24);
lean_dec(x_22);
x_25 = lean_ctor_get(x_23, 0);
lean_inc(x_25);
lean_dec(x_23);
x_26 = lean_st_ref_get(x_5, x_24);
x_27 = lean_ctor_get(x_26, 0);
lean_inc(x_27);
x_28 = lean_ctor_get(x_26, 1);
lean_inc(x_28);
lean_dec(x_26);
x_29 = lean_ctor_get(x_27, 0);
lean_inc(x_29);
lean_dec(x_27);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_3);
x_30 = lean_apply_6(x_1, x_3, x_4, x_5, x_6, x_7, x_28);
if (lean_obj_tag(x_30) == 0)
{
lean_dec(x_29);
lean_dec(x_25);
lean_dec(x_10);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_12 = x_30;
goto block_21;
}
else
{
lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; uint8_t x_38;
x_31 = lean_ctor_get(x_30, 0);
lean_inc(x_31);
x_32 = lean_ctor_get(x_30, 1);
lean_inc(x_32);
lean_dec(x_30);
x_33 = l_Lean_setEnv___at_Lean_Meta_setInlineAttribute___spec__2(x_25, x_4, x_5, x_6, x_7, x_32);
x_34 = lean_ctor_get(x_33, 1);
lean_inc(x_34);
lean_dec(x_33);
x_35 = lean_st_ref_take(x_5, x_34);
x_36 = lean_ctor_get(x_35, 0);
lean_inc(x_36);
x_37 = lean_ctor_get(x_35, 1);
lean_inc(x_37);
lean_dec(x_35);
x_38 = !lean_is_exclusive(x_36);
if (x_38 == 0)
{
lean_object* x_39; lean_object* x_40;
x_39 = lean_ctor_get(x_36, 0);
lean_dec(x_39);
lean_ctor_set(x_36, 0, x_29);
x_40 = lean_st_ref_set(x_5, x_36, x_37);
if (lean_obj_tag(x_31) == 0)
{
lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46;
x_41 = lean_ctor_get(x_40, 1);
lean_inc(x_41);
lean_dec(x_40);
x_42 = lean_ctor_get(x_31, 0);
lean_inc(x_42);
x_43 = lean_ctor_get(x_31, 1);
lean_inc(x_43);
lean_dec(x_31);
x_44 = lean_st_ref_set(x_3, x_10, x_41);
x_45 = lean_ctor_get(x_44, 1);
lean_inc(x_45);
lean_dec(x_44);
x_46 = lean_apply_6(x_2, x_3, x_4, x_5, x_6, x_7, x_45);
if (lean_obj_tag(x_46) == 0)
{
lean_dec(x_43);
lean_dec(x_42);
x_12 = x_46;
goto block_21;
}
else
{
lean_object* x_47;
x_47 = lean_ctor_get(x_46, 0);
lean_inc(x_47);
if (lean_obj_tag(x_47) == 0)
{
uint8_t x_48;
x_48 = !lean_is_exclusive(x_46);
if (x_48 == 0)
{
lean_object* x_49; uint8_t x_50;
x_49 = lean_ctor_get(x_46, 0);
lean_dec(x_49);
x_50 = !lean_is_exclusive(x_47);
if (x_50 == 0)
{
lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55; lean_object* x_56;
x_51 = lean_ctor_get(x_47, 1);
x_52 = lean_ctor_get(x_47, 0);
lean_dec(x_52);
x_53 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg___closed__1;
x_54 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_54, 0, x_43);
lean_ctor_set(x_54, 1, x_53);
x_55 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_55, 0, x_54);
lean_ctor_set(x_55, 1, x_53);
x_56 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_56, 0, x_55);
lean_ctor_set(x_56, 1, x_51);
lean_ctor_set(x_47, 1, x_56);
lean_ctor_set(x_47, 0, x_42);
x_12 = x_46;
goto block_21;
}
else
{
lean_object* x_57; lean_object* x_58; lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62;
x_57 = lean_ctor_get(x_47, 1);
lean_inc(x_57);
lean_dec(x_47);
x_58 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg___closed__1;
x_59 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_59, 0, x_43);
lean_ctor_set(x_59, 1, x_58);
x_60 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_60, 0, x_59);
lean_ctor_set(x_60, 1, x_58);
x_61 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_61, 0, x_60);
lean_ctor_set(x_61, 1, x_57);
x_62 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_62, 0, x_42);
lean_ctor_set(x_62, 1, x_61);
lean_ctor_set(x_46, 0, x_62);
x_12 = x_46;
goto block_21;
}
}
else
{
lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_71;
x_63 = lean_ctor_get(x_46, 1);
lean_inc(x_63);
lean_dec(x_46);
x_64 = lean_ctor_get(x_47, 1);
lean_inc(x_64);
if (lean_is_exclusive(x_47)) {
lean_ctor_release(x_47, 0);
lean_ctor_release(x_47, 1);
x_65 = x_47;
} else {
lean_dec_ref(x_47);
x_65 = lean_box(0);
}
x_66 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg___closed__1;
x_67 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_67, 0, x_43);
lean_ctor_set(x_67, 1, x_66);
x_68 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_68, 0, x_67);
lean_ctor_set(x_68, 1, x_66);
x_69 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_69, 0, x_68);
lean_ctor_set(x_69, 1, x_64);
if (lean_is_scalar(x_65)) {
x_70 = lean_alloc_ctor(0, 2, 0);
} else {
x_70 = x_65;
}
lean_ctor_set(x_70, 0, x_42);
lean_ctor_set(x_70, 1, x_69);
x_71 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_71, 0, x_70);
lean_ctor_set(x_71, 1, x_63);
x_12 = x_71;
goto block_21;
}
}
else
{
uint8_t x_72;
lean_dec(x_43);
lean_dec(x_42);
x_72 = !lean_is_exclusive(x_46);
if (x_72 == 0)
{
lean_object* x_73;
x_73 = lean_ctor_get(x_46, 0);
lean_dec(x_73);
x_12 = x_46;
goto block_21;
}
else
{
lean_object* x_74; lean_object* x_75;
x_74 = lean_ctor_get(x_46, 1);
lean_inc(x_74);
lean_dec(x_46);
x_75 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_75, 0, x_47);
lean_ctor_set(x_75, 1, x_74);
x_12 = x_75;
goto block_21;
}
}
}
}
else
{
uint8_t x_76;
lean_dec(x_10);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_76 = !lean_is_exclusive(x_40);
if (x_76 == 0)
{
lean_object* x_77;
x_77 = lean_ctor_get(x_40, 0);
lean_dec(x_77);
lean_ctor_set_tag(x_40, 1);
lean_ctor_set(x_40, 0, x_31);
x_12 = x_40;
goto block_21;
}
else
{
lean_object* x_78; lean_object* x_79;
x_78 = lean_ctor_get(x_40, 1);
lean_inc(x_78);
lean_dec(x_40);
x_79 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_79, 0, x_31);
lean_ctor_set(x_79, 1, x_78);
x_12 = x_79;
goto block_21;
}
}
}
else
{
lean_object* x_80; lean_object* x_81; lean_object* x_82; lean_object* x_83; lean_object* x_84;
x_80 = lean_ctor_get(x_36, 1);
x_81 = lean_ctor_get(x_36, 2);
x_82 = lean_ctor_get(x_36, 3);
lean_inc(x_82);
lean_inc(x_81);
lean_inc(x_80);
lean_dec(x_36);
x_83 = lean_alloc_ctor(0, 4, 0);
lean_ctor_set(x_83, 0, x_29);
lean_ctor_set(x_83, 1, x_80);
lean_ctor_set(x_83, 2, x_81);
lean_ctor_set(x_83, 3, x_82);
x_84 = lean_st_ref_set(x_5, x_83, x_37);
if (lean_obj_tag(x_31) == 0)
{
lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88; lean_object* x_89; lean_object* x_90;
x_85 = lean_ctor_get(x_84, 1);
lean_inc(x_85);
lean_dec(x_84);
x_86 = lean_ctor_get(x_31, 0);
lean_inc(x_86);
x_87 = lean_ctor_get(x_31, 1);
lean_inc(x_87);
lean_dec(x_31);
x_88 = lean_st_ref_set(x_3, x_10, x_85);
x_89 = lean_ctor_get(x_88, 1);
lean_inc(x_89);
lean_dec(x_88);
x_90 = lean_apply_6(x_2, x_3, x_4, x_5, x_6, x_7, x_89);
if (lean_obj_tag(x_90) == 0)
{
lean_dec(x_87);
lean_dec(x_86);
x_12 = x_90;
goto block_21;
}
else
{
lean_object* x_91;
x_91 = lean_ctor_get(x_90, 0);
lean_inc(x_91);
if (lean_obj_tag(x_91) == 0)
{
lean_object* x_92; lean_object* x_93; lean_object* x_94; lean_object* x_95; lean_object* x_96; lean_object* x_97; lean_object* x_98; lean_object* x_99; lean_object* x_100; lean_object* x_101;
x_92 = lean_ctor_get(x_90, 1);
lean_inc(x_92);
if (lean_is_exclusive(x_90)) {
lean_ctor_release(x_90, 0);
lean_ctor_release(x_90, 1);
x_93 = x_90;
} else {
lean_dec_ref(x_90);
x_93 = lean_box(0);
}
x_94 = lean_ctor_get(x_91, 1);
lean_inc(x_94);
if (lean_is_exclusive(x_91)) {
lean_ctor_release(x_91, 0);
lean_ctor_release(x_91, 1);
x_95 = x_91;
} else {
lean_dec_ref(x_91);
x_95 = lean_box(0);
}
x_96 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg___closed__1;
x_97 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_97, 0, x_87);
lean_ctor_set(x_97, 1, x_96);
x_98 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_98, 0, x_97);
lean_ctor_set(x_98, 1, x_96);
x_99 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_99, 0, x_98);
lean_ctor_set(x_99, 1, x_94);
if (lean_is_scalar(x_95)) {
x_100 = lean_alloc_ctor(0, 2, 0);
} else {
x_100 = x_95;
}
lean_ctor_set(x_100, 0, x_86);
lean_ctor_set(x_100, 1, x_99);
if (lean_is_scalar(x_93)) {
x_101 = lean_alloc_ctor(1, 2, 0);
} else {
x_101 = x_93;
}
lean_ctor_set(x_101, 0, x_100);
lean_ctor_set(x_101, 1, x_92);
x_12 = x_101;
goto block_21;
}
else
{
lean_object* x_102; lean_object* x_103; lean_object* x_104;
lean_dec(x_87);
lean_dec(x_86);
x_102 = lean_ctor_get(x_90, 1);
lean_inc(x_102);
if (lean_is_exclusive(x_90)) {
lean_ctor_release(x_90, 0);
lean_ctor_release(x_90, 1);
x_103 = x_90;
} else {
lean_dec_ref(x_90);
x_103 = lean_box(0);
}
if (lean_is_scalar(x_103)) {
x_104 = lean_alloc_ctor(1, 2, 0);
} else {
x_104 = x_103;
}
lean_ctor_set(x_104, 0, x_91);
lean_ctor_set(x_104, 1, x_102);
x_12 = x_104;
goto block_21;
}
}
}
else
{
lean_object* x_105; lean_object* x_106; lean_object* x_107;
lean_dec(x_10);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_105 = lean_ctor_get(x_84, 1);
lean_inc(x_105);
if (lean_is_exclusive(x_84)) {
lean_ctor_release(x_84, 0);
lean_ctor_release(x_84, 1);
x_106 = x_84;
} else {
lean_dec_ref(x_84);
x_106 = lean_box(0);
}
if (lean_is_scalar(x_106)) {
x_107 = lean_alloc_ctor(1, 2, 0);
} else {
x_107 = x_106;
lean_ctor_set_tag(x_107, 1);
}
lean_ctor_set(x_107, 0, x_31);
lean_ctor_set(x_107, 1, x_105);
x_12 = x_107;
goto block_21;
}
}
}
block_21:
{
if (lean_obj_tag(x_12) == 0)
{
uint8_t x_13;
x_13 = !lean_is_exclusive(x_12);
if (x_13 == 0)
{
return x_12;
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_14 = lean_ctor_get(x_12, 0);
x_15 = lean_ctor_get(x_12, 1);
lean_inc(x_15);
lean_inc(x_14);
lean_dec(x_12);
x_16 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_16, 0, x_14);
lean_ctor_set(x_16, 1, x_15);
return x_16;
}
}
else
{
uint8_t x_17;
x_17 = !lean_is_exclusive(x_12);
if (x_17 == 0)
{
return x_12;
}
else
{
lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_18 = lean_ctor_get(x_12, 0);
x_19 = lean_ctor_get(x_12, 1);
lean_inc(x_19);
lean_inc(x_18);
lean_dec(x_12);
x_20 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_20, 0, x_18);
lean_ctor_set(x_20, 1, x_19);
return x_20;
}
}
}
}
}
LEAN_EXPORT lean_object* l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg), 8, 0);
return x_2;
}
}
static lean_object* _init_l_Lean_isTracingEnabledFor___at_Lean_Elab_Structural_findRecArg_go___spec__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = l_Lean_inheritedTraceOptions;
return x_1;
}
}
LEAN_EXPORT lean_object* l_Lean_isTracingEnabledFor___at_Lean_Elab_Structural_findRecArg_go___spec__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; lean_object* x_9; uint8_t x_10;
x_8 = l_Lean_isTracingEnabledFor___at_Lean_Elab_Structural_findRecArg_go___spec__1___closed__1;
x_9 = lean_st_ref_get(x_8, x_7);
x_10 = !lean_is_exclusive(x_9);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12; uint8_t x_13; lean_object* x_14;
x_11 = lean_ctor_get(x_9, 0);
x_12 = lean_ctor_get(x_5, 2);
x_13 = l___private_Lean_Util_Trace_0__Lean_checkTraceOption(x_11, x_12, x_1);
lean_dec(x_11);
x_14 = lean_box(x_13);
lean_ctor_set(x_9, 0, x_14);
return x_9;
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; uint8_t x_18; lean_object* x_19; lean_object* x_20;
x_15 = lean_ctor_get(x_9, 0);
x_16 = lean_ctor_get(x_9, 1);
lean_inc(x_16);
lean_inc(x_15);
lean_dec(x_9);
x_17 = lean_ctor_get(x_5, 2);
x_18 = l___private_Lean_Util_Trace_0__Lean_checkTraceOption(x_15, x_17, x_1);
lean_dec(x_15);
x_19 = lean_box(x_18);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_20, 1, x_16);
return x_20;
}
}
}
LEAN_EXPORT lean_object* l_Lean_hasConst___at_Lean_Elab_Structural_findRecArg_go___spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; uint8_t x_9;
x_8 = lean_st_ref_get(x_6, x_7);
x_9 = !lean_is_exclusive(x_8);
if (x_9 == 0)
{
lean_object* x_10; lean_object* x_11; uint8_t x_12; lean_object* x_13;
x_10 = lean_ctor_get(x_8, 0);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
lean_dec(x_10);
x_12 = l_Lean_Environment_contains(x_11, x_1);
x_13 = lean_box(x_12);
lean_ctor_set(x_8, 0, x_13);
return x_8;
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; uint8_t x_17; lean_object* x_18; lean_object* x_19;
x_14 = lean_ctor_get(x_8, 0);
x_15 = lean_ctor_get(x_8, 1);
lean_inc(x_15);
lean_inc(x_14);
lean_dec(x_8);
x_16 = lean_ctor_get(x_14, 0);
lean_inc(x_16);
lean_dec(x_14);
x_17 = l_Lean_Environment_contains(x_16, x_1);
x_18 = lean_box(x_17);
x_19 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_19, 0, x_18);
lean_ctor_set(x_19, 1, x_15);
return x_19;
}
}
}
static lean_object* _init_l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Lean.Elab.PreDefinition.Structural.FindRecArg", 45);
return x_1;
}
}
static lean_object* _init_l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Lean.Elab.Structural.findRecArg.go", 34);
return x_1;
}
}
static lean_object* _init_l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("unreachable code has been reached", 33);
return x_1;
}
}
static lean_object* _init_l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4; lean_object* x_5;
x_1 = l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__1;
x_2 = l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__2;
x_3 = lean_unsigned_to_nat(119u);
x_4 = l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__3;
x_5 = l___private_Init_Util_0__mkPanicMessageWithDecl(x_1, x_2, x_3, x_3, x_4);
return x_5;
}
}
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3(lean_object* x_1, size_t x_2, size_t x_3, lean_object* x_4) {
_start:
{
uint8_t x_5;
x_5 = lean_usize_dec_lt(x_3, x_2);
if (x_5 == 0)
{
return x_4;
}
else
{
lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; size_t x_10; size_t x_11;
x_6 = lean_array_uget(x_4, x_3);
x_7 = lean_unsigned_to_nat(0u);
x_8 = lean_array_uset(x_4, x_3, x_7);
x_9 = l_Array_indexOfAux___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos___spec__1(x_1, x_6, x_7);
lean_dec(x_6);
x_10 = 1;
x_11 = lean_usize_add(x_3, x_10);
if (lean_obj_tag(x_9) == 0)
{
lean_object* x_12; lean_object* x_13; lean_object* x_14;
x_12 = l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__4;
x_13 = l_panic___at_String_toNat_x21___spec__1(x_12);
x_14 = lean_array_uset(x_8, x_3, x_13);
x_3 = x_11;
x_4 = x_14;
goto _start;
}
else
{
lean_object* x_16; lean_object* x_17;
x_16 = lean_ctor_get(x_9, 0);
lean_inc(x_16);
lean_dec(x_9);
x_17 = lean_array_uset(x_8, x_3, x_16);
x_3 = x_11;
x_4 = x_17;
goto _start;
}
}
}
}
LEAN_EXPORT lean_object* l_ReaderT_bind___at_Lean_Elab_Structural_findRecArg_go___spec__4___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9;
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_3);
x_9 = lean_apply_6(x_1, x_3, x_4, x_5, x_6, x_7, x_8);
if (lean_obj_tag(x_9) == 0)
{
lean_object* x_10; lean_object* x_11; lean_object* x_12;
x_10 = lean_ctor_get(x_9, 0);
lean_inc(x_10);
x_11 = lean_ctor_get(x_9, 1);
lean_inc(x_11);
lean_dec(x_9);
x_12 = lean_apply_7(x_2, x_10, x_3, x_4, x_5, x_6, x_7, x_11);
return x_12;
}
else
{
uint8_t x_13;
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_13 = !lean_is_exclusive(x_9);
if (x_13 == 0)
{
return x_9;
}
else
{
lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_14 = lean_ctor_get(x_9, 0);
x_15 = lean_ctor_get(x_9, 1);
lean_inc(x_15);
lean_inc(x_14);
lean_dec(x_9);
x_16 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_16, 0, x_14);
lean_ctor_set(x_16, 1, x_15);
return x_16;
}
}
}
}
LEAN_EXPORT lean_object* l_ReaderT_bind___at_Lean_Elab_Structural_findRecArg_go___spec__4(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = lean_alloc_closure((void*)(l_ReaderT_bind___at_Lean_Elab_Structural_findRecArg_go___spec__4___rarg), 8, 0);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__5___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; lean_object* x_9; uint8_t x_10;
x_8 = lean_ctor_get(x_5, 5);
x_9 = l_Lean_addMessageContextFull___at_Lean_Meta_instAddMessageContextMetaM___spec__1(x_1, x_3, x_4, x_5, x_6, x_7);
x_10 = !lean_is_exclusive(x_9);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12;
x_11 = lean_ctor_get(x_9, 0);
lean_inc(x_8);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_8);
lean_ctor_set(x_12, 1, x_11);
lean_ctor_set_tag(x_9, 1);
lean_ctor_set(x_9, 0, x_12);
return x_9;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_13 = lean_ctor_get(x_9, 0);
x_14 = lean_ctor_get(x_9, 1);
lean_inc(x_14);
lean_inc(x_13);
lean_dec(x_9);
lean_inc(x_8);
x_15 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_15, 0, x_8);
lean_ctor_set(x_15, 1, x_13);
x_16 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_16, 1, x_14);
return x_16;
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__5(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__5___rarg___boxed), 7, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__6___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; lean_object* x_9; uint8_t x_10;
x_8 = lean_ctor_get(x_5, 5);
x_9 = l_Lean_addMessageContextFull___at_Lean_Meta_instAddMessageContextMetaM___spec__1(x_1, x_3, x_4, x_5, x_6, x_7);
x_10 = !lean_is_exclusive(x_9);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12;
x_11 = lean_ctor_get(x_9, 0);
lean_inc(x_8);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_8);
lean_ctor_set(x_12, 1, x_11);
lean_ctor_set_tag(x_9, 1);
lean_ctor_set(x_9, 0, x_12);
return x_9;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_13 = lean_ctor_get(x_9, 0);
x_14 = lean_ctor_get(x_9, 1);
lean_inc(x_14);
lean_inc(x_13);
lean_dec(x_9);
lean_inc(x_8);
x_15 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_15, 0, x_8);
lean_ctor_set(x_15, 1, x_13);
x_16 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_16, 1, x_14);
return x_16;
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__6(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__6___rarg___boxed), 7, 0);
return x_2;
}
}
LEAN_EXPORT uint8_t l___private_Init_Data_Array_Basic_0__Array_allDiffAuxAux___at_Lean_Elab_Structural_findRecArg_go___spec__8(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
lean_object* x_5; uint8_t x_6;
x_5 = lean_unsigned_to_nat(0u);
x_6 = lean_nat_dec_eq(x_3, x_5);
if (x_6 == 0)
{
lean_object* x_7; lean_object* x_8; lean_object* x_9; uint8_t x_10;
x_7 = lean_unsigned_to_nat(1u);
x_8 = lean_nat_sub(x_3, x_7);
lean_dec(x_3);
x_9 = lean_array_fget(x_1, x_8);
x_10 = lean_expr_eqv(x_2, x_9);
lean_dec(x_9);
if (x_10 == 0)
{
x_3 = x_8;
x_4 = lean_box(0);
goto _start;
}
else
{
uint8_t x_12;
lean_dec(x_8);
x_12 = 0;
return x_12;
}
}
else
{
uint8_t x_13;
lean_dec(x_3);
x_13 = 1;
return x_13;
}
}
}
LEAN_EXPORT uint8_t l___private_Init_Data_Array_Basic_0__Array_allDiffAux___at_Lean_Elab_Structural_findRecArg_go___spec__7(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; uint8_t x_4;
x_3 = lean_array_get_size(x_1);
x_4 = lean_nat_dec_lt(x_2, x_3);
lean_dec(x_3);
if (x_4 == 0)
{
uint8_t x_5;
lean_dec(x_2);
x_5 = 1;
return x_5;
}
else
{
lean_object* x_6; uint8_t x_7;
x_6 = lean_array_fget(x_1, x_2);
lean_inc(x_2);
x_7 = l___private_Init_Data_Array_Basic_0__Array_allDiffAuxAux___at_Lean_Elab_Structural_findRecArg_go___spec__8(x_1, x_6, x_2, lean_box(0));
lean_dec(x_6);
if (x_7 == 0)
{
uint8_t x_8;
lean_dec(x_2);
x_8 = 0;
return x_8;
}
else
{
lean_object* x_9; lean_object* x_10;
x_9 = lean_unsigned_to_nat(1u);
x_10 = lean_nat_add(x_2, x_9);
lean_dec(x_2);
x_2 = x_10;
goto _start;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__9___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; lean_object* x_9; uint8_t x_10;
x_8 = lean_ctor_get(x_5, 5);
x_9 = l_Lean_addMessageContextFull___at_Lean_Meta_instAddMessageContextMetaM___spec__1(x_1, x_3, x_4, x_5, x_6, x_7);
x_10 = !lean_is_exclusive(x_9);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12;
x_11 = lean_ctor_get(x_9, 0);
lean_inc(x_8);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_8);
lean_ctor_set(x_12, 1, x_11);
lean_ctor_set_tag(x_9, 1);
lean_ctor_set(x_9, 0, x_12);
return x_9;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_13 = lean_ctor_get(x_9, 0);
x_14 = lean_ctor_get(x_9, 1);
lean_inc(x_14);
lean_inc(x_13);
lean_dec(x_9);
lean_inc(x_8);
x_15 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_15, 0, x_8);
lean_ctor_set(x_15, 1, x_13);
x_16 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_16, 1, x_14);
return x_16;
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__9(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__9___rarg___boxed), 7, 0);
return x_2;
}
}
LEAN_EXPORT uint8_t l_Array_anyMUnsafe_any___at_Lean_Elab_Structural_findRecArg_go___spec__10(lean_object* x_1, size_t x_2, size_t x_3) {
_start:
{
uint8_t x_4;
x_4 = lean_usize_dec_eq(x_2, x_3);
if (x_4 == 0)
{
lean_object* x_5; uint8_t x_6;
x_5 = lean_array_uget(x_1, x_2);
x_6 = l_Lean_Expr_isFVar(x_5);
lean_dec(x_5);
if (x_6 == 0)
{
uint8_t x_7;
x_7 = 1;
return x_7;
}
else
{
size_t x_8; size_t x_9;
x_8 = 1;
x_9 = lean_usize_add(x_2, x_8);
x_2 = x_9;
goto _start;
}
}
else
{
uint8_t x_11;
x_11 = 0;
return x_11;
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__11___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8; lean_object* x_9; uint8_t x_10;
x_8 = lean_ctor_get(x_5, 5);
x_9 = l_Lean_addMessageContextFull___at_Lean_Meta_instAddMessageContextMetaM___spec__1(x_1, x_3, x_4, x_5, x_6, x_7);
x_10 = !lean_is_exclusive(x_9);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12;
x_11 = lean_ctor_get(x_9, 0);
lean_inc(x_8);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_8);
lean_ctor_set(x_12, 1, x_11);
lean_ctor_set_tag(x_9, 1);
lean_ctor_set(x_9, 0, x_12);
return x_9;
}
else
{
lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16;
x_13 = lean_ctor_get(x_9, 0);
x_14 = lean_ctor_get(x_9, 1);
lean_inc(x_14);
lean_inc(x_13);
lean_dec(x_9);
lean_inc(x_8);
x_15 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_15, 0, x_8);
lean_ctor_set(x_15, 1, x_13);
x_16 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_16, 0, x_15);
lean_ctor_set(x_16, 1, x_14);
return x_16;
}
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__11(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__11___rarg___boxed), 7, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_findCore___at_Lean_Elab_Structural_findRecArg_go___spec__12(lean_object* x_1, lean_object* x_2) {
_start:
{
if (lean_obj_tag(x_1) == 0)
{
lean_object* x_3;
x_3 = lean_box(0);
return x_3;
}
else
{
lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; uint8_t x_8;
x_4 = lean_ctor_get(x_1, 0);
x_5 = lean_ctor_get(x_1, 1);
x_6 = lean_ctor_get(x_1, 2);
x_7 = lean_ctor_get(x_1, 3);
x_8 = l_Lean_Name_quickCmp(x_2, x_5);
switch (x_8) {
case 0:
{
x_1 = x_4;
goto _start;
}
case 1:
{
lean_object* x_10; lean_object* x_11;
lean_inc(x_6);
lean_inc(x_5);
x_10 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_10, 0, x_5);
lean_ctor_set(x_10, 1, x_6);
x_11 = lean_alloc_ctor(1, 1, 0);
lean_ctor_set(x_11, 0, x_10);
return x_11;
}
default:
{
x_1 = x_7;
goto _start;
}
}
}
}
}
static lean_object* _init_l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_unsigned_to_nat(0u);
x_2 = lean_mk_empty_array_with_capacity(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; uint8_t x_16;
x_9 = lean_ctor_get(x_6, 5);
x_10 = l_Lean_addMessageContextFull___at_Lean_Meta_instAddMessageContextMetaM___spec__1(x_2, x_4, x_5, x_6, x_7, x_8);
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
x_12 = lean_ctor_get(x_10, 1);
lean_inc(x_12);
lean_dec(x_10);
x_13 = lean_st_ref_take(x_7, x_12);
x_14 = lean_ctor_get(x_13, 0);
lean_inc(x_14);
x_15 = lean_ctor_get(x_13, 1);
lean_inc(x_15);
lean_dec(x_13);
x_16 = !lean_is_exclusive(x_14);
if (x_16 == 0)
{
lean_object* x_17; lean_object* x_18; uint8_t x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; lean_object* x_23; uint8_t x_24;
x_17 = lean_ctor_get(x_14, 3);
x_18 = l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13___closed__1;
x_19 = 0;
x_20 = lean_alloc_ctor(9, 3, 1);
lean_ctor_set(x_20, 0, x_1);
lean_ctor_set(x_20, 1, x_11);
lean_ctor_set(x_20, 2, x_18);
lean_ctor_set_uint8(x_20, sizeof(void*)*3, x_19);
lean_inc(x_9);
x_21 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_21, 0, x_9);
lean_ctor_set(x_21, 1, x_20);
x_22 = l_Lean_PersistentArray_push___rarg(x_17, x_21);
lean_ctor_set(x_14, 3, x_22);
x_23 = lean_st_ref_set(x_7, x_14, x_15);
x_24 = !lean_is_exclusive(x_23);
if (x_24 == 0)
{
lean_object* x_25; lean_object* x_26;
x_25 = lean_ctor_get(x_23, 0);
lean_dec(x_25);
x_26 = lean_box(0);
lean_ctor_set(x_23, 0, x_26);
return x_23;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_23, 1);
lean_inc(x_27);
lean_dec(x_23);
x_28 = lean_box(0);
x_29 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_29, 0, x_28);
lean_ctor_set(x_29, 1, x_27);
return x_29;
}
}
else
{
lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; uint8_t x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47;
x_30 = lean_ctor_get(x_14, 0);
x_31 = lean_ctor_get(x_14, 1);
x_32 = lean_ctor_get(x_14, 2);
x_33 = lean_ctor_get(x_14, 3);
x_34 = lean_ctor_get(x_14, 4);
x_35 = lean_ctor_get(x_14, 5);
x_36 = lean_ctor_get(x_14, 6);
lean_inc(x_36);
lean_inc(x_35);
lean_inc(x_34);
lean_inc(x_33);
lean_inc(x_32);
lean_inc(x_31);
lean_inc(x_30);
lean_dec(x_14);
x_37 = l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13___closed__1;
x_38 = 0;
x_39 = lean_alloc_ctor(9, 3, 1);
lean_ctor_set(x_39, 0, x_1);
lean_ctor_set(x_39, 1, x_11);
lean_ctor_set(x_39, 2, x_37);
lean_ctor_set_uint8(x_39, sizeof(void*)*3, x_38);
lean_inc(x_9);
x_40 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_40, 0, x_9);
lean_ctor_set(x_40, 1, x_39);
x_41 = l_Lean_PersistentArray_push___rarg(x_33, x_40);
x_42 = lean_alloc_ctor(0, 7, 0);
lean_ctor_set(x_42, 0, x_30);
lean_ctor_set(x_42, 1, x_31);
lean_ctor_set(x_42, 2, x_32);
lean_ctor_set(x_42, 3, x_41);
lean_ctor_set(x_42, 4, x_34);
lean_ctor_set(x_42, 5, x_35);
lean_ctor_set(x_42, 6, x_36);
x_43 = lean_st_ref_set(x_7, x_42, x_15);
x_44 = lean_ctor_get(x_43, 1);
lean_inc(x_44);
if (lean_is_exclusive(x_43)) {
lean_ctor_release(x_43, 0);
lean_ctor_release(x_43, 1);
x_45 = x_43;
} else {
lean_dec_ref(x_43);
x_45 = lean_box(0);
}
x_46 = lean_box(0);
if (lean_is_scalar(x_45)) {
x_47 = lean_alloc_ctor(0, 2, 0);
} else {
x_47 = x_45;
}
lean_ctor_set(x_47, 0, x_46);
lean_ctor_set(x_47, 1, x_44);
return x_47;
}
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("argument #", 10);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__1;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes(" was not used for structural recursion", 38);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__3;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("", 0);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__6() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__5;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3; lean_object* x_4; lean_object* x_5; lean_object* x_6; lean_object* x_7; lean_object* x_8; lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_3 = lean_unsigned_to_nat(1u);
x_4 = lean_nat_add(x_1, x_3);
x_5 = l_Nat_repr(x_4);
x_6 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_6, 0, x_5);
x_7 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_7, 0, x_6);
x_8 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__2;
x_9 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_9, 0, x_8);
lean_ctor_set(x_9, 1, x_7);
x_10 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__4;
x_11 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_11, 0, x_9);
lean_ctor_set(x_11, 1, x_10);
x_12 = l_Lean_indentD(x_2);
x_13 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_13, 0, x_11);
lean_ctor_set(x_13, 1, x_12);
x_14 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__6;
x_15 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_15, 0, x_13);
lean_ctor_set(x_15, 1, x_14);
return x_15;
}
}
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10; lean_object* x_11;
x_10 = lean_apply_2(x_1, x_2, x_4);
x_11 = l_Lean_Meta_mapErrorImp___rarg(x_10, x_3, x_5, x_6, x_7, x_8, x_9);
return x_11;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__1() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_levelZero;
x_2 = l_Lean_Expr_sort___override(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___lambda__1___boxed), 7, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes(" was not used because its type is an inductive datatype", 55);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__3;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("\nand parameter", 14);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__6() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__5;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__7() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("\ndepends on", 11);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__8() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__7;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__9() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes(" was not used because its type is an inductive family", 53);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__10() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__9;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__11() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("\nand index", 10);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__12() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__11;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__13() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("\ndepends on the non index", 25);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__14() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__13;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__15() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes(" was not used because its type is an inductive family and indices are not pairwise distinct", 91);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__16() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__15;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__17() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes(" was not used because its type is an inductive family and indices are not variables", 83);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__18() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__17;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, uint8_t x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12, lean_object* x_13, lean_object* x_14, lean_object* x_15) {
_start:
{
lean_object* x_16;
lean_dec(x_9);
lean_inc(x_11);
x_16 = l_Lean_Meta_getFVarLocalDecl(x_1, x_11, x_12, x_13, x_14, x_15);
if (lean_obj_tag(x_16) == 0)
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; uint8_t x_237;
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
x_237 = l_Lean_LocalDecl_isLet(x_17);
if (x_237 == 0)
{
lean_object* x_238; lean_object* x_239;
x_238 = l_Lean_LocalDecl_fvarId(x_17);
x_239 = l_Lean_RBNode_findCore___at_Lean_Elab_Structural_findRecArg_go___spec__12(x_6, x_238);
lean_dec(x_238);
if (lean_obj_tag(x_239) == 0)
{
if (x_7 == 0)
{
lean_object* x_240; lean_object* x_241; lean_object* x_242;
lean_dec(x_17);
lean_dec(x_8);
x_240 = lean_unsigned_to_nat(1u);
x_241 = lean_nat_add(x_2, x_240);
lean_dec(x_2);
x_242 = l_Lean_Elab_Structural_findRecArg_go___rarg(x_3, x_4, x_5, x_6, x_241, x_7, x_10, x_11, x_12, x_13, x_14, x_18);
return x_242;
}
else
{
lean_object* x_243;
x_243 = lean_box(0);
x_19 = x_243;
goto block_236;
}
}
else
{
lean_dec(x_239);
if (x_7 == 0)
{
lean_object* x_244;
x_244 = lean_box(0);
x_19 = x_244;
goto block_236;
}
else
{
lean_object* x_245; lean_object* x_246; lean_object* x_247;
lean_dec(x_17);
lean_dec(x_8);
x_245 = lean_unsigned_to_nat(1u);
x_246 = lean_nat_add(x_2, x_245);
lean_dec(x_2);
x_247 = l_Lean_Elab_Structural_findRecArg_go___rarg(x_3, x_4, x_5, x_6, x_246, x_7, x_10, x_11, x_12, x_13, x_14, x_18);
return x_247;
}
}
}
else
{
lean_object* x_248;
lean_dec(x_17);
lean_dec(x_10);
lean_dec(x_8);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_248 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg(x_11, x_12, x_13, x_14, x_18);
return x_248;
}
block_236:
{
lean_object* x_20; lean_object* x_21;
lean_dec(x_19);
x_20 = l_Lean_LocalDecl_type(x_17);
lean_dec(x_17);
lean_inc(x_14);
lean_inc(x_13);
lean_inc(x_12);
lean_inc(x_11);
x_21 = l_Lean_Meta_whnfD(x_20, x_11, x_12, x_13, x_14, x_18);
if (lean_obj_tag(x_21) == 0)
{
lean_object* x_22; lean_object* x_23; lean_object* x_24;
x_22 = lean_ctor_get(x_21, 0);
lean_inc(x_22);
x_23 = lean_ctor_get(x_21, 1);
lean_inc(x_23);
lean_dec(x_21);
x_24 = l_Lean_Expr_getAppFn(x_22);
if (lean_obj_tag(x_24) == 4)
{
lean_object* x_25; lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_25 = lean_ctor_get(x_24, 0);
lean_inc(x_25);
x_26 = lean_ctor_get(x_24, 1);
lean_inc(x_26);
lean_dec(x_24);
x_27 = lean_st_ref_get(x_14, x_23);
x_28 = lean_ctor_get(x_27, 0);
lean_inc(x_28);
x_29 = lean_ctor_get(x_27, 1);
lean_inc(x_29);
lean_dec(x_27);
x_30 = lean_ctor_get(x_28, 0);
lean_inc(x_30);
lean_dec(x_28);
x_31 = lean_environment_find(x_30, x_25);
if (lean_obj_tag(x_31) == 0)
{
lean_object* x_32; lean_object* x_33; lean_object* x_34;
lean_dec(x_26);
lean_dec(x_22);
lean_dec(x_8);
x_32 = lean_unsigned_to_nat(1u);
x_33 = lean_nat_add(x_2, x_32);
lean_dec(x_2);
x_34 = l_Lean_Elab_Structural_findRecArg_go___rarg(x_3, x_4, x_5, x_6, x_33, x_7, x_10, x_11, x_12, x_13, x_14, x_29);
return x_34;
}
else
{
lean_object* x_35;
x_35 = lean_ctor_get(x_31, 0);
lean_inc(x_35);
lean_dec(x_31);
if (lean_obj_tag(x_35) == 5)
{
lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40; lean_object* x_41; lean_object* x_42; uint8_t x_43;
x_36 = lean_ctor_get(x_35, 0);
lean_inc(x_36);
lean_dec(x_35);
x_37 = lean_ctor_get(x_36, 0);
lean_inc(x_37);
x_38 = lean_ctor_get(x_37, 0);
lean_inc(x_38);
lean_dec(x_37);
x_39 = l_Lean_brecOnSuffix;
lean_inc(x_38);
x_40 = l_Lean_Name_str___override(x_38, x_39);
x_41 = l_Lean_hasConst___at_Lean_Elab_Structural_findRecArg_go___spec__2(x_40, x_10, x_11, x_12, x_13, x_14, x_29);
x_42 = lean_ctor_get(x_41, 0);
lean_inc(x_42);
x_43 = lean_unbox(x_42);
lean_dec(x_42);
if (x_43 == 0)
{
lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47;
lean_dec(x_38);
lean_dec(x_36);
lean_dec(x_26);
lean_dec(x_22);
lean_dec(x_8);
x_44 = lean_ctor_get(x_41, 1);
lean_inc(x_44);
lean_dec(x_41);
x_45 = lean_unsigned_to_nat(1u);
x_46 = lean_nat_add(x_2, x_45);
lean_dec(x_2);
x_47 = l_Lean_Elab_Structural_findRecArg_go___rarg(x_3, x_4, x_5, x_6, x_46, x_7, x_10, x_11, x_12, x_13, x_14, x_44);
return x_47;
}
else
{
lean_object* x_48; lean_object* x_49; lean_object* x_50; lean_object* x_51; lean_object* x_52; lean_object* x_53; lean_object* x_54;
x_48 = lean_ctor_get(x_41, 1);
lean_inc(x_48);
lean_dec(x_41);
x_49 = l_Lean_binductionOnSuffix;
lean_inc(x_38);
x_50 = l_Lean_Name_str___override(x_38, x_49);
x_51 = l_Lean_hasConst___at_Lean_Elab_Structural_findRecArg_go___spec__2(x_50, x_10, x_11, x_12, x_13, x_14, x_48);
x_52 = lean_ctor_get(x_51, 0);
lean_inc(x_52);
x_53 = lean_ctor_get(x_51, 1);
lean_inc(x_53);
lean_dec(x_51);
lean_inc(x_14);
lean_inc(x_13);
lean_inc(x_12);
lean_inc(x_11);
lean_inc(x_38);
x_54 = l_Lean_Meta_isInductivePredicate(x_38, x_11, x_12, x_13, x_14, x_53);
if (lean_obj_tag(x_54) == 0)
{
lean_object* x_55; lean_object* x_56; uint8_t x_57; lean_object* x_58;
x_55 = lean_ctor_get(x_54, 0);
lean_inc(x_55);
x_56 = lean_ctor_get(x_54, 1);
lean_inc(x_56);
lean_dec(x_54);
x_57 = lean_ctor_get_uint8(x_36, sizeof(void*)*5 + 2);
if (x_57 == 0)
{
lean_object* x_214;
lean_dec(x_55);
lean_dec(x_52);
x_214 = lean_box(0);
x_58 = x_214;
goto block_213;
}
else
{
uint8_t x_215;
x_215 = lean_unbox(x_52);
lean_dec(x_52);
if (x_215 == 0)
{
uint8_t x_216;
x_216 = lean_unbox(x_55);
lean_dec(x_55);
if (x_216 == 0)
{
lean_object* x_217; lean_object* x_218; lean_object* x_219;
lean_dec(x_38);
lean_dec(x_36);
lean_dec(x_26);
lean_dec(x_22);
lean_dec(x_8);
x_217 = lean_unsigned_to_nat(1u);
x_218 = lean_nat_add(x_2, x_217);
lean_dec(x_2);
x_219 = l_Lean_Elab_Structural_findRecArg_go___rarg(x_3, x_4, x_5, x_6, x_218, x_7, x_10, x_11, x_12, x_13, x_14, x_56);
return x_219;
}
else
{
lean_object* x_220;
x_220 = lean_box(0);
x_58 = x_220;
goto block_213;
}
}
else
{
lean_object* x_221;
lean_dec(x_55);
x_221 = lean_box(0);
x_58 = x_221;
goto block_213;
}
}
block_213:
{
lean_object* x_59; lean_object* x_60; lean_object* x_61; lean_object* x_62; lean_object* x_63; lean_object* x_64; lean_object* x_65; lean_object* x_66; lean_object* x_67; lean_object* x_68; lean_object* x_69; lean_object* x_70; lean_object* x_167; lean_object* x_188; uint8_t x_189;
lean_dec(x_58);
x_59 = lean_unsigned_to_nat(0u);
x_60 = l___private_Lean_Expr_0__Lean_Expr_getAppNumArgsAux(x_22, x_59);
x_61 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__1;
lean_inc(x_60);
x_62 = lean_mk_array(x_60, x_61);
x_63 = lean_unsigned_to_nat(1u);
x_64 = lean_nat_sub(x_60, x_63);
lean_dec(x_60);
lean_inc(x_22);
x_65 = l___private_Lean_Expr_0__Lean_Expr_getAppArgsAux(x_22, x_62, x_64);
x_66 = lean_ctor_get(x_36, 1);
lean_inc(x_66);
lean_dec(x_36);
x_67 = l_Array_extract___rarg(x_65, x_59, x_66);
x_68 = lean_array_get_size(x_65);
x_69 = l_Array_extract___rarg(x_65, x_66, x_68);
lean_dec(x_68);
lean_dec(x_65);
x_188 = lean_array_get_size(x_69);
x_189 = lean_nat_dec_lt(x_59, x_188);
if (x_189 == 0)
{
lean_object* x_190;
lean_dec(x_188);
x_190 = lean_box(0);
x_167 = x_190;
goto block_187;
}
else
{
uint8_t x_191;
x_191 = lean_nat_dec_le(x_188, x_188);
if (x_191 == 0)
{
lean_object* x_192;
lean_dec(x_188);
x_192 = lean_box(0);
x_167 = x_192;
goto block_187;
}
else
{
size_t x_193; size_t x_194; uint8_t x_195;
x_193 = 0;
x_194 = lean_usize_of_nat(x_188);
lean_dec(x_188);
x_195 = l_Array_anyMUnsafe_any___at_Lean_Elab_Structural_findRecArg_go___spec__10(x_69, x_193, x_194);
if (x_195 == 0)
{
lean_object* x_196;
x_196 = lean_box(0);
x_167 = x_196;
goto block_187;
}
else
{
lean_object* x_197; lean_object* x_198; lean_object* x_199; lean_object* x_200; lean_object* x_201; lean_object* x_202; lean_object* x_203; lean_object* x_204; lean_object* x_205; lean_object* x_206; lean_object* x_207; lean_object* x_208; lean_object* x_209; lean_object* x_210; lean_object* x_211; lean_object* x_212;
lean_dec(x_69);
lean_dec(x_67);
lean_dec(x_38);
lean_dec(x_26);
lean_dec(x_8);
x_197 = lean_nat_add(x_2, x_63);
lean_dec(x_2);
lean_inc(x_197);
x_198 = l_Nat_repr(x_197);
x_199 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_199, 0, x_198);
x_200 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_200, 0, x_199);
x_201 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__2;
x_202 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_202, 0, x_201);
lean_ctor_set(x_202, 1, x_200);
x_203 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__18;
x_204 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_204, 0, x_202);
lean_ctor_set(x_204, 1, x_203);
x_205 = l_Lean_indentExpr(x_22);
x_206 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_206, 0, x_204);
lean_ctor_set(x_206, 1, x_205);
x_207 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__6;
x_208 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_208, 0, x_206);
lean_ctor_set(x_208, 1, x_207);
x_209 = lean_alloc_closure((void*)(l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__11___rarg___boxed), 7, 1);
lean_closure_set(x_209, 0, x_208);
x_210 = lean_box(x_7);
x_211 = lean_alloc_closure((void*)(l_Lean_Elab_Structural_findRecArg_go___rarg___boxed), 12, 6);
lean_closure_set(x_211, 0, x_3);
lean_closure_set(x_211, 1, x_4);
lean_closure_set(x_211, 2, x_5);
lean_closure_set(x_211, 3, x_6);
lean_closure_set(x_211, 4, x_197);
lean_closure_set(x_211, 5, x_210);
x_212 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg(x_209, x_211, x_10, x_11, x_12, x_13, x_14, x_56);
return x_212;
}
}
}
block_166:
{
lean_object* x_71; lean_object* x_72; lean_object* x_73;
x_71 = l_Array_extract___rarg(x_4, x_59, x_70);
x_72 = l_Array_extract___rarg(x_4, x_70, x_8);
lean_dec(x_8);
lean_inc(x_14);
lean_inc(x_13);
lean_inc(x_12);
lean_inc(x_11);
x_73 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f(x_72, x_69, x_11, x_12, x_13, x_14, x_56);
if (lean_obj_tag(x_73) == 0)
{
lean_object* x_74;
x_74 = lean_ctor_get(x_73, 0);
lean_inc(x_74);
if (lean_obj_tag(x_74) == 0)
{
lean_object* x_75; lean_object* x_76;
x_75 = lean_ctor_get(x_73, 1);
lean_inc(x_75);
lean_dec(x_73);
lean_inc(x_14);
lean_inc(x_13);
lean_inc(x_12);
lean_inc(x_11);
x_76 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadParamDep_x3f(x_72, x_67, x_11, x_12, x_13, x_14, x_75);
if (lean_obj_tag(x_76) == 0)
{
lean_object* x_77;
x_77 = lean_ctor_get(x_76, 0);
lean_inc(x_77);
if (lean_obj_tag(x_77) == 0)
{
lean_object* x_78; lean_object* x_79; size_t x_80; size_t x_81; lean_object* x_82; lean_object* x_83;
lean_dec(x_22);
x_78 = lean_ctor_get(x_76, 1);
lean_inc(x_78);
lean_dec(x_76);
x_79 = lean_array_get_size(x_69);
x_80 = lean_usize_of_nat(x_79);
lean_dec(x_79);
x_81 = 0;
lean_inc(x_69);
x_82 = l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3(x_72, x_80, x_81, x_69);
lean_inc(x_14);
lean_inc(x_13);
lean_inc(x_12);
lean_inc(x_11);
lean_inc(x_38);
x_83 = l_Lean_Meta_isInductivePredicate(x_38, x_11, x_12, x_13, x_14, x_78);
if (lean_obj_tag(x_83) == 0)
{
lean_object* x_84; lean_object* x_85; lean_object* x_86; lean_object* x_87; lean_object* x_88; uint8_t x_89; lean_object* x_90; lean_object* x_91; lean_object* x_92; lean_object* x_93; lean_object* x_94; lean_object* x_95; lean_object* x_96; lean_object* x_97;
x_84 = lean_ctor_get(x_83, 0);
lean_inc(x_84);
x_85 = lean_ctor_get(x_83, 1);
lean_inc(x_85);
lean_dec(x_83);
x_86 = lean_array_get_size(x_71);
x_87 = lean_nat_sub(x_2, x_86);
lean_dec(x_86);
x_88 = lean_alloc_ctor(0, 8, 2);
lean_ctor_set(x_88, 0, x_71);
lean_ctor_set(x_88, 1, x_72);
lean_ctor_set(x_88, 2, x_87);
lean_ctor_set(x_88, 3, x_82);
lean_ctor_set(x_88, 4, x_38);
lean_ctor_set(x_88, 5, x_26);
lean_ctor_set(x_88, 6, x_67);
lean_ctor_set(x_88, 7, x_69);
lean_ctor_set_uint8(x_88, sizeof(void*)*8, x_57);
x_89 = lean_unbox(x_84);
lean_dec(x_84);
lean_ctor_set_uint8(x_88, sizeof(void*)*8 + 1, x_89);
lean_inc(x_2);
x_90 = lean_alloc_closure((void*)(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___boxed), 2, 1);
lean_closure_set(x_90, 0, x_2);
lean_inc(x_5);
x_91 = lean_alloc_closure((void*)(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__2), 9, 3);
lean_closure_set(x_91, 0, x_5);
lean_closure_set(x_91, 1, x_88);
lean_closure_set(x_91, 2, x_90);
x_92 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__2;
x_93 = lean_alloc_closure((void*)(l_ReaderT_bind___at_Lean_Elab_Structural_findRecArg_go___spec__4___rarg), 8, 2);
lean_closure_set(x_93, 0, x_91);
lean_closure_set(x_93, 1, x_92);
x_94 = lean_nat_add(x_2, x_63);
lean_dec(x_2);
x_95 = lean_box(x_7);
x_96 = lean_alloc_closure((void*)(l_Lean_Elab_Structural_findRecArg_go___rarg___boxed), 12, 6);
lean_closure_set(x_96, 0, x_3);
lean_closure_set(x_96, 1, x_4);
lean_closure_set(x_96, 2, x_5);
lean_closure_set(x_96, 3, x_6);
lean_closure_set(x_96, 4, x_94);
lean_closure_set(x_96, 5, x_95);
x_97 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg(x_93, x_96, x_10, x_11, x_12, x_13, x_14, x_85);
return x_97;
}
else
{
uint8_t x_98;
lean_dec(x_82);
lean_dec(x_72);
lean_dec(x_71);
lean_dec(x_69);
lean_dec(x_67);
lean_dec(x_38);
lean_dec(x_26);
lean_dec(x_14);
lean_dec(x_13);
lean_dec(x_12);
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_98 = !lean_is_exclusive(x_83);
if (x_98 == 0)
{
return x_83;
}
else
{
lean_object* x_99; lean_object* x_100; lean_object* x_101;
x_99 = lean_ctor_get(x_83, 0);
x_100 = lean_ctor_get(x_83, 1);
lean_inc(x_100);
lean_inc(x_99);
lean_dec(x_83);
x_101 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_101, 0, x_99);
lean_ctor_set(x_101, 1, x_100);
return x_101;
}
}
}
else
{
lean_object* x_102; lean_object* x_103; lean_object* x_104; lean_object* x_105; lean_object* x_106; lean_object* x_107; lean_object* x_108; lean_object* x_109; lean_object* x_110; lean_object* x_111; lean_object* x_112; lean_object* x_113; lean_object* x_114; lean_object* x_115; lean_object* x_116; lean_object* x_117; lean_object* x_118; lean_object* x_119; lean_object* x_120; lean_object* x_121; lean_object* x_122; lean_object* x_123; lean_object* x_124; lean_object* x_125; lean_object* x_126; lean_object* x_127; lean_object* x_128; lean_object* x_129;
lean_dec(x_72);
lean_dec(x_71);
lean_dec(x_69);
lean_dec(x_67);
lean_dec(x_38);
lean_dec(x_26);
x_102 = lean_ctor_get(x_77, 0);
lean_inc(x_102);
lean_dec(x_77);
x_103 = lean_ctor_get(x_76, 1);
lean_inc(x_103);
lean_dec(x_76);
x_104 = lean_ctor_get(x_102, 0);
lean_inc(x_104);
x_105 = lean_ctor_get(x_102, 1);
lean_inc(x_105);
lean_dec(x_102);
x_106 = lean_nat_add(x_2, x_63);
lean_dec(x_2);
lean_inc(x_106);
x_107 = l_Nat_repr(x_106);
x_108 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_108, 0, x_107);
x_109 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_109, 0, x_108);
x_110 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__2;
x_111 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_111, 0, x_110);
lean_ctor_set(x_111, 1, x_109);
x_112 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__4;
x_113 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_113, 0, x_111);
lean_ctor_set(x_113, 1, x_112);
x_114 = l_Lean_indentExpr(x_22);
x_115 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_115, 0, x_113);
lean_ctor_set(x_115, 1, x_114);
x_116 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__6;
x_117 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_117, 0, x_115);
lean_ctor_set(x_117, 1, x_116);
x_118 = l_Lean_indentExpr(x_104);
x_119 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_119, 0, x_117);
lean_ctor_set(x_119, 1, x_118);
x_120 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__8;
x_121 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_121, 0, x_119);
lean_ctor_set(x_121, 1, x_120);
x_122 = l_Lean_indentExpr(x_105);
x_123 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_123, 0, x_121);
lean_ctor_set(x_123, 1, x_122);
x_124 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__6;
x_125 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_125, 0, x_123);
lean_ctor_set(x_125, 1, x_124);
x_126 = lean_alloc_closure((void*)(l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__5___rarg___boxed), 7, 1);
lean_closure_set(x_126, 0, x_125);
x_127 = lean_box(x_7);
x_128 = lean_alloc_closure((void*)(l_Lean_Elab_Structural_findRecArg_go___rarg___boxed), 12, 6);
lean_closure_set(x_128, 0, x_3);
lean_closure_set(x_128, 1, x_4);
lean_closure_set(x_128, 2, x_5);
lean_closure_set(x_128, 3, x_6);
lean_closure_set(x_128, 4, x_106);
lean_closure_set(x_128, 5, x_127);
x_129 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg(x_126, x_128, x_10, x_11, x_12, x_13, x_14, x_103);
return x_129;
}
}
else
{
uint8_t x_130;
lean_dec(x_72);
lean_dec(x_71);
lean_dec(x_69);
lean_dec(x_67);
lean_dec(x_38);
lean_dec(x_26);
lean_dec(x_22);
lean_dec(x_14);
lean_dec(x_13);
lean_dec(x_12);
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_130 = !lean_is_exclusive(x_76);
if (x_130 == 0)
{
return x_76;
}
else
{
lean_object* x_131; lean_object* x_132; lean_object* x_133;
x_131 = lean_ctor_get(x_76, 0);
x_132 = lean_ctor_get(x_76, 1);
lean_inc(x_132);
lean_inc(x_131);
lean_dec(x_76);
x_133 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_133, 0, x_131);
lean_ctor_set(x_133, 1, x_132);
return x_133;
}
}
}
else
{
lean_object* x_134; lean_object* x_135; lean_object* x_136; lean_object* x_137; lean_object* x_138; lean_object* x_139; lean_object* x_140; lean_object* x_141; lean_object* x_142; lean_object* x_143; lean_object* x_144; lean_object* x_145; lean_object* x_146; lean_object* x_147; lean_object* x_148; lean_object* x_149; lean_object* x_150; lean_object* x_151; lean_object* x_152; lean_object* x_153; lean_object* x_154; lean_object* x_155; lean_object* x_156; lean_object* x_157; lean_object* x_158; lean_object* x_159; lean_object* x_160; lean_object* x_161;
lean_dec(x_72);
lean_dec(x_71);
lean_dec(x_69);
lean_dec(x_67);
lean_dec(x_38);
lean_dec(x_26);
x_134 = lean_ctor_get(x_74, 0);
lean_inc(x_134);
lean_dec(x_74);
x_135 = lean_ctor_get(x_73, 1);
lean_inc(x_135);
lean_dec(x_73);
x_136 = lean_ctor_get(x_134, 0);
lean_inc(x_136);
x_137 = lean_ctor_get(x_134, 1);
lean_inc(x_137);
lean_dec(x_134);
x_138 = lean_nat_add(x_2, x_63);
lean_dec(x_2);
lean_inc(x_138);
x_139 = l_Nat_repr(x_138);
x_140 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_140, 0, x_139);
x_141 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_141, 0, x_140);
x_142 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__2;
x_143 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_143, 0, x_142);
lean_ctor_set(x_143, 1, x_141);
x_144 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__10;
x_145 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_145, 0, x_143);
lean_ctor_set(x_145, 1, x_144);
x_146 = l_Lean_indentExpr(x_22);
x_147 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_147, 0, x_145);
lean_ctor_set(x_147, 1, x_146);
x_148 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__12;
x_149 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_149, 0, x_147);
lean_ctor_set(x_149, 1, x_148);
x_150 = l_Lean_indentExpr(x_136);
x_151 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_151, 0, x_149);
lean_ctor_set(x_151, 1, x_150);
x_152 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__14;
x_153 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_153, 0, x_151);
lean_ctor_set(x_153, 1, x_152);
x_154 = l_Lean_indentExpr(x_137);
x_155 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_155, 0, x_153);
lean_ctor_set(x_155, 1, x_154);
x_156 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__6;
x_157 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_157, 0, x_155);
lean_ctor_set(x_157, 1, x_156);
x_158 = lean_alloc_closure((void*)(l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__6___rarg___boxed), 7, 1);
lean_closure_set(x_158, 0, x_157);
x_159 = lean_box(x_7);
x_160 = lean_alloc_closure((void*)(l_Lean_Elab_Structural_findRecArg_go___rarg___boxed), 12, 6);
lean_closure_set(x_160, 0, x_3);
lean_closure_set(x_160, 1, x_4);
lean_closure_set(x_160, 2, x_5);
lean_closure_set(x_160, 3, x_6);
lean_closure_set(x_160, 4, x_138);
lean_closure_set(x_160, 5, x_159);
x_161 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg(x_158, x_160, x_10, x_11, x_12, x_13, x_14, x_135);
return x_161;
}
}
else
{
uint8_t x_162;
lean_dec(x_72);
lean_dec(x_71);
lean_dec(x_69);
lean_dec(x_67);
lean_dec(x_38);
lean_dec(x_26);
lean_dec(x_22);
lean_dec(x_14);
lean_dec(x_13);
lean_dec(x_12);
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_162 = !lean_is_exclusive(x_73);
if (x_162 == 0)
{
return x_73;
}
else
{
lean_object* x_163; lean_object* x_164; lean_object* x_165;
x_163 = lean_ctor_get(x_73, 0);
x_164 = lean_ctor_get(x_73, 1);
lean_inc(x_164);
lean_inc(x_163);
lean_dec(x_73);
x_165 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_165, 0, x_163);
lean_ctor_set(x_165, 1, x_164);
return x_165;
}
}
}
block_187:
{
uint8_t x_168;
lean_dec(x_167);
x_168 = l___private_Init_Data_Array_Basic_0__Array_allDiffAux___at_Lean_Elab_Structural_findRecArg_go___spec__7(x_69, x_59);
if (x_168 == 0)
{
lean_object* x_169; lean_object* x_170; lean_object* x_171; lean_object* x_172; lean_object* x_173; lean_object* x_174; lean_object* x_175; lean_object* x_176; lean_object* x_177; lean_object* x_178; lean_object* x_179; lean_object* x_180; lean_object* x_181; lean_object* x_182; lean_object* x_183; lean_object* x_184;
lean_dec(x_69);
lean_dec(x_67);
lean_dec(x_38);
lean_dec(x_26);
lean_dec(x_8);
x_169 = lean_nat_add(x_2, x_63);
lean_dec(x_2);
lean_inc(x_169);
x_170 = l_Nat_repr(x_169);
x_171 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_171, 0, x_170);
x_172 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_172, 0, x_171);
x_173 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__2;
x_174 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_174, 0, x_173);
lean_ctor_set(x_174, 1, x_172);
x_175 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__16;
x_176 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_176, 0, x_174);
lean_ctor_set(x_176, 1, x_175);
x_177 = l_Lean_indentExpr(x_22);
x_178 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_178, 0, x_176);
lean_ctor_set(x_178, 1, x_177);
x_179 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__6;
x_180 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_180, 0, x_178);
lean_ctor_set(x_180, 1, x_179);
x_181 = lean_alloc_closure((void*)(l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__9___rarg___boxed), 7, 1);
lean_closure_set(x_181, 0, x_180);
x_182 = lean_box(x_7);
x_183 = lean_alloc_closure((void*)(l_Lean_Elab_Structural_findRecArg_go___rarg___boxed), 12, 6);
lean_closure_set(x_183, 0, x_3);
lean_closure_set(x_183, 1, x_4);
lean_closure_set(x_183, 2, x_5);
lean_closure_set(x_183, 3, x_6);
lean_closure_set(x_183, 4, x_169);
lean_closure_set(x_183, 5, x_182);
x_184 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg(x_181, x_183, x_10, x_11, x_12, x_13, x_14, x_56);
return x_184;
}
else
{
lean_object* x_185; uint8_t x_186;
x_185 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_getIndexMinPos(x_4, x_69);
x_186 = lean_nat_dec_lt(x_185, x_3);
if (x_186 == 0)
{
lean_dec(x_185);
lean_inc(x_3);
x_70 = x_3;
goto block_166;
}
else
{
x_70 = x_185;
goto block_166;
}
}
}
}
}
else
{
uint8_t x_222;
lean_dec(x_52);
lean_dec(x_38);
lean_dec(x_36);
lean_dec(x_26);
lean_dec(x_22);
lean_dec(x_14);
lean_dec(x_13);
lean_dec(x_12);
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_8);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_222 = !lean_is_exclusive(x_54);
if (x_222 == 0)
{
return x_54;
}
else
{
lean_object* x_223; lean_object* x_224; lean_object* x_225;
x_223 = lean_ctor_get(x_54, 0);
x_224 = lean_ctor_get(x_54, 1);
lean_inc(x_224);
lean_inc(x_223);
lean_dec(x_54);
x_225 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_225, 0, x_223);
lean_ctor_set(x_225, 1, x_224);
return x_225;
}
}
}
}
else
{
lean_object* x_226; lean_object* x_227; lean_object* x_228;
lean_dec(x_35);
lean_dec(x_26);
lean_dec(x_22);
lean_dec(x_8);
x_226 = lean_unsigned_to_nat(1u);
x_227 = lean_nat_add(x_2, x_226);
lean_dec(x_2);
x_228 = l_Lean_Elab_Structural_findRecArg_go___rarg(x_3, x_4, x_5, x_6, x_227, x_7, x_10, x_11, x_12, x_13, x_14, x_29);
return x_228;
}
}
}
else
{
lean_object* x_229; lean_object* x_230; lean_object* x_231;
lean_dec(x_24);
lean_dec(x_22);
lean_dec(x_8);
x_229 = lean_unsigned_to_nat(1u);
x_230 = lean_nat_add(x_2, x_229);
lean_dec(x_2);
x_231 = l_Lean_Elab_Structural_findRecArg_go___rarg(x_3, x_4, x_5, x_6, x_230, x_7, x_10, x_11, x_12, x_13, x_14, x_23);
return x_231;
}
}
else
{
uint8_t x_232;
lean_dec(x_14);
lean_dec(x_13);
lean_dec(x_12);
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_8);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_232 = !lean_is_exclusive(x_21);
if (x_232 == 0)
{
return x_21;
}
else
{
lean_object* x_233; lean_object* x_234; lean_object* x_235;
x_233 = lean_ctor_get(x_21, 0);
x_234 = lean_ctor_get(x_21, 1);
lean_inc(x_234);
lean_inc(x_233);
lean_dec(x_21);
x_235 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_235, 0, x_233);
lean_ctor_set(x_235, 1, x_234);
return x_235;
}
}
}
}
else
{
uint8_t x_249;
lean_dec(x_14);
lean_dec(x_13);
lean_dec(x_12);
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_8);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
x_249 = !lean_is_exclusive(x_16);
if (x_249 == 0)
{
return x_16;
}
else
{
lean_object* x_250; lean_object* x_251; lean_object* x_252;
x_250 = lean_ctor_get(x_16, 0);
x_251 = lean_ctor_get(x_16, 1);
lean_inc(x_251);
lean_inc(x_250);
lean_dec(x_16);
x_252 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_252, 0, x_250);
lean_ctor_set(x_252, 1, x_251);
return x_252;
}
}
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("Elab", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__2() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("definition", 10);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__3() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("structural", 10);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__4() {
_start:
{
lean_object* x_1; lean_object* x_2; lean_object* x_3; lean_object* x_4;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___closed__1;
x_2 = l_Lean_Elab_Structural_findRecArg_go___rarg___closed__2;
x_3 = l_Lean_Elab_Structural_findRecArg_go___rarg___closed__3;
x_4 = l_Lean_Name_mkStr3(x_1, x_2, x_3);
return x_4;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__5() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("findRecArg x: ", 14);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__6() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___closed__5;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__7() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes(", firstPass: ", 13);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__8() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___closed__7;
x_2 = l_Lean_stringToMessageData(x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__9() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("false", 5);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__10() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___closed__9;
x_2 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__11() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___closed__10;
x_2 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__12() {
_start:
{
lean_object* x_1;
x_1 = lean_mk_string_from_bytes("true", 4);
return x_1;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__13() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___closed__12;
x_2 = lean_alloc_ctor(3, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
static lean_object* _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__14() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = l_Lean_Elab_Structural_findRecArg_go___rarg___closed__13;
x_2 = lean_alloc_ctor(0, 1, 0);
lean_ctor_set(x_2, 0, x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, uint8_t x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
lean_object* x_13; uint8_t x_14;
x_13 = lean_array_get_size(x_2);
x_14 = lean_nat_dec_lt(x_5, x_13);
if (x_14 == 0)
{
lean_dec(x_13);
lean_dec(x_5);
if (x_6 == 0)
{
lean_object* x_15;
lean_dec(x_7);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_15 = l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg(x_8, x_9, x_10, x_11, x_12);
return x_15;
}
else
{
uint8_t x_16;
x_16 = 0;
lean_inc(x_1);
{
lean_object* _tmp_4 = x_1;
uint8_t _tmp_5 = x_16;
x_5 = _tmp_4;
x_6 = _tmp_5;
}
goto _start;
}
}
else
{
lean_object* x_18; lean_object* x_19; lean_object* x_20; lean_object* x_21; uint8_t x_22;
x_18 = lean_array_fget(x_2, x_5);
x_19 = l_Lean_Elab_Structural_findRecArg_go___rarg___closed__4;
x_20 = l_Lean_isTracingEnabledFor___at_Lean_Elab_Structural_findRecArg_go___spec__1(x_19, x_7, x_8, x_9, x_10, x_11, x_12);
x_21 = lean_ctor_get(x_20, 0);
lean_inc(x_21);
x_22 = lean_unbox(x_21);
lean_dec(x_21);
if (x_22 == 0)
{
lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_23 = lean_ctor_get(x_20, 1);
lean_inc(x_23);
lean_dec(x_20);
x_24 = lean_box(0);
x_25 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3(x_18, x_5, x_1, x_2, x_3, x_4, x_6, x_13, x_24, x_7, x_8, x_9, x_10, x_11, x_23);
return x_25;
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31;
x_26 = lean_ctor_get(x_20, 1);
lean_inc(x_26);
lean_dec(x_20);
lean_inc(x_18);
x_27 = l_Lean_MessageData_ofExpr(x_18);
x_28 = l_Lean_Elab_Structural_findRecArg_go___rarg___closed__6;
x_29 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_29, 0, x_28);
lean_ctor_set(x_29, 1, x_27);
x_30 = l_Lean_Elab_Structural_findRecArg_go___rarg___closed__8;
x_31 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_31, 0, x_29);
lean_ctor_set(x_31, 1, x_30);
if (x_6 == 0)
{
lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; lean_object* x_38; lean_object* x_39;
x_32 = l_Lean_Elab_Structural_findRecArg_go___rarg___closed__11;
x_33 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_33, 0, x_31);
lean_ctor_set(x_33, 1, x_32);
x_34 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__6;
x_35 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_35, 0, x_33);
lean_ctor_set(x_35, 1, x_34);
x_36 = l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13(x_19, x_35, x_7, x_8, x_9, x_10, x_11, x_26);
x_37 = lean_ctor_get(x_36, 0);
lean_inc(x_37);
x_38 = lean_ctor_get(x_36, 1);
lean_inc(x_38);
lean_dec(x_36);
x_39 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3(x_18, x_5, x_1, x_2, x_3, x_4, x_6, x_13, x_37, x_7, x_8, x_9, x_10, x_11, x_38);
return x_39;
}
else
{
lean_object* x_40; lean_object* x_41; lean_object* x_42; lean_object* x_43; lean_object* x_44; lean_object* x_45; lean_object* x_46; lean_object* x_47;
x_40 = l_Lean_Elab_Structural_findRecArg_go___rarg___closed__14;
x_41 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_41, 0, x_31);
lean_ctor_set(x_41, 1, x_40);
x_42 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__6;
x_43 = lean_alloc_ctor(7, 2, 0);
lean_ctor_set(x_43, 0, x_41);
lean_ctor_set(x_43, 1, x_42);
x_44 = l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13(x_19, x_43, x_7, x_8, x_9, x_10, x_11, x_26);
x_45 = lean_ctor_get(x_44, 0);
lean_inc(x_45);
x_46 = lean_ctor_get(x_44, 1);
lean_inc(x_46);
lean_dec(x_44);
x_47 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3(x_18, x_5, x_1, x_2, x_3, x_4, x_6, x_13, x_45, x_7, x_8, x_9, x_10, x_11, x_46);
return x_47;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg_go(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_Elab_Structural_findRecArg_go___rarg___boxed), 12, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_isTracingEnabledFor___at_Lean_Elab_Structural_findRecArg_go___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
x_8 = l_Lean_isTracingEnabledFor___at_Lean_Elab_Structural_findRecArg_go___spec__1(x_1, x_2, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_hasConst___at_Lean_Elab_Structural_findRecArg_go___spec__2___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
x_8 = l_Lean_hasConst___at_Lean_Elab_Structural_findRecArg_go___spec__2(x_1, x_2, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; size_t x_6; lean_object* x_7;
x_5 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_6 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_7 = l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3(x_1, x_5, x_6, x_4);
lean_dec(x_1);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__5___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
x_8 = l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__5___rarg(x_1, x_2, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__6___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
x_8 = l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__6___rarg(x_1, x_2, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_8;
}
}
LEAN_EXPORT lean_object* l___private_Init_Data_Array_Basic_0__Array_allDiffAuxAux___at_Lean_Elab_Structural_findRecArg_go___spec__8___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
uint8_t x_5; lean_object* x_6;
x_5 = l___private_Init_Data_Array_Basic_0__Array_allDiffAuxAux___at_Lean_Elab_Structural_findRecArg_go___spec__8(x_1, x_2, x_3, x_4);
lean_dec(x_2);
lean_dec(x_1);
x_6 = lean_box(x_5);
return x_6;
}
}
LEAN_EXPORT lean_object* l___private_Init_Data_Array_Basic_0__Array_allDiffAux___at_Lean_Elab_Structural_findRecArg_go___spec__7___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
uint8_t x_3; lean_object* x_4;
x_3 = l___private_Init_Data_Array_Basic_0__Array_allDiffAux___at_Lean_Elab_Structural_findRecArg_go___spec__7(x_1, x_2);
lean_dec(x_1);
x_4 = lean_box(x_3);
return x_4;
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__9___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
x_8 = l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__9___rarg(x_1, x_2, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Array_anyMUnsafe_any___at_Lean_Elab_Structural_findRecArg_go___spec__10___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
size_t x_4; size_t x_5; uint8_t x_6; lean_object* x_7;
x_4 = lean_unbox_usize(x_2);
lean_dec(x_2);
x_5 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_6 = l_Array_anyMUnsafe_any___at_Lean_Elab_Structural_findRecArg_go___spec__10(x_1, x_4, x_5);
lean_dec(x_1);
x_7 = lean_box(x_6);
return x_7;
}
}
LEAN_EXPORT lean_object* l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__11___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7) {
_start:
{
lean_object* x_8;
x_8 = l_Lean_throwError___at_Lean_Elab_Structural_findRecArg_go___spec__11___rarg(x_1, x_2, x_3, x_4, x_5, x_6, x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_RBNode_findCore___at_Lean_Elab_Structural_findRecArg_go___spec__12___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_RBNode_findCore___at_Lean_Elab_Structural_findRecArg_go___spec__12(x_1, x_2);
lean_dec(x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9;
x_9 = l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_9;
}
}
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12, lean_object* x_13, lean_object* x_14, lean_object* x_15) {
_start:
{
uint8_t x_16; lean_object* x_17;
x_16 = lean_unbox(x_7);
lean_dec(x_7);
x_17 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3(x_1, x_2, x_3, x_4, x_5, x_6, x_16, x_8, x_9, x_10, x_11, x_12, x_13, x_14, x_15);
return x_17;
}
}
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg_go___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
uint8_t x_13; lean_object* x_14;
x_13 = lean_unbox(x_6);
lean_dec(x_6);
x_14 = l_Lean_Elab_Structural_findRecArg_go___rarg(x_1, x_2, x_3, x_4, x_5, x_13, x_7, x_8, x_9, x_10, x_11, x_12);
return x_14;
}
}
LEAN_EXPORT uint8_t l_Array_anyMUnsafe_any___at_Lean_Elab_Structural_findRecArg___spec__1(lean_object* x_1, lean_object* x_2, size_t x_3, size_t x_4) {
_start:
{
uint8_t x_5;
x_5 = lean_usize_dec_eq(x_3, x_4);
if (x_5 == 0)
{
lean_object* x_6; uint8_t x_7;
x_6 = lean_array_uget(x_2, x_3);
x_7 = lean_expr_eqv(x_6, x_1);
lean_dec(x_6);
if (x_7 == 0)
{
size_t x_8; size_t x_9;
x_8 = 1;
x_9 = lean_usize_add(x_3, x_8);
x_3 = x_9;
goto _start;
}
else
{
uint8_t x_11;
x_11 = 1;
return x_11;
}
}
else
{
uint8_t x_12;
x_12 = 0;
return x_12;
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7___rarg___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10;
x_10 = lean_apply_8(x_1, x_4, x_2, x_3, x_5, x_6, x_7, x_8, x_9);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7___rarg(lean_object* x_1, uint8_t x_2, lean_object* x_3, lean_object* x_4, uint8_t x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_alloc_closure((void*)(l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7___rarg___lambda__1), 9, 3);
lean_closure_set(x_13, 0, x_4);
lean_closure_set(x_13, 1, x_6);
lean_closure_set(x_13, 2, x_7);
x_14 = l___private_Lean_Meta_Basic_0__Lean_Meta_withLocalDeclImp___rarg(x_1, x_2, x_3, x_13, x_5, x_8, x_9, x_10, x_11, x_12);
if (lean_obj_tag(x_14) == 0)
{
uint8_t x_15;
x_15 = !lean_is_exclusive(x_14);
if (x_15 == 0)
{
return x_14;
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_16 = lean_ctor_get(x_14, 0);
x_17 = lean_ctor_get(x_14, 1);
lean_inc(x_17);
lean_inc(x_16);
lean_dec(x_14);
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_16);
lean_ctor_set(x_18, 1, x_17);
return x_18;
}
}
else
{
uint8_t x_19;
x_19 = !lean_is_exclusive(x_14);
if (x_19 == 0)
{
return x_14;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_20 = lean_ctor_get(x_14, 0);
x_21 = lean_ctor_get(x_14, 1);
lean_inc(x_21);
lean_inc(x_20);
lean_dec(x_14);
x_22 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_22, 0, x_20);
lean_ctor_set(x_22, 1, x_21);
return x_22;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = lean_alloc_closure((void*)(l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7___rarg___boxed), 12, 0);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_visitLambda_visit___at_Lean_Elab_Structural_findRecArg___spec__6___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_array_push(x_1, x_5);
x_14 = l_Lean_Meta_visitLambda_visit___at_Lean_Elab_Structural_findRecArg___spec__6(x_2, x_3, x_13, x_4, x_6, x_7, x_8, x_9, x_10, x_11, x_12);
return x_14;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_visitLambda_visit___at_Lean_Elab_Structural_findRecArg___spec__6(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11) {
_start:
{
if (lean_obj_tag(x_4) == 6)
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; uint8_t x_15; lean_object* x_16; lean_object* x_17;
x_12 = lean_ctor_get(x_4, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_4, 1);
lean_inc(x_13);
x_14 = lean_ctor_get(x_4, 2);
lean_inc(x_14);
x_15 = lean_ctor_get_uint8(x_4, sizeof(void*)*3 + 8);
lean_dec(x_4);
x_16 = lean_expr_instantiate_rev(x_13, x_3);
lean_dec(x_13);
lean_inc(x_2);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_16);
x_17 = lean_apply_8(x_2, x_16, x_5, x_6, x_7, x_8, x_9, x_10, x_11);
if (lean_obj_tag(x_17) == 0)
{
lean_object* x_18; lean_object* x_19; uint8_t x_20; lean_object* x_21;
x_18 = lean_ctor_get(x_17, 1);
lean_inc(x_18);
lean_dec(x_17);
x_19 = lean_alloc_closure((void*)(l_Lean_Meta_visitLambda_visit___at_Lean_Elab_Structural_findRecArg___spec__6___lambda__1), 12, 4);
lean_closure_set(x_19, 0, x_3);
lean_closure_set(x_19, 1, x_1);
lean_closure_set(x_19, 2, x_2);
lean_closure_set(x_19, 3, x_14);
x_20 = 0;
x_21 = l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7___rarg(x_12, x_15, x_16, x_19, x_20, x_5, x_6, x_7, x_8, x_9, x_10, x_18);
return x_21;
}
else
{
uint8_t x_22;
lean_dec(x_16);
lean_dec(x_14);
lean_dec(x_12);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_22 = !lean_is_exclusive(x_17);
if (x_22 == 0)
{
return x_17;
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_23 = lean_ctor_get(x_17, 0);
x_24 = lean_ctor_get(x_17, 1);
lean_inc(x_24);
lean_inc(x_23);
lean_dec(x_17);
x_25 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_25, 0, x_23);
lean_ctor_set(x_25, 1, x_24);
return x_25;
}
}
}
else
{
lean_object* x_26; lean_object* x_27;
lean_dec(x_1);
x_26 = lean_expr_instantiate_rev(x_4, x_3);
lean_dec(x_3);
lean_dec(x_4);
x_27 = lean_apply_8(x_2, x_26, x_5, x_6, x_7, x_8, x_9, x_10, x_11);
return x_27;
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_visitLambda___at_Lean_Elab_Structural_findRecArg___spec__5(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
lean_object* x_11; lean_object* x_12;
x_11 = l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13___closed__1;
x_12 = l_Lean_Meta_visitLambda_visit___at_Lean_Elab_Structural_findRecArg___spec__6(x_1, x_2, x_11, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__10___rarg(lean_object* x_1, uint8_t x_2, lean_object* x_3, lean_object* x_4, uint8_t x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_alloc_closure((void*)(l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7___rarg___lambda__1), 9, 3);
lean_closure_set(x_13, 0, x_4);
lean_closure_set(x_13, 1, x_6);
lean_closure_set(x_13, 2, x_7);
x_14 = l___private_Lean_Meta_Basic_0__Lean_Meta_withLocalDeclImp___rarg(x_1, x_2, x_3, x_13, x_5, x_8, x_9, x_10, x_11, x_12);
if (lean_obj_tag(x_14) == 0)
{
uint8_t x_15;
x_15 = !lean_is_exclusive(x_14);
if (x_15 == 0)
{
return x_14;
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_16 = lean_ctor_get(x_14, 0);
x_17 = lean_ctor_get(x_14, 1);
lean_inc(x_17);
lean_inc(x_16);
lean_dec(x_14);
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_16);
lean_ctor_set(x_18, 1, x_17);
return x_18;
}
}
else
{
uint8_t x_19;
x_19 = !lean_is_exclusive(x_14);
if (x_19 == 0)
{
return x_14;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_20 = lean_ctor_get(x_14, 0);
x_21 = lean_ctor_get(x_14, 1);
lean_inc(x_21);
lean_inc(x_20);
lean_dec(x_14);
x_22 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_22, 0, x_20);
lean_ctor_set(x_22, 1, x_21);
return x_22;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__10(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = lean_alloc_closure((void*)(l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__10___rarg___boxed), 12, 0);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_visitForall_visit___at_Lean_Elab_Structural_findRecArg___spec__9___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_array_push(x_1, x_5);
x_14 = l_Lean_Meta_visitForall_visit___at_Lean_Elab_Structural_findRecArg___spec__9(x_2, x_3, x_13, x_4, x_6, x_7, x_8, x_9, x_10, x_11, x_12);
return x_14;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_visitForall_visit___at_Lean_Elab_Structural_findRecArg___spec__9(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11) {
_start:
{
if (lean_obj_tag(x_4) == 7)
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; uint8_t x_15; lean_object* x_16; lean_object* x_17;
x_12 = lean_ctor_get(x_4, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_4, 1);
lean_inc(x_13);
x_14 = lean_ctor_get(x_4, 2);
lean_inc(x_14);
x_15 = lean_ctor_get_uint8(x_4, sizeof(void*)*3 + 8);
lean_dec(x_4);
x_16 = lean_expr_instantiate_rev(x_13, x_3);
lean_dec(x_13);
lean_inc(x_2);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_16);
x_17 = lean_apply_8(x_2, x_16, x_5, x_6, x_7, x_8, x_9, x_10, x_11);
if (lean_obj_tag(x_17) == 0)
{
lean_object* x_18; lean_object* x_19; uint8_t x_20; lean_object* x_21;
x_18 = lean_ctor_get(x_17, 1);
lean_inc(x_18);
lean_dec(x_17);
x_19 = lean_alloc_closure((void*)(l_Lean_Meta_visitForall_visit___at_Lean_Elab_Structural_findRecArg___spec__9___lambda__1), 12, 4);
lean_closure_set(x_19, 0, x_3);
lean_closure_set(x_19, 1, x_1);
lean_closure_set(x_19, 2, x_2);
lean_closure_set(x_19, 3, x_14);
x_20 = 0;
x_21 = l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__10___rarg(x_12, x_15, x_16, x_19, x_20, x_5, x_6, x_7, x_8, x_9, x_10, x_18);
return x_21;
}
else
{
uint8_t x_22;
lean_dec(x_16);
lean_dec(x_14);
lean_dec(x_12);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_22 = !lean_is_exclusive(x_17);
if (x_22 == 0)
{
return x_17;
}
else
{
lean_object* x_23; lean_object* x_24; lean_object* x_25;
x_23 = lean_ctor_get(x_17, 0);
x_24 = lean_ctor_get(x_17, 1);
lean_inc(x_24);
lean_inc(x_23);
lean_dec(x_17);
x_25 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_25, 0, x_23);
lean_ctor_set(x_25, 1, x_24);
return x_25;
}
}
}
else
{
lean_object* x_26; lean_object* x_27;
lean_dec(x_1);
x_26 = lean_expr_instantiate_rev(x_4, x_3);
lean_dec(x_3);
lean_dec(x_4);
x_27 = lean_apply_8(x_2, x_26, x_5, x_6, x_7, x_8, x_9, x_10, x_11);
return x_27;
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_visitForall___at_Lean_Elab_Structural_findRecArg___spec__8(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
lean_object* x_11; lean_object* x_12;
x_11 = l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13___closed__1;
x_12 = l_Lean_Meta_visitForall_visit___at_Lean_Elab_Structural_findRecArg___spec__9(x_1, x_2, x_11, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_withLetDecl___at_Lean_Elab_Structural_findRecArg___spec__13___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, uint8_t x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_alloc_closure((void*)(l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7___rarg___lambda__1), 9, 3);
lean_closure_set(x_13, 0, x_4);
lean_closure_set(x_13, 1, x_6);
lean_closure_set(x_13, 2, x_7);
x_14 = l___private_Lean_Meta_Basic_0__Lean_Meta_withLetDeclImp___rarg(x_1, x_2, x_3, x_13, x_5, x_8, x_9, x_10, x_11, x_12);
if (lean_obj_tag(x_14) == 0)
{
uint8_t x_15;
x_15 = !lean_is_exclusive(x_14);
if (x_15 == 0)
{
return x_14;
}
else
{
lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_16 = lean_ctor_get(x_14, 0);
x_17 = lean_ctor_get(x_14, 1);
lean_inc(x_17);
lean_inc(x_16);
lean_dec(x_14);
x_18 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_18, 0, x_16);
lean_ctor_set(x_18, 1, x_17);
return x_18;
}
}
else
{
uint8_t x_19;
x_19 = !lean_is_exclusive(x_14);
if (x_19 == 0)
{
return x_14;
}
else
{
lean_object* x_20; lean_object* x_21; lean_object* x_22;
x_20 = lean_ctor_get(x_14, 0);
x_21 = lean_ctor_get(x_14, 1);
lean_inc(x_21);
lean_inc(x_20);
lean_dec(x_14);
x_22 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_22, 0, x_20);
lean_ctor_set(x_22, 1, x_21);
return x_22;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_withLetDecl___at_Lean_Elab_Structural_findRecArg___spec__13(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = lean_alloc_closure((void*)(l_Lean_Meta_withLetDecl___at_Lean_Elab_Structural_findRecArg___spec__13___rarg___boxed), 12, 0);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_visitLet_visit___at_Lean_Elab_Structural_findRecArg___spec__12___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
lean_object* x_13; lean_object* x_14;
x_13 = lean_array_push(x_1, x_5);
x_14 = l_Lean_Meta_visitLet_visit___at_Lean_Elab_Structural_findRecArg___spec__12(x_2, x_3, x_13, x_4, x_6, x_7, x_8, x_9, x_10, x_11, x_12);
return x_14;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_visitLet_visit___at_Lean_Elab_Structural_findRecArg___spec__12(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11) {
_start:
{
if (lean_obj_tag(x_4) == 8)
{
lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18;
x_12 = lean_ctor_get(x_4, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_4, 1);
lean_inc(x_13);
x_14 = lean_ctor_get(x_4, 2);
lean_inc(x_14);
x_15 = lean_ctor_get(x_4, 3);
lean_inc(x_15);
lean_dec(x_4);
x_16 = lean_expr_instantiate_rev(x_13, x_3);
lean_dec(x_13);
x_17 = lean_expr_instantiate_rev(x_14, x_3);
lean_dec(x_14);
lean_inc(x_2);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_16);
x_18 = lean_apply_8(x_2, x_16, x_5, x_6, x_7, x_8, x_9, x_10, x_11);
if (lean_obj_tag(x_18) == 0)
{
lean_object* x_19; lean_object* x_20;
x_19 = lean_ctor_get(x_18, 1);
lean_inc(x_19);
lean_dec(x_18);
lean_inc(x_2);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_17);
x_20 = lean_apply_8(x_2, x_17, x_5, x_6, x_7, x_8, x_9, x_10, x_19);
if (lean_obj_tag(x_20) == 0)
{
lean_object* x_21; lean_object* x_22; uint8_t x_23; lean_object* x_24;
x_21 = lean_ctor_get(x_20, 1);
lean_inc(x_21);
lean_dec(x_20);
x_22 = lean_alloc_closure((void*)(l_Lean_Meta_visitLet_visit___at_Lean_Elab_Structural_findRecArg___spec__12___lambda__1), 12, 4);
lean_closure_set(x_22, 0, x_3);
lean_closure_set(x_22, 1, x_1);
lean_closure_set(x_22, 2, x_2);
lean_closure_set(x_22, 3, x_15);
x_23 = 0;
x_24 = l_Lean_Meta_withLetDecl___at_Lean_Elab_Structural_findRecArg___spec__13___rarg(x_12, x_16, x_17, x_22, x_23, x_5, x_6, x_7, x_8, x_9, x_10, x_21);
return x_24;
}
else
{
uint8_t x_25;
lean_dec(x_17);
lean_dec(x_16);
lean_dec(x_15);
lean_dec(x_12);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_25 = !lean_is_exclusive(x_20);
if (x_25 == 0)
{
return x_20;
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28;
x_26 = lean_ctor_get(x_20, 0);
x_27 = lean_ctor_get(x_20, 1);
lean_inc(x_27);
lean_inc(x_26);
lean_dec(x_20);
x_28 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_28, 0, x_26);
lean_ctor_set(x_28, 1, x_27);
return x_28;
}
}
}
else
{
uint8_t x_29;
lean_dec(x_17);
lean_dec(x_16);
lean_dec(x_15);
lean_dec(x_12);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_29 = !lean_is_exclusive(x_18);
if (x_29 == 0)
{
return x_18;
}
else
{
lean_object* x_30; lean_object* x_31; lean_object* x_32;
x_30 = lean_ctor_get(x_18, 0);
x_31 = lean_ctor_get(x_18, 1);
lean_inc(x_31);
lean_inc(x_30);
lean_dec(x_18);
x_32 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_32, 0, x_30);
lean_ctor_set(x_32, 1, x_31);
return x_32;
}
}
}
else
{
lean_object* x_33; lean_object* x_34;
lean_dec(x_1);
x_33 = lean_expr_instantiate_rev(x_4, x_3);
lean_dec(x_3);
lean_dec(x_4);
x_34 = lean_apply_8(x_2, x_33, x_5, x_6, x_7, x_8, x_9, x_10, x_11);
return x_34;
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_visitLet___at_Lean_Elab_Structural_findRecArg___spec__11(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10) {
_start:
{
lean_object* x_11; lean_object* x_12;
x_11 = l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13___closed__1;
x_12 = l_Lean_Meta_visitLet_visit___at_Lean_Elab_Structural_findRecArg___spec__12(x_1, x_2, x_11, x_3, x_4, x_5, x_6, x_7, x_8, x_9, x_10);
return x_12;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3) {
_start:
{
lean_object* x_4; lean_object* x_5; lean_object* x_6;
x_4 = l_Lean_HashMap_insert___at_Lean_Meta_forEachExpr_x27_visit___spec__12(x_3, x_1, x_2);
x_5 = lean_box(0);
x_6 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_6, 0, x_5);
lean_ctor_set(x_6, 1, x_4);
return x_6;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11) {
_start:
{
lean_object* x_12; lean_object* x_13;
lean_inc(x_5);
x_12 = lean_alloc_closure((void*)(l_ST_Prim_Ref_get___boxed), 4, 3);
lean_closure_set(x_12, 0, lean_box(0));
lean_closure_set(x_12, 1, lean_box(0));
lean_closure_set(x_12, 2, x_5);
lean_inc(x_3);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
x_13 = lean_apply_8(x_3, lean_box(0), x_12, x_6, x_7, x_8, x_9, x_10, x_11);
if (lean_obj_tag(x_13) == 0)
{
uint8_t x_14;
x_14 = !lean_is_exclusive(x_13);
if (x_14 == 0)
{
lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_15 = lean_ctor_get(x_13, 0);
x_16 = lean_ctor_get(x_13, 1);
lean_inc(x_4);
x_17 = l_Lean_HashMapImp_find_x3f___at_Lean_Meta_forEachExpr_x27_visit___spec__1(x_15, x_4);
if (lean_obj_tag(x_17) == 0)
{
lean_object* x_18; lean_object* x_19; lean_object* x_32;
lean_free_object(x_13);
lean_inc(x_1);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_4);
x_32 = lean_apply_7(x_1, x_4, x_6, x_7, x_8, x_9, x_10, x_16);
if (lean_obj_tag(x_32) == 0)
{
lean_object* x_33; uint8_t x_34;
x_33 = lean_ctor_get(x_32, 0);
lean_inc(x_33);
x_34 = lean_unbox(x_33);
lean_dec(x_33);
if (x_34 == 0)
{
lean_object* x_35; lean_object* x_36;
lean_dec(x_2);
lean_dec(x_1);
x_35 = lean_ctor_get(x_32, 1);
lean_inc(x_35);
lean_dec(x_32);
x_36 = lean_box(0);
x_18 = x_36;
x_19 = x_35;
goto block_31;
}
else
{
switch (lean_obj_tag(x_4)) {
case 5:
{
lean_object* x_37; lean_object* x_38; lean_object* x_39; lean_object* x_40;
x_37 = lean_ctor_get(x_32, 1);
lean_inc(x_37);
lean_dec(x_32);
x_38 = lean_ctor_get(x_4, 0);
lean_inc(x_38);
x_39 = lean_ctor_get(x_4, 1);
lean_inc(x_39);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_3);
lean_inc(x_2);
lean_inc(x_1);
x_40 = l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4(x_1, x_2, x_3, x_38, x_5, x_6, x_7, x_8, x_9, x_10, x_37);
if (lean_obj_tag(x_40) == 0)
{
lean_object* x_41; lean_object* x_42;
x_41 = lean_ctor_get(x_40, 1);
lean_inc(x_41);
lean_dec(x_40);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_3);
x_42 = l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4(x_1, x_2, x_3, x_39, x_5, x_6, x_7, x_8, x_9, x_10, x_41);
if (lean_obj_tag(x_42) == 0)
{
lean_object* x_43; lean_object* x_44;
x_43 = lean_ctor_get(x_42, 0);
lean_inc(x_43);
x_44 = lean_ctor_get(x_42, 1);
lean_inc(x_44);
lean_dec(x_42);
x_18 = x_43;
x_19 = x_44;
goto block_31;
}
else
{
uint8_t x_45;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_45 = !lean_is_exclusive(x_42);
if (x_45 == 0)
{
return x_42;
}
else
{
lean_object* x_46; lean_object* x_47; lean_object* x_48;
x_46 = lean_ctor_get(x_42, 0);
x_47 = lean_ctor_get(x_42, 1);
lean_inc(x_47);
lean_inc(x_46);
lean_dec(x_42);
x_48 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_48, 0, x_46);
lean_ctor_set(x_48, 1, x_47);
return x_48;
}
}
}
else
{
uint8_t x_49;
lean_dec(x_39);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_49 = !lean_is_exclusive(x_40);
if (x_49 == 0)
{
return x_40;
}
else
{
lean_object* x_50; lean_object* x_51; lean_object* x_52;
x_50 = lean_ctor_get(x_40, 0);
x_51 = lean_ctor_get(x_40, 1);
lean_inc(x_51);
lean_inc(x_50);
lean_dec(x_40);
x_52 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_52, 0, x_50);
lean_ctor_set(x_52, 1, x_51);
return x_52;
}
}
}
case 6:
{
lean_object* x_53; lean_object* x_54; lean_object* x_55;
x_53 = lean_ctor_get(x_32, 1);
lean_inc(x_53);
lean_dec(x_32);
lean_inc(x_3);
lean_inc(x_2);
x_54 = lean_alloc_closure((void*)(l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4), 11, 3);
lean_closure_set(x_54, 0, x_1);
lean_closure_set(x_54, 1, x_2);
lean_closure_set(x_54, 2, x_3);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
x_55 = l_Lean_Meta_visitLambda___at_Lean_Elab_Structural_findRecArg___spec__5(x_2, x_54, x_4, x_5, x_6, x_7, x_8, x_9, x_10, x_53);
if (lean_obj_tag(x_55) == 0)
{
lean_object* x_56; lean_object* x_57;
x_56 = lean_ctor_get(x_55, 0);
lean_inc(x_56);
x_57 = lean_ctor_get(x_55, 1);
lean_inc(x_57);
lean_dec(x_55);
x_18 = x_56;
x_19 = x_57;
goto block_31;
}
else
{
uint8_t x_58;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_58 = !lean_is_exclusive(x_55);
if (x_58 == 0)
{
return x_55;
}
else
{
lean_object* x_59; lean_object* x_60; lean_object* x_61;
x_59 = lean_ctor_get(x_55, 0);
x_60 = lean_ctor_get(x_55, 1);
lean_inc(x_60);
lean_inc(x_59);
lean_dec(x_55);
x_61 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_61, 0, x_59);
lean_ctor_set(x_61, 1, x_60);
return x_61;
}
}
}
case 7:
{
lean_object* x_62; lean_object* x_63; lean_object* x_64;
x_62 = lean_ctor_get(x_32, 1);
lean_inc(x_62);
lean_dec(x_32);
lean_inc(x_3);
lean_inc(x_2);
x_63 = lean_alloc_closure((void*)(l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4), 11, 3);
lean_closure_set(x_63, 0, x_1);
lean_closure_set(x_63, 1, x_2);
lean_closure_set(x_63, 2, x_3);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
x_64 = l_Lean_Meta_visitForall___at_Lean_Elab_Structural_findRecArg___spec__8(x_2, x_63, x_4, x_5, x_6, x_7, x_8, x_9, x_10, x_62);
if (lean_obj_tag(x_64) == 0)
{
lean_object* x_65; lean_object* x_66;
x_65 = lean_ctor_get(x_64, 0);
lean_inc(x_65);
x_66 = lean_ctor_get(x_64, 1);
lean_inc(x_66);
lean_dec(x_64);
x_18 = x_65;
x_19 = x_66;
goto block_31;
}
else
{
uint8_t x_67;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_67 = !lean_is_exclusive(x_64);
if (x_67 == 0)
{
return x_64;
}
else
{
lean_object* x_68; lean_object* x_69; lean_object* x_70;
x_68 = lean_ctor_get(x_64, 0);
x_69 = lean_ctor_get(x_64, 1);
lean_inc(x_69);
lean_inc(x_68);
lean_dec(x_64);
x_70 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_70, 0, x_68);
lean_ctor_set(x_70, 1, x_69);
return x_70;
}
}
}
case 8:
{
lean_object* x_71; lean_object* x_72; lean_object* x_73;
x_71 = lean_ctor_get(x_32, 1);
lean_inc(x_71);
lean_dec(x_32);
lean_inc(x_3);
lean_inc(x_2);
x_72 = lean_alloc_closure((void*)(l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4), 11, 3);
lean_closure_set(x_72, 0, x_1);
lean_closure_set(x_72, 1, x_2);
lean_closure_set(x_72, 2, x_3);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
x_73 = l_Lean_Meta_visitLet___at_Lean_Elab_Structural_findRecArg___spec__11(x_2, x_72, x_4, x_5, x_6, x_7, x_8, x_9, x_10, x_71);
if (lean_obj_tag(x_73) == 0)
{
lean_object* x_74; lean_object* x_75;
x_74 = lean_ctor_get(x_73, 0);
lean_inc(x_74);
x_75 = lean_ctor_get(x_73, 1);
lean_inc(x_75);
lean_dec(x_73);
x_18 = x_74;
x_19 = x_75;
goto block_31;
}
else
{
uint8_t x_76;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_76 = !lean_is_exclusive(x_73);
if (x_76 == 0)
{
return x_73;
}
else
{
lean_object* x_77; lean_object* x_78; lean_object* x_79;
x_77 = lean_ctor_get(x_73, 0);
x_78 = lean_ctor_get(x_73, 1);
lean_inc(x_78);
lean_inc(x_77);
lean_dec(x_73);
x_79 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_79, 0, x_77);
lean_ctor_set(x_79, 1, x_78);
return x_79;
}
}
}
case 10:
{
lean_object* x_80; lean_object* x_81; lean_object* x_82;
x_80 = lean_ctor_get(x_32, 1);
lean_inc(x_80);
lean_dec(x_32);
x_81 = lean_ctor_get(x_4, 1);
lean_inc(x_81);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_3);
x_82 = l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4(x_1, x_2, x_3, x_81, x_5, x_6, x_7, x_8, x_9, x_10, x_80);
if (lean_obj_tag(x_82) == 0)
{
lean_object* x_83; lean_object* x_84;
x_83 = lean_ctor_get(x_82, 0);
lean_inc(x_83);
x_84 = lean_ctor_get(x_82, 1);
lean_inc(x_84);
lean_dec(x_82);
x_18 = x_83;
x_19 = x_84;
goto block_31;
}
else
{
uint8_t x_85;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_85 = !lean_is_exclusive(x_82);
if (x_85 == 0)
{
return x_82;
}
else
{
lean_object* x_86; lean_object* x_87; lean_object* x_88;
x_86 = lean_ctor_get(x_82, 0);
x_87 = lean_ctor_get(x_82, 1);
lean_inc(x_87);
lean_inc(x_86);
lean_dec(x_82);
x_88 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_88, 0, x_86);
lean_ctor_set(x_88, 1, x_87);
return x_88;
}
}
}
case 11:
{
lean_object* x_89; lean_object* x_90; lean_object* x_91;
x_89 = lean_ctor_get(x_32, 1);
lean_inc(x_89);
lean_dec(x_32);
x_90 = lean_ctor_get(x_4, 2);
lean_inc(x_90);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_3);
x_91 = l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4(x_1, x_2, x_3, x_90, x_5, x_6, x_7, x_8, x_9, x_10, x_89);
if (lean_obj_tag(x_91) == 0)
{
lean_object* x_92; lean_object* x_93;
x_92 = lean_ctor_get(x_91, 0);
lean_inc(x_92);
x_93 = lean_ctor_get(x_91, 1);
lean_inc(x_93);
lean_dec(x_91);
x_18 = x_92;
x_19 = x_93;
goto block_31;
}
else
{
uint8_t x_94;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_94 = !lean_is_exclusive(x_91);
if (x_94 == 0)
{
return x_91;
}
else
{
lean_object* x_95; lean_object* x_96; lean_object* x_97;
x_95 = lean_ctor_get(x_91, 0);
x_96 = lean_ctor_get(x_91, 1);
lean_inc(x_96);
lean_inc(x_95);
lean_dec(x_91);
x_97 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_97, 0, x_95);
lean_ctor_set(x_97, 1, x_96);
return x_97;
}
}
}
default:
{
lean_object* x_98; lean_object* x_99;
lean_dec(x_2);
lean_dec(x_1);
x_98 = lean_ctor_get(x_32, 1);
lean_inc(x_98);
lean_dec(x_32);
x_99 = lean_box(0);
x_18 = x_99;
x_19 = x_98;
goto block_31;
}
}
}
}
else
{
uint8_t x_100;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_100 = !lean_is_exclusive(x_32);
if (x_100 == 0)
{
return x_32;
}
else
{
lean_object* x_101; lean_object* x_102; lean_object* x_103;
x_101 = lean_ctor_get(x_32, 0);
x_102 = lean_ctor_get(x_32, 1);
lean_inc(x_102);
lean_inc(x_101);
lean_dec(x_32);
x_103 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_103, 0, x_101);
lean_ctor_set(x_103, 1, x_102);
return x_103;
}
}
block_31:
{
lean_object* x_20; lean_object* x_21; lean_object* x_22;
lean_inc(x_18);
x_20 = lean_alloc_closure((void*)(l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4___lambda__1), 3, 2);
lean_closure_set(x_20, 0, x_4);
lean_closure_set(x_20, 1, x_18);
x_21 = lean_alloc_closure((void*)(l_ST_Prim_Ref_modifyGetUnsafe___rarg___boxed), 3, 2);
lean_closure_set(x_21, 0, x_5);
lean_closure_set(x_21, 1, x_20);
x_22 = lean_apply_8(x_3, lean_box(0), x_21, x_6, x_7, x_8, x_9, x_10, x_19);
if (lean_obj_tag(x_22) == 0)
{
uint8_t x_23;
x_23 = !lean_is_exclusive(x_22);
if (x_23 == 0)
{
lean_object* x_24;
x_24 = lean_ctor_get(x_22, 0);
lean_dec(x_24);
lean_ctor_set(x_22, 0, x_18);
return x_22;
}
else
{
lean_object* x_25; lean_object* x_26;
x_25 = lean_ctor_get(x_22, 1);
lean_inc(x_25);
lean_dec(x_22);
x_26 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_26, 0, x_18);
lean_ctor_set(x_26, 1, x_25);
return x_26;
}
}
else
{
uint8_t x_27;
lean_dec(x_18);
x_27 = !lean_is_exclusive(x_22);
if (x_27 == 0)
{
return x_22;
}
else
{
lean_object* x_28; lean_object* x_29; lean_object* x_30;
x_28 = lean_ctor_get(x_22, 0);
x_29 = lean_ctor_get(x_22, 1);
lean_inc(x_29);
lean_inc(x_28);
lean_dec(x_22);
x_30 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_30, 0, x_28);
lean_ctor_set(x_30, 1, x_29);
return x_30;
}
}
}
}
else
{
lean_object* x_104;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_104 = lean_ctor_get(x_17, 0);
lean_inc(x_104);
lean_dec(x_17);
lean_ctor_set(x_13, 0, x_104);
return x_13;
}
}
else
{
lean_object* x_105; lean_object* x_106; lean_object* x_107;
x_105 = lean_ctor_get(x_13, 0);
x_106 = lean_ctor_get(x_13, 1);
lean_inc(x_106);
lean_inc(x_105);
lean_dec(x_13);
lean_inc(x_4);
x_107 = l_Lean_HashMapImp_find_x3f___at_Lean_Meta_forEachExpr_x27_visit___spec__1(x_105, x_4);
if (lean_obj_tag(x_107) == 0)
{
lean_object* x_108; lean_object* x_109; lean_object* x_121;
lean_inc(x_1);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_4);
x_121 = lean_apply_7(x_1, x_4, x_6, x_7, x_8, x_9, x_10, x_106);
if (lean_obj_tag(x_121) == 0)
{
lean_object* x_122; uint8_t x_123;
x_122 = lean_ctor_get(x_121, 0);
lean_inc(x_122);
x_123 = lean_unbox(x_122);
lean_dec(x_122);
if (x_123 == 0)
{
lean_object* x_124; lean_object* x_125;
lean_dec(x_2);
lean_dec(x_1);
x_124 = lean_ctor_get(x_121, 1);
lean_inc(x_124);
lean_dec(x_121);
x_125 = lean_box(0);
x_108 = x_125;
x_109 = x_124;
goto block_120;
}
else
{
switch (lean_obj_tag(x_4)) {
case 5:
{
lean_object* x_126; lean_object* x_127; lean_object* x_128; lean_object* x_129;
x_126 = lean_ctor_get(x_121, 1);
lean_inc(x_126);
lean_dec(x_121);
x_127 = lean_ctor_get(x_4, 0);
lean_inc(x_127);
x_128 = lean_ctor_get(x_4, 1);
lean_inc(x_128);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_3);
lean_inc(x_2);
lean_inc(x_1);
x_129 = l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4(x_1, x_2, x_3, x_127, x_5, x_6, x_7, x_8, x_9, x_10, x_126);
if (lean_obj_tag(x_129) == 0)
{
lean_object* x_130; lean_object* x_131;
x_130 = lean_ctor_get(x_129, 1);
lean_inc(x_130);
lean_dec(x_129);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_3);
x_131 = l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4(x_1, x_2, x_3, x_128, x_5, x_6, x_7, x_8, x_9, x_10, x_130);
if (lean_obj_tag(x_131) == 0)
{
lean_object* x_132; lean_object* x_133;
x_132 = lean_ctor_get(x_131, 0);
lean_inc(x_132);
x_133 = lean_ctor_get(x_131, 1);
lean_inc(x_133);
lean_dec(x_131);
x_108 = x_132;
x_109 = x_133;
goto block_120;
}
else
{
lean_object* x_134; lean_object* x_135; lean_object* x_136; lean_object* x_137;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_134 = lean_ctor_get(x_131, 0);
lean_inc(x_134);
x_135 = lean_ctor_get(x_131, 1);
lean_inc(x_135);
if (lean_is_exclusive(x_131)) {
lean_ctor_release(x_131, 0);
lean_ctor_release(x_131, 1);
x_136 = x_131;
} else {
lean_dec_ref(x_131);
x_136 = lean_box(0);
}
if (lean_is_scalar(x_136)) {
x_137 = lean_alloc_ctor(1, 2, 0);
} else {
x_137 = x_136;
}
lean_ctor_set(x_137, 0, x_134);
lean_ctor_set(x_137, 1, x_135);
return x_137;
}
}
else
{
lean_object* x_138; lean_object* x_139; lean_object* x_140; lean_object* x_141;
lean_dec(x_128);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_138 = lean_ctor_get(x_129, 0);
lean_inc(x_138);
x_139 = lean_ctor_get(x_129, 1);
lean_inc(x_139);
if (lean_is_exclusive(x_129)) {
lean_ctor_release(x_129, 0);
lean_ctor_release(x_129, 1);
x_140 = x_129;
} else {
lean_dec_ref(x_129);
x_140 = lean_box(0);
}
if (lean_is_scalar(x_140)) {
x_141 = lean_alloc_ctor(1, 2, 0);
} else {
x_141 = x_140;
}
lean_ctor_set(x_141, 0, x_138);
lean_ctor_set(x_141, 1, x_139);
return x_141;
}
}
case 6:
{
lean_object* x_142; lean_object* x_143; lean_object* x_144;
x_142 = lean_ctor_get(x_121, 1);
lean_inc(x_142);
lean_dec(x_121);
lean_inc(x_3);
lean_inc(x_2);
x_143 = lean_alloc_closure((void*)(l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4), 11, 3);
lean_closure_set(x_143, 0, x_1);
lean_closure_set(x_143, 1, x_2);
lean_closure_set(x_143, 2, x_3);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
x_144 = l_Lean_Meta_visitLambda___at_Lean_Elab_Structural_findRecArg___spec__5(x_2, x_143, x_4, x_5, x_6, x_7, x_8, x_9, x_10, x_142);
if (lean_obj_tag(x_144) == 0)
{
lean_object* x_145; lean_object* x_146;
x_145 = lean_ctor_get(x_144, 0);
lean_inc(x_145);
x_146 = lean_ctor_get(x_144, 1);
lean_inc(x_146);
lean_dec(x_144);
x_108 = x_145;
x_109 = x_146;
goto block_120;
}
else
{
lean_object* x_147; lean_object* x_148; lean_object* x_149; lean_object* x_150;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_147 = lean_ctor_get(x_144, 0);
lean_inc(x_147);
x_148 = lean_ctor_get(x_144, 1);
lean_inc(x_148);
if (lean_is_exclusive(x_144)) {
lean_ctor_release(x_144, 0);
lean_ctor_release(x_144, 1);
x_149 = x_144;
} else {
lean_dec_ref(x_144);
x_149 = lean_box(0);
}
if (lean_is_scalar(x_149)) {
x_150 = lean_alloc_ctor(1, 2, 0);
} else {
x_150 = x_149;
}
lean_ctor_set(x_150, 0, x_147);
lean_ctor_set(x_150, 1, x_148);
return x_150;
}
}
case 7:
{
lean_object* x_151; lean_object* x_152; lean_object* x_153;
x_151 = lean_ctor_get(x_121, 1);
lean_inc(x_151);
lean_dec(x_121);
lean_inc(x_3);
lean_inc(x_2);
x_152 = lean_alloc_closure((void*)(l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4), 11, 3);
lean_closure_set(x_152, 0, x_1);
lean_closure_set(x_152, 1, x_2);
lean_closure_set(x_152, 2, x_3);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
x_153 = l_Lean_Meta_visitForall___at_Lean_Elab_Structural_findRecArg___spec__8(x_2, x_152, x_4, x_5, x_6, x_7, x_8, x_9, x_10, x_151);
if (lean_obj_tag(x_153) == 0)
{
lean_object* x_154; lean_object* x_155;
x_154 = lean_ctor_get(x_153, 0);
lean_inc(x_154);
x_155 = lean_ctor_get(x_153, 1);
lean_inc(x_155);
lean_dec(x_153);
x_108 = x_154;
x_109 = x_155;
goto block_120;
}
else
{
lean_object* x_156; lean_object* x_157; lean_object* x_158; lean_object* x_159;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_156 = lean_ctor_get(x_153, 0);
lean_inc(x_156);
x_157 = lean_ctor_get(x_153, 1);
lean_inc(x_157);
if (lean_is_exclusive(x_153)) {
lean_ctor_release(x_153, 0);
lean_ctor_release(x_153, 1);
x_158 = x_153;
} else {
lean_dec_ref(x_153);
x_158 = lean_box(0);
}
if (lean_is_scalar(x_158)) {
x_159 = lean_alloc_ctor(1, 2, 0);
} else {
x_159 = x_158;
}
lean_ctor_set(x_159, 0, x_156);
lean_ctor_set(x_159, 1, x_157);
return x_159;
}
}
case 8:
{
lean_object* x_160; lean_object* x_161; lean_object* x_162;
x_160 = lean_ctor_get(x_121, 1);
lean_inc(x_160);
lean_dec(x_121);
lean_inc(x_3);
lean_inc(x_2);
x_161 = lean_alloc_closure((void*)(l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4), 11, 3);
lean_closure_set(x_161, 0, x_1);
lean_closure_set(x_161, 1, x_2);
lean_closure_set(x_161, 2, x_3);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
x_162 = l_Lean_Meta_visitLet___at_Lean_Elab_Structural_findRecArg___spec__11(x_2, x_161, x_4, x_5, x_6, x_7, x_8, x_9, x_10, x_160);
if (lean_obj_tag(x_162) == 0)
{
lean_object* x_163; lean_object* x_164;
x_163 = lean_ctor_get(x_162, 0);
lean_inc(x_163);
x_164 = lean_ctor_get(x_162, 1);
lean_inc(x_164);
lean_dec(x_162);
x_108 = x_163;
x_109 = x_164;
goto block_120;
}
else
{
lean_object* x_165; lean_object* x_166; lean_object* x_167; lean_object* x_168;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_165 = lean_ctor_get(x_162, 0);
lean_inc(x_165);
x_166 = lean_ctor_get(x_162, 1);
lean_inc(x_166);
if (lean_is_exclusive(x_162)) {
lean_ctor_release(x_162, 0);
lean_ctor_release(x_162, 1);
x_167 = x_162;
} else {
lean_dec_ref(x_162);
x_167 = lean_box(0);
}
if (lean_is_scalar(x_167)) {
x_168 = lean_alloc_ctor(1, 2, 0);
} else {
x_168 = x_167;
}
lean_ctor_set(x_168, 0, x_165);
lean_ctor_set(x_168, 1, x_166);
return x_168;
}
}
case 10:
{
lean_object* x_169; lean_object* x_170; lean_object* x_171;
x_169 = lean_ctor_get(x_121, 1);
lean_inc(x_169);
lean_dec(x_121);
x_170 = lean_ctor_get(x_4, 1);
lean_inc(x_170);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_3);
x_171 = l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4(x_1, x_2, x_3, x_170, x_5, x_6, x_7, x_8, x_9, x_10, x_169);
if (lean_obj_tag(x_171) == 0)
{
lean_object* x_172; lean_object* x_173;
x_172 = lean_ctor_get(x_171, 0);
lean_inc(x_172);
x_173 = lean_ctor_get(x_171, 1);
lean_inc(x_173);
lean_dec(x_171);
x_108 = x_172;
x_109 = x_173;
goto block_120;
}
else
{
lean_object* x_174; lean_object* x_175; lean_object* x_176; lean_object* x_177;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_174 = lean_ctor_get(x_171, 0);
lean_inc(x_174);
x_175 = lean_ctor_get(x_171, 1);
lean_inc(x_175);
if (lean_is_exclusive(x_171)) {
lean_ctor_release(x_171, 0);
lean_ctor_release(x_171, 1);
x_176 = x_171;
} else {
lean_dec_ref(x_171);
x_176 = lean_box(0);
}
if (lean_is_scalar(x_176)) {
x_177 = lean_alloc_ctor(1, 2, 0);
} else {
x_177 = x_176;
}
lean_ctor_set(x_177, 0, x_174);
lean_ctor_set(x_177, 1, x_175);
return x_177;
}
}
case 11:
{
lean_object* x_178; lean_object* x_179; lean_object* x_180;
x_178 = lean_ctor_get(x_121, 1);
lean_inc(x_178);
lean_dec(x_121);
x_179 = lean_ctor_get(x_4, 2);
lean_inc(x_179);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_3);
x_180 = l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4(x_1, x_2, x_3, x_179, x_5, x_6, x_7, x_8, x_9, x_10, x_178);
if (lean_obj_tag(x_180) == 0)
{
lean_object* x_181; lean_object* x_182;
x_181 = lean_ctor_get(x_180, 0);
lean_inc(x_181);
x_182 = lean_ctor_get(x_180, 1);
lean_inc(x_182);
lean_dec(x_180);
x_108 = x_181;
x_109 = x_182;
goto block_120;
}
else
{
lean_object* x_183; lean_object* x_184; lean_object* x_185; lean_object* x_186;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
x_183 = lean_ctor_get(x_180, 0);
lean_inc(x_183);
x_184 = lean_ctor_get(x_180, 1);
lean_inc(x_184);
if (lean_is_exclusive(x_180)) {
lean_ctor_release(x_180, 0);
lean_ctor_release(x_180, 1);
x_185 = x_180;
} else {
lean_dec_ref(x_180);
x_185 = lean_box(0);
}
if (lean_is_scalar(x_185)) {
x_186 = lean_alloc_ctor(1, 2, 0);
} else {
x_186 = x_185;
}
lean_ctor_set(x_186, 0, x_183);
lean_ctor_set(x_186, 1, x_184);
return x_186;
}
}
default:
{
lean_object* x_187; lean_object* x_188;
lean_dec(x_2);
lean_dec(x_1);
x_187 = lean_ctor_get(x_121, 1);
lean_inc(x_187);
lean_dec(x_121);
x_188 = lean_box(0);
x_108 = x_188;
x_109 = x_187;
goto block_120;
}
}
}
}
else
{
lean_object* x_189; lean_object* x_190; lean_object* x_191; lean_object* x_192;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_189 = lean_ctor_get(x_121, 0);
lean_inc(x_189);
x_190 = lean_ctor_get(x_121, 1);
lean_inc(x_190);
if (lean_is_exclusive(x_121)) {
lean_ctor_release(x_121, 0);
lean_ctor_release(x_121, 1);
x_191 = x_121;
} else {
lean_dec_ref(x_121);
x_191 = lean_box(0);
}
if (lean_is_scalar(x_191)) {
x_192 = lean_alloc_ctor(1, 2, 0);
} else {
x_192 = x_191;
}
lean_ctor_set(x_192, 0, x_189);
lean_ctor_set(x_192, 1, x_190);
return x_192;
}
block_120:
{
lean_object* x_110; lean_object* x_111; lean_object* x_112;
lean_inc(x_108);
x_110 = lean_alloc_closure((void*)(l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4___lambda__1), 3, 2);
lean_closure_set(x_110, 0, x_4);
lean_closure_set(x_110, 1, x_108);
x_111 = lean_alloc_closure((void*)(l_ST_Prim_Ref_modifyGetUnsafe___rarg___boxed), 3, 2);
lean_closure_set(x_111, 0, x_5);
lean_closure_set(x_111, 1, x_110);
x_112 = lean_apply_8(x_3, lean_box(0), x_111, x_6, x_7, x_8, x_9, x_10, x_109);
if (lean_obj_tag(x_112) == 0)
{
lean_object* x_113; lean_object* x_114; lean_object* x_115;
x_113 = lean_ctor_get(x_112, 1);
lean_inc(x_113);
if (lean_is_exclusive(x_112)) {
lean_ctor_release(x_112, 0);
lean_ctor_release(x_112, 1);
x_114 = x_112;
} else {
lean_dec_ref(x_112);
x_114 = lean_box(0);
}
if (lean_is_scalar(x_114)) {
x_115 = lean_alloc_ctor(0, 2, 0);
} else {
x_115 = x_114;
}
lean_ctor_set(x_115, 0, x_108);
lean_ctor_set(x_115, 1, x_113);
return x_115;
}
else
{
lean_object* x_116; lean_object* x_117; lean_object* x_118; lean_object* x_119;
lean_dec(x_108);
x_116 = lean_ctor_get(x_112, 0);
lean_inc(x_116);
x_117 = lean_ctor_get(x_112, 1);
lean_inc(x_117);
if (lean_is_exclusive(x_112)) {
lean_ctor_release(x_112, 0);
lean_ctor_release(x_112, 1);
x_118 = x_112;
} else {
lean_dec_ref(x_112);
x_118 = lean_box(0);
}
if (lean_is_scalar(x_118)) {
x_119 = lean_alloc_ctor(1, 2, 0);
} else {
x_119 = x_118;
}
lean_ctor_set(x_119, 0, x_116);
lean_ctor_set(x_119, 1, x_117);
return x_119;
}
}
}
else
{
lean_object* x_193; lean_object* x_194;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_193 = lean_ctor_get(x_107, 0);
lean_inc(x_193);
lean_dec(x_107);
x_194 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_194, 0, x_193);
lean_ctor_set(x_194, 1, x_106);
return x_194;
}
}
}
else
{
uint8_t x_195;
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_195 = !lean_is_exclusive(x_13);
if (x_195 == 0)
{
return x_13;
}
else
{
lean_object* x_196; lean_object* x_197; lean_object* x_198;
x_196 = lean_ctor_get(x_13, 0);
x_197 = lean_ctor_get(x_13, 1);
lean_inc(x_197);
lean_inc(x_196);
lean_dec(x_13);
x_198 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_198, 0, x_196);
lean_ctor_set(x_198, 1, x_197);
return x_198;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9; uint8_t x_10;
x_9 = lean_apply_1(x_2, x_8);
x_10 = !lean_is_exclusive(x_9);
if (x_10 == 0)
{
return x_9;
}
else
{
lean_object* x_11; lean_object* x_12; lean_object* x_13;
x_11 = lean_ctor_get(x_9, 0);
x_12 = lean_ctor_get(x_9, 1);
lean_inc(x_12);
lean_inc(x_11);
lean_dec(x_9);
x_13 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_13, 0, x_11);
lean_ctor_set(x_13, 1, x_12);
return x_13;
}
}
}
static lean_object* _init_l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___closed__1() {
_start:
{
lean_object* x_1;
x_1 = lean_alloc_closure((void*)(l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___lambda__1___boxed), 8, 0);
return x_1;
}
}
static lean_object* _init_l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___closed__2() {
_start:
{
lean_object* x_1; lean_object* x_2;
x_1 = lean_unsigned_to_nat(8u);
x_2 = l_Lean_mkHashMapImp___rarg(x_1);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9; lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; lean_object* x_15;
x_9 = lean_box(0);
x_10 = l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___closed__1;
x_11 = l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___closed__2;
x_12 = lean_st_mk_ref(x_11, x_8);
x_13 = lean_ctor_get(x_12, 0);
lean_inc(x_13);
x_14 = lean_ctor_get(x_12, 1);
lean_inc(x_14);
lean_dec(x_12);
lean_inc(x_13);
x_15 = l_Lean_Meta_forEachExpr_x27_visit___at_Lean_Elab_Structural_findRecArg___spec__4(x_2, x_9, x_10, x_1, x_13, x_3, x_4, x_5, x_6, x_7, x_14);
if (lean_obj_tag(x_15) == 0)
{
lean_object* x_16; lean_object* x_17; lean_object* x_18; uint8_t x_19;
x_16 = lean_ctor_get(x_15, 0);
lean_inc(x_16);
x_17 = lean_ctor_get(x_15, 1);
lean_inc(x_17);
lean_dec(x_15);
x_18 = lean_st_ref_get(x_13, x_17);
lean_dec(x_13);
x_19 = !lean_is_exclusive(x_18);
if (x_19 == 0)
{
lean_object* x_20;
x_20 = lean_ctor_get(x_18, 0);
lean_dec(x_20);
lean_ctor_set(x_18, 0, x_16);
return x_18;
}
else
{
lean_object* x_21; lean_object* x_22;
x_21 = lean_ctor_get(x_18, 1);
lean_inc(x_21);
lean_dec(x_18);
x_22 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_22, 0, x_16);
lean_ctor_set(x_22, 1, x_21);
return x_22;
}
}
else
{
uint8_t x_23;
lean_dec(x_13);
x_23 = !lean_is_exclusive(x_15);
if (x_23 == 0)
{
return x_15;
}
else
{
lean_object* x_24; lean_object* x_25; lean_object* x_26;
x_24 = lean_ctor_get(x_15, 0);
x_25 = lean_ctor_get(x_15, 1);
lean_inc(x_25);
lean_inc(x_24);
lean_dec(x_15);
x_26 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_26, 0, x_24);
lean_ctor_set(x_26, 1, x_25);
return x_26;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_forEachExpr___at_Lean_Elab_Structural_findRecArg___spec__2___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9;
x_9 = lean_apply_7(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8);
if (lean_obj_tag(x_9) == 0)
{
uint8_t x_10;
x_10 = !lean_is_exclusive(x_9);
if (x_10 == 0)
{
lean_object* x_11; uint8_t x_12; lean_object* x_13;
x_11 = lean_ctor_get(x_9, 0);
lean_dec(x_11);
x_12 = 1;
x_13 = lean_box(x_12);
lean_ctor_set(x_9, 0, x_13);
return x_9;
}
else
{
lean_object* x_14; uint8_t x_15; lean_object* x_16; lean_object* x_17;
x_14 = lean_ctor_get(x_9, 1);
lean_inc(x_14);
lean_dec(x_9);
x_15 = 1;
x_16 = lean_box(x_15);
x_17 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_17, 0, x_16);
lean_ctor_set(x_17, 1, x_14);
return x_17;
}
}
else
{
uint8_t x_18;
x_18 = !lean_is_exclusive(x_9);
if (x_18 == 0)
{
return x_9;
}
else
{
lean_object* x_19; lean_object* x_20; lean_object* x_21;
x_19 = lean_ctor_get(x_9, 0);
x_20 = lean_ctor_get(x_9, 1);
lean_inc(x_20);
lean_inc(x_19);
lean_dec(x_9);
x_21 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_21, 0, x_19);
lean_ctor_set(x_21, 1, x_20);
return x_21;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_forEachExpr___at_Lean_Elab_Structural_findRecArg___spec__2(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9; lean_object* x_10;
x_9 = lean_alloc_closure((void*)(l_Lean_Meta_forEachExpr___at_Lean_Elab_Structural_findRecArg___spec__2___lambda__1), 8, 1);
lean_closure_set(x_9, 0, x_2);
x_10 = l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3(x_1, x_9, x_3, x_4, x_5, x_6, x_7, x_8);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Subarray_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__14___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
uint8_t x_10;
x_10 = l_Lean_Expr_isFVar(x_3);
if (x_10 == 0)
{
lean_object* x_11; lean_object* x_12;
lean_dec(x_3);
x_11 = lean_box(0);
x_12 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_12, 0, x_11);
lean_ctor_set(x_12, 1, x_9);
return x_12;
}
else
{
lean_object* x_13; lean_object* x_14; uint8_t x_15;
x_13 = lean_array_get_size(x_1);
x_14 = lean_unsigned_to_nat(0u);
x_15 = lean_nat_dec_lt(x_14, x_13);
if (x_15 == 0)
{
lean_object* x_16; lean_object* x_17;
lean_dec(x_13);
lean_dec(x_3);
x_16 = lean_box(0);
x_17 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_17, 0, x_16);
lean_ctor_set(x_17, 1, x_9);
return x_17;
}
else
{
uint8_t x_18;
x_18 = lean_nat_dec_le(x_13, x_13);
if (x_18 == 0)
{
lean_object* x_19; lean_object* x_20;
lean_dec(x_13);
lean_dec(x_3);
x_19 = lean_box(0);
x_20 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_20, 0, x_19);
lean_ctor_set(x_20, 1, x_9);
return x_20;
}
else
{
size_t x_21; size_t x_22; uint8_t x_23;
x_21 = 0;
x_22 = lean_usize_of_nat(x_13);
lean_dec(x_13);
x_23 = l_Array_anyMUnsafe_any___at_Lean_Elab_Structural_findRecArg___spec__1(x_3, x_1, x_21, x_22);
if (x_23 == 0)
{
lean_object* x_24; lean_object* x_25;
lean_dec(x_3);
x_24 = lean_box(0);
x_25 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_25, 0, x_24);
lean_ctor_set(x_25, 1, x_9);
return x_25;
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28; lean_object* x_29; lean_object* x_30; lean_object* x_31; lean_object* x_32; uint8_t x_33;
x_26 = lean_st_ref_take(x_2, x_9);
x_27 = lean_ctor_get(x_26, 0);
lean_inc(x_27);
x_28 = lean_ctor_get(x_26, 1);
lean_inc(x_28);
lean_dec(x_26);
x_29 = l_Lean_Expr_fvarId_x21(x_3);
x_30 = lean_box(0);
x_31 = l_Lean_RBNode_insert___at_Lean_FVarIdSet_insert___spec__1(x_27, x_29, x_30);
x_32 = lean_st_ref_set(x_2, x_31, x_28);
x_33 = !lean_is_exclusive(x_32);
if (x_33 == 0)
{
return x_32;
}
else
{
lean_object* x_34; lean_object* x_35; lean_object* x_36;
x_34 = lean_ctor_get(x_32, 0);
x_35 = lean_ctor_get(x_32, 1);
lean_inc(x_35);
lean_inc(x_34);
lean_dec(x_32);
x_36 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_36, 0, x_34);
lean_ctor_set(x_36, 1, x_35);
return x_36;
}
}
}
}
}
}
}
LEAN_EXPORT lean_object* l_Subarray_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__14(lean_object* x_1, lean_object* x_2, lean_object* x_3, size_t x_4, size_t x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
uint8_t x_13;
x_13 = lean_usize_dec_lt(x_5, x_4);
if (x_13 == 0)
{
lean_object* x_14;
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_2);
lean_dec(x_1);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_6);
lean_ctor_set(x_14, 1, x_12);
return x_14;
}
else
{
lean_object* x_15; lean_object* x_16; lean_object* x_17; lean_object* x_18;
lean_dec(x_6);
x_15 = lean_ctor_get(x_3, 0);
x_16 = lean_array_uget(x_15, x_5);
lean_inc(x_2);
lean_inc(x_1);
x_17 = lean_alloc_closure((void*)(l_Subarray_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__14___lambda__1___boxed), 9, 2);
lean_closure_set(x_17, 0, x_1);
lean_closure_set(x_17, 1, x_2);
lean_inc(x_11);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
x_18 = l_Lean_Meta_forEachExpr___at_Lean_Elab_Structural_findRecArg___spec__2(x_16, x_17, x_7, x_8, x_9, x_10, x_11, x_12);
if (lean_obj_tag(x_18) == 0)
{
lean_object* x_19; size_t x_20; size_t x_21; lean_object* x_22;
x_19 = lean_ctor_get(x_18, 1);
lean_inc(x_19);
lean_dec(x_18);
x_20 = 1;
x_21 = lean_usize_add(x_5, x_20);
x_22 = lean_box(0);
x_5 = x_21;
x_6 = x_22;
x_12 = x_19;
goto _start;
}
else
{
uint8_t x_24;
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_2);
lean_dec(x_1);
x_24 = !lean_is_exclusive(x_18);
if (x_24 == 0)
{
return x_18;
}
else
{
lean_object* x_25; lean_object* x_26; lean_object* x_27;
x_25 = lean_ctor_get(x_18, 0);
x_26 = lean_ctor_get(x_18, 1);
lean_inc(x_26);
lean_inc(x_25);
lean_dec(x_18);
x_27 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_27, 0, x_25);
lean_ctor_set(x_27, 1, x_26);
return x_27;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__15___lambda__1(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10;
x_10 = l_Lean_Expr_getAppFn(x_3);
if (lean_obj_tag(x_10) == 4)
{
lean_object* x_11; lean_object* x_12; uint8_t x_13;
x_11 = lean_ctor_get(x_10, 0);
lean_inc(x_11);
lean_dec(x_10);
x_12 = lean_st_ref_get(x_8, x_9);
x_13 = !lean_is_exclusive(x_12);
if (x_13 == 0)
{
lean_object* x_14; lean_object* x_15; lean_object* x_16; lean_object* x_17;
x_14 = lean_ctor_get(x_12, 0);
x_15 = lean_ctor_get(x_12, 1);
x_16 = lean_ctor_get(x_14, 0);
lean_inc(x_16);
lean_dec(x_14);
x_17 = lean_environment_find(x_16, x_11);
if (lean_obj_tag(x_17) == 0)
{
lean_object* x_18;
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_18 = lean_box(0);
lean_ctor_set(x_12, 0, x_18);
return x_12;
}
else
{
lean_object* x_19;
x_19 = lean_ctor_get(x_17, 0);
lean_inc(x_19);
lean_dec(x_17);
if (lean_obj_tag(x_19) == 5)
{
lean_object* x_20; lean_object* x_21; lean_object* x_22; uint8_t x_23;
x_20 = lean_ctor_get(x_19, 0);
lean_inc(x_20);
lean_dec(x_19);
x_21 = lean_ctor_get(x_20, 2);
lean_inc(x_21);
x_22 = lean_unsigned_to_nat(0u);
x_23 = lean_nat_dec_lt(x_22, x_21);
if (x_23 == 0)
{
lean_object* x_24;
lean_dec(x_21);
lean_dec(x_20);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_24 = lean_box(0);
lean_ctor_set(x_12, 0, x_24);
return x_12;
}
else
{
lean_object* x_25; lean_object* x_26; lean_object* x_27; uint8_t x_28;
x_25 = lean_ctor_get(x_20, 1);
lean_inc(x_25);
lean_dec(x_20);
x_26 = lean_nat_add(x_25, x_21);
lean_dec(x_21);
x_27 = l___private_Lean_Expr_0__Lean_Expr_getAppNumArgsAux(x_3, x_22);
x_28 = lean_nat_dec_eq(x_26, x_27);
lean_dec(x_26);
if (x_28 == 0)
{
lean_object* x_29;
lean_dec(x_27);
lean_dec(x_25);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_29 = lean_box(0);
lean_ctor_set(x_12, 0, x_29);
return x_12;
}
else
{
lean_object* x_30; lean_object* x_31; lean_object* x_32; lean_object* x_33; lean_object* x_34; lean_object* x_35; lean_object* x_36; lean_object* x_37; size_t x_38; lean_object* x_39; size_t x_40; lean_object* x_41; lean_object* x_42;
lean_free_object(x_12);
x_30 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__1;
lean_inc(x_27);
x_31 = lean_mk_array(x_27, x_30);
x_32 = lean_unsigned_to_nat(1u);
x_33 = lean_nat_sub(x_27, x_32);
lean_dec(x_27);
x_34 = l___private_Lean_Expr_0__Lean_Expr_getAppArgsAux(x_3, x_31, x_33);
x_35 = lean_array_get_size(x_34);
x_36 = l_Array_toSubarray___rarg(x_34, x_25, x_35);
x_37 = lean_ctor_get(x_36, 2);
lean_inc(x_37);
x_38 = lean_usize_of_nat(x_37);
lean_dec(x_37);
x_39 = lean_ctor_get(x_36, 1);
lean_inc(x_39);
x_40 = lean_usize_of_nat(x_39);
lean_dec(x_39);
x_41 = lean_box(0);
x_42 = l_Subarray_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__14(x_1, x_2, x_36, x_38, x_40, x_41, x_4, x_5, x_6, x_7, x_8, x_15);
lean_dec(x_36);
if (lean_obj_tag(x_42) == 0)
{
uint8_t x_43;
x_43 = !lean_is_exclusive(x_42);
if (x_43 == 0)
{
lean_object* x_44;
x_44 = lean_ctor_get(x_42, 0);
lean_dec(x_44);
lean_ctor_set(x_42, 0, x_41);
return x_42;
}
else
{
lean_object* x_45; lean_object* x_46;
x_45 = lean_ctor_get(x_42, 1);
lean_inc(x_45);
lean_dec(x_42);
x_46 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_46, 0, x_41);
lean_ctor_set(x_46, 1, x_45);
return x_46;
}
}
else
{
uint8_t x_47;
x_47 = !lean_is_exclusive(x_42);
if (x_47 == 0)
{
return x_42;
}
else
{
lean_object* x_48; lean_object* x_49; lean_object* x_50;
x_48 = lean_ctor_get(x_42, 0);
x_49 = lean_ctor_get(x_42, 1);
lean_inc(x_49);
lean_inc(x_48);
lean_dec(x_42);
x_50 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_50, 0, x_48);
lean_ctor_set(x_50, 1, x_49);
return x_50;
}
}
}
}
}
else
{
lean_object* x_51;
lean_dec(x_19);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_51 = lean_box(0);
lean_ctor_set(x_12, 0, x_51);
return x_12;
}
}
}
else
{
lean_object* x_52; lean_object* x_53; lean_object* x_54; lean_object* x_55;
x_52 = lean_ctor_get(x_12, 0);
x_53 = lean_ctor_get(x_12, 1);
lean_inc(x_53);
lean_inc(x_52);
lean_dec(x_12);
x_54 = lean_ctor_get(x_52, 0);
lean_inc(x_54);
lean_dec(x_52);
x_55 = lean_environment_find(x_54, x_11);
if (lean_obj_tag(x_55) == 0)
{
lean_object* x_56; lean_object* x_57;
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_56 = lean_box(0);
x_57 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_57, 0, x_56);
lean_ctor_set(x_57, 1, x_53);
return x_57;
}
else
{
lean_object* x_58;
x_58 = lean_ctor_get(x_55, 0);
lean_inc(x_58);
lean_dec(x_55);
if (lean_obj_tag(x_58) == 5)
{
lean_object* x_59; lean_object* x_60; lean_object* x_61; uint8_t x_62;
x_59 = lean_ctor_get(x_58, 0);
lean_inc(x_59);
lean_dec(x_58);
x_60 = lean_ctor_get(x_59, 2);
lean_inc(x_60);
x_61 = lean_unsigned_to_nat(0u);
x_62 = lean_nat_dec_lt(x_61, x_60);
if (x_62 == 0)
{
lean_object* x_63; lean_object* x_64;
lean_dec(x_60);
lean_dec(x_59);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_63 = lean_box(0);
x_64 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_64, 0, x_63);
lean_ctor_set(x_64, 1, x_53);
return x_64;
}
else
{
lean_object* x_65; lean_object* x_66; lean_object* x_67; uint8_t x_68;
x_65 = lean_ctor_get(x_59, 1);
lean_inc(x_65);
lean_dec(x_59);
x_66 = lean_nat_add(x_65, x_60);
lean_dec(x_60);
x_67 = l___private_Lean_Expr_0__Lean_Expr_getAppNumArgsAux(x_3, x_61);
x_68 = lean_nat_dec_eq(x_66, x_67);
lean_dec(x_66);
if (x_68 == 0)
{
lean_object* x_69; lean_object* x_70;
lean_dec(x_67);
lean_dec(x_65);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_69 = lean_box(0);
x_70 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_70, 0, x_69);
lean_ctor_set(x_70, 1, x_53);
return x_70;
}
else
{
lean_object* x_71; lean_object* x_72; lean_object* x_73; lean_object* x_74; lean_object* x_75; lean_object* x_76; lean_object* x_77; lean_object* x_78; size_t x_79; lean_object* x_80; size_t x_81; lean_object* x_82; lean_object* x_83;
x_71 = l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__1;
lean_inc(x_67);
x_72 = lean_mk_array(x_67, x_71);
x_73 = lean_unsigned_to_nat(1u);
x_74 = lean_nat_sub(x_67, x_73);
lean_dec(x_67);
x_75 = l___private_Lean_Expr_0__Lean_Expr_getAppArgsAux(x_3, x_72, x_74);
x_76 = lean_array_get_size(x_75);
x_77 = l_Array_toSubarray___rarg(x_75, x_65, x_76);
x_78 = lean_ctor_get(x_77, 2);
lean_inc(x_78);
x_79 = lean_usize_of_nat(x_78);
lean_dec(x_78);
x_80 = lean_ctor_get(x_77, 1);
lean_inc(x_80);
x_81 = lean_usize_of_nat(x_80);
lean_dec(x_80);
x_82 = lean_box(0);
x_83 = l_Subarray_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__14(x_1, x_2, x_77, x_79, x_81, x_82, x_4, x_5, x_6, x_7, x_8, x_53);
lean_dec(x_77);
if (lean_obj_tag(x_83) == 0)
{
lean_object* x_84; lean_object* x_85; lean_object* x_86;
x_84 = lean_ctor_get(x_83, 1);
lean_inc(x_84);
if (lean_is_exclusive(x_83)) {
lean_ctor_release(x_83, 0);
lean_ctor_release(x_83, 1);
x_85 = x_83;
} else {
lean_dec_ref(x_83);
x_85 = lean_box(0);
}
if (lean_is_scalar(x_85)) {
x_86 = lean_alloc_ctor(0, 2, 0);
} else {
x_86 = x_85;
}
lean_ctor_set(x_86, 0, x_82);
lean_ctor_set(x_86, 1, x_84);
return x_86;
}
else
{
lean_object* x_87; lean_object* x_88; lean_object* x_89; lean_object* x_90;
x_87 = lean_ctor_get(x_83, 0);
lean_inc(x_87);
x_88 = lean_ctor_get(x_83, 1);
lean_inc(x_88);
if (lean_is_exclusive(x_83)) {
lean_ctor_release(x_83, 0);
lean_ctor_release(x_83, 1);
x_89 = x_83;
} else {
lean_dec_ref(x_83);
x_89 = lean_box(0);
}
if (lean_is_scalar(x_89)) {
x_90 = lean_alloc_ctor(1, 2, 0);
} else {
x_90 = x_89;
}
lean_ctor_set(x_90, 0, x_87);
lean_ctor_set(x_90, 1, x_88);
return x_90;
}
}
}
}
else
{
lean_object* x_91; lean_object* x_92;
lean_dec(x_58);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_91 = lean_box(0);
x_92 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_92, 0, x_91);
lean_ctor_set(x_92, 1, x_53);
return x_92;
}
}
}
}
else
{
lean_object* x_93; lean_object* x_94;
lean_dec(x_10);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_93 = lean_box(0);
x_94 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_94, 0, x_93);
lean_ctor_set(x_94, 1, x_9);
return x_94;
}
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__15(lean_object* x_1, lean_object* x_2, lean_object* x_3, size_t x_4, size_t x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
uint8_t x_13;
x_13 = lean_usize_dec_lt(x_5, x_4);
if (x_13 == 0)
{
lean_object* x_14;
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_2);
lean_dec(x_1);
x_14 = lean_alloc_ctor(0, 2, 0);
lean_ctor_set(x_14, 0, x_6);
lean_ctor_set(x_14, 1, x_12);
return x_14;
}
else
{
lean_object* x_15; lean_object* x_16;
lean_dec(x_6);
x_15 = lean_array_uget(x_3, x_5);
lean_inc(x_11);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
x_16 = lean_infer_type(x_15, x_8, x_9, x_10, x_11, x_12);
if (lean_obj_tag(x_16) == 0)
{
lean_object* x_17; lean_object* x_18; lean_object* x_19; lean_object* x_20;
x_17 = lean_ctor_get(x_16, 0);
lean_inc(x_17);
x_18 = lean_ctor_get(x_16, 1);
lean_inc(x_18);
lean_dec(x_16);
lean_inc(x_2);
lean_inc(x_1);
x_19 = lean_alloc_closure((void*)(l_Array_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__15___lambda__1), 9, 2);
lean_closure_set(x_19, 0, x_1);
lean_closure_set(x_19, 1, x_2);
lean_inc(x_11);
lean_inc(x_10);
lean_inc(x_9);
lean_inc(x_8);
lean_inc(x_7);
x_20 = l_Lean_Meta_forEachExpr___at_Lean_Elab_Structural_findRecArg___spec__2(x_17, x_19, x_7, x_8, x_9, x_10, x_11, x_18);
if (lean_obj_tag(x_20) == 0)
{
lean_object* x_21; size_t x_22; size_t x_23; lean_object* x_24;
x_21 = lean_ctor_get(x_20, 1);
lean_inc(x_21);
lean_dec(x_20);
x_22 = 1;
x_23 = lean_usize_add(x_5, x_22);
x_24 = lean_box(0);
x_5 = x_23;
x_6 = x_24;
x_12 = x_21;
goto _start;
}
else
{
uint8_t x_26;
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_2);
lean_dec(x_1);
x_26 = !lean_is_exclusive(x_20);
if (x_26 == 0)
{
return x_20;
}
else
{
lean_object* x_27; lean_object* x_28; lean_object* x_29;
x_27 = lean_ctor_get(x_20, 0);
x_28 = lean_ctor_get(x_20, 1);
lean_inc(x_28);
lean_inc(x_27);
lean_dec(x_20);
x_29 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_29, 0, x_27);
lean_ctor_set(x_29, 1, x_28);
return x_29;
}
}
}
else
{
uint8_t x_30;
lean_dec(x_11);
lean_dec(x_10);
lean_dec(x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_2);
lean_dec(x_1);
x_30 = !lean_is_exclusive(x_16);
if (x_30 == 0)
{
return x_16;
}
else
{
lean_object* x_31; lean_object* x_32; lean_object* x_33;
x_31 = lean_ctor_get(x_16, 0);
x_32 = lean_ctor_get(x_16, 1);
lean_inc(x_32);
lean_inc(x_31);
lean_dec(x_16);
x_33 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_33, 0, x_31);
lean_ctor_set(x_33, 1, x_32);
return x_33;
}
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg___rarg(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10; lean_object* x_11; lean_object* x_12; lean_object* x_13; lean_object* x_14; size_t x_15; size_t x_16; lean_object* x_17; lean_object* x_18;
x_10 = lean_box(0);
x_11 = lean_st_mk_ref(x_10, x_9);
x_12 = lean_ctor_get(x_11, 0);
lean_inc(x_12);
x_13 = lean_ctor_get(x_11, 1);
lean_inc(x_13);
lean_dec(x_11);
x_14 = lean_array_get_size(x_2);
x_15 = lean_usize_of_nat(x_14);
lean_dec(x_14);
x_16 = 0;
x_17 = lean_box(0);
lean_inc(x_8);
lean_inc(x_7);
lean_inc(x_6);
lean_inc(x_5);
lean_inc(x_4);
lean_inc(x_12);
lean_inc(x_2);
x_18 = l_Array_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__15(x_2, x_12, x_2, x_15, x_16, x_17, x_4, x_5, x_6, x_7, x_8, x_13);
if (lean_obj_tag(x_18) == 0)
{
lean_object* x_19; lean_object* x_20; lean_object* x_21; lean_object* x_22; uint8_t x_23; lean_object* x_24;
x_19 = lean_ctor_get(x_18, 1);
lean_inc(x_19);
lean_dec(x_18);
x_20 = lean_st_ref_get(x_12, x_19);
lean_dec(x_12);
x_21 = lean_ctor_get(x_20, 0);
lean_inc(x_21);
x_22 = lean_ctor_get(x_20, 1);
lean_inc(x_22);
lean_dec(x_20);
x_23 = 1;
lean_inc(x_1);
x_24 = l_Lean_Elab_Structural_findRecArg_go___rarg(x_1, x_2, x_3, x_21, x_1, x_23, x_4, x_5, x_6, x_7, x_8, x_22);
return x_24;
}
else
{
uint8_t x_25;
lean_dec(x_12);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
lean_dec(x_2);
lean_dec(x_1);
x_25 = !lean_is_exclusive(x_18);
if (x_25 == 0)
{
return x_18;
}
else
{
lean_object* x_26; lean_object* x_27; lean_object* x_28;
x_26 = lean_ctor_get(x_18, 0);
x_27 = lean_ctor_get(x_18, 1);
lean_inc(x_27);
lean_inc(x_26);
lean_dec(x_18);
x_28 = lean_alloc_ctor(1, 2, 0);
lean_ctor_set(x_28, 0, x_26);
lean_ctor_set(x_28, 1, x_27);
return x_28;
}
}
}
}
LEAN_EXPORT lean_object* l_Lean_Elab_Structural_findRecArg(lean_object* x_1) {
_start:
{
lean_object* x_2;
x_2 = lean_alloc_closure((void*)(l_Lean_Elab_Structural_findRecArg___rarg), 9, 0);
return x_2;
}
}
LEAN_EXPORT lean_object* l_Array_anyMUnsafe_any___at_Lean_Elab_Structural_findRecArg___spec__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4) {
_start:
{
size_t x_5; size_t x_6; uint8_t x_7; lean_object* x_8;
x_5 = lean_unbox_usize(x_3);
lean_dec(x_3);
x_6 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_7 = l_Array_anyMUnsafe_any___at_Lean_Elab_Structural_findRecArg___spec__1(x_1, x_2, x_5, x_6);
lean_dec(x_2);
lean_dec(x_1);
x_8 = lean_box(x_7);
return x_8;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
uint8_t x_13; uint8_t x_14; lean_object* x_15;
x_13 = lean_unbox(x_2);
lean_dec(x_2);
x_14 = lean_unbox(x_5);
lean_dec(x_5);
x_15 = l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7___rarg(x_1, x_13, x_3, x_4, x_14, x_6, x_7, x_8, x_9, x_10, x_11, x_12);
return x_15;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__7(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__10___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
uint8_t x_13; uint8_t x_14; lean_object* x_15;
x_13 = lean_unbox(x_2);
lean_dec(x_2);
x_14 = lean_unbox(x_5);
lean_dec(x_5);
x_15 = l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__10___rarg(x_1, x_13, x_3, x_4, x_14, x_6, x_7, x_8, x_9, x_10, x_11, x_12);
return x_15;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__10___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_Meta_withLocalDecl___at_Lean_Elab_Structural_findRecArg___spec__10(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_withLetDecl___at_Lean_Elab_Structural_findRecArg___spec__13___rarg___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
uint8_t x_13; lean_object* x_14;
x_13 = lean_unbox(x_5);
lean_dec(x_5);
x_14 = l_Lean_Meta_withLetDecl___at_Lean_Elab_Structural_findRecArg___spec__13___rarg(x_1, x_2, x_3, x_4, x_13, x_6, x_7, x_8, x_9, x_10, x_11, x_12);
return x_14;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_withLetDecl___at_Lean_Elab_Structural_findRecArg___spec__13___boxed(lean_object* x_1, lean_object* x_2) {
_start:
{
lean_object* x_3;
x_3 = l_Lean_Meta_withLetDecl___at_Lean_Elab_Structural_findRecArg___spec__13(x_1, x_2);
lean_dec(x_1);
return x_3;
}
}
LEAN_EXPORT lean_object* l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8) {
_start:
{
lean_object* x_9;
x_9 = l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___lambda__1(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_3);
return x_9;
}
}
LEAN_EXPORT lean_object* l_Subarray_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__14___lambda__1___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9) {
_start:
{
lean_object* x_10;
x_10 = l_Subarray_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__14___lambda__1(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8, x_9);
lean_dec(x_8);
lean_dec(x_7);
lean_dec(x_6);
lean_dec(x_5);
lean_dec(x_4);
lean_dec(x_2);
lean_dec(x_1);
return x_10;
}
}
LEAN_EXPORT lean_object* l_Subarray_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__14___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
size_t x_13; size_t x_14; lean_object* x_15;
x_13 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_14 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_15 = l_Subarray_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__14(x_1, x_2, x_3, x_13, x_14, x_6, x_7, x_8, x_9, x_10, x_11, x_12);
lean_dec(x_3);
return x_15;
}
}
LEAN_EXPORT lean_object* l_Array_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__15___boxed(lean_object* x_1, lean_object* x_2, lean_object* x_3, lean_object* x_4, lean_object* x_5, lean_object* x_6, lean_object* x_7, lean_object* x_8, lean_object* x_9, lean_object* x_10, lean_object* x_11, lean_object* x_12) {
_start:
{
size_t x_13; size_t x_14; lean_object* x_15;
x_13 = lean_unbox_usize(x_4);
lean_dec(x_4);
x_14 = lean_unbox_usize(x_5);
lean_dec(x_5);
x_15 = l_Array_forInUnsafe_loop___at_Lean_Elab_Structural_findRecArg___spec__15(x_1, x_2, x_3, x_13, x_14, x_6, x_7, x_8, x_9, x_10, x_11, x_12);
lean_dec(x_3);
return x_15;
}
}
lean_object* initialize_Init(uint8_t builtin, lean_object*);
lean_object* initialize_Lean_Elab_PreDefinition_Structural_Basic(uint8_t builtin, lean_object*);
static bool _G_initialized = false;
LEAN_EXPORT lean_object* initialize_Lean_Elab_PreDefinition_Structural_FindRecArg(uint8_t builtin, lean_object* w) {
lean_object * res;
if (_G_initialized) return lean_io_result_mk_ok(lean_box(0));
_G_initialized = true;
res = initialize_Init(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
res = initialize_Lean_Elab_PreDefinition_Structural_Basic(builtin, lean_io_mk_world());
if (lean_io_result_is_error(res)) return res;
lean_dec_ref(res);
l_Lean_exprDependsOn___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__1___closed__1 = _init_l_Lean_exprDependsOn___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__1___closed__1();
lean_mark_persistent(l_Lean_exprDependsOn___at___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___spec__1___closed__1);
l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___closed__1 = _init_l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___closed__1();
lean_mark_persistent(l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_hasBadIndexDep_x3f___closed__1);
l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg___closed__1 = _init_l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg___closed__1();
lean_mark_persistent(l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg___closed__1);
l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg___closed__2 = _init_l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg___closed__2();
lean_mark_persistent(l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_throwStructuralFailed___rarg___closed__2);
l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg___closed__1 = _init_l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg___closed__1();
lean_mark_persistent(l___private_Lean_Elab_PreDefinition_Structural_FindRecArg_0__Lean_Elab_Structural_orelse_x27___rarg___closed__1);
l_Lean_isTracingEnabledFor___at_Lean_Elab_Structural_findRecArg_go___spec__1___closed__1 = _init_l_Lean_isTracingEnabledFor___at_Lean_Elab_Structural_findRecArg_go___spec__1___closed__1();
lean_mark_persistent(l_Lean_isTracingEnabledFor___at_Lean_Elab_Structural_findRecArg_go___spec__1___closed__1);
l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__1 = _init_l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__1();
lean_mark_persistent(l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__1);
l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__2 = _init_l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__2();
lean_mark_persistent(l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__2);
l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__3 = _init_l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__3();
lean_mark_persistent(l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__3);
l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__4 = _init_l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__4();
lean_mark_persistent(l_Array_mapMUnsafe_map___at_Lean_Elab_Structural_findRecArg_go___spec__3___closed__4);
l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13___closed__1 = _init_l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13___closed__1();
lean_mark_persistent(l_Lean_addTrace___at_Lean_Elab_Structural_findRecArg_go___spec__13___closed__1);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__1 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__1();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__1);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__2 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__2();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__2);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__3 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__3();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__3);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__4 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__4();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__4);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__5 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__5();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__5);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__6 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__6();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__1___closed__6);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__1 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__1();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__1);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__2 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__2();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__2);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__3 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__3();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__3);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__4 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__4();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__4);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__5 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__5();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__5);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__6 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__6();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__6);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__7 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__7();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__7);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__8 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__8();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__8);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__9 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__9();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__9);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__10 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__10();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__10);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__11 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__11();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__11);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__12 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__12();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__12);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__13 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__13();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__13);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__14 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__14();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__14);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__15 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__15();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__15);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__16 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__16();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__16);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__17 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__17();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__17);
l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__18 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__18();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___lambda__3___closed__18);
l_Lean_Elab_Structural_findRecArg_go___rarg___closed__1 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__1();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___closed__1);
l_Lean_Elab_Structural_findRecArg_go___rarg___closed__2 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__2();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___closed__2);
l_Lean_Elab_Structural_findRecArg_go___rarg___closed__3 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__3();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___closed__3);
l_Lean_Elab_Structural_findRecArg_go___rarg___closed__4 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__4();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___closed__4);
l_Lean_Elab_Structural_findRecArg_go___rarg___closed__5 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__5();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___closed__5);
l_Lean_Elab_Structural_findRecArg_go___rarg___closed__6 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__6();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___closed__6);
l_Lean_Elab_Structural_findRecArg_go___rarg___closed__7 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__7();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___closed__7);
l_Lean_Elab_Structural_findRecArg_go___rarg___closed__8 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__8();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___closed__8);
l_Lean_Elab_Structural_findRecArg_go___rarg___closed__9 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__9();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___closed__9);
l_Lean_Elab_Structural_findRecArg_go___rarg___closed__10 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__10();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___closed__10);
l_Lean_Elab_Structural_findRecArg_go___rarg___closed__11 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__11();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___closed__11);
l_Lean_Elab_Structural_findRecArg_go___rarg___closed__12 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__12();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___closed__12);
l_Lean_Elab_Structural_findRecArg_go___rarg___closed__13 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__13();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___closed__13);
l_Lean_Elab_Structural_findRecArg_go___rarg___closed__14 = _init_l_Lean_Elab_Structural_findRecArg_go___rarg___closed__14();
lean_mark_persistent(l_Lean_Elab_Structural_findRecArg_go___rarg___closed__14);
l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___closed__1 = _init_l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___closed__1();
lean_mark_persistent(l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___closed__1);
l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___closed__2 = _init_l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___closed__2();
lean_mark_persistent(l_Lean_Meta_forEachExpr_x27___at_Lean_Elab_Structural_findRecArg___spec__3___closed__2);
return lean_io_result_mk_ok(lean_box(0));
}
#ifdef __cplusplus
}
#endif
|
2f3df3788723fbedc04610d621ba5b900cf81663
|
67305fcba68fdf469862aed2959ad1dd5b22a536
|
/examples/31_micropython/packages/micropython-v1.10.1/port/modules/moduos_file.h
|
3b7cc590aef16bce90f27259004f82175c81f841
|
[
"MIT",
"Apache-2.0"
] |
permissive
|
RT-Thread/IoT_Board
|
cdabf100a8d515fbcaa65ab0b72ec67acb0d2c9a
|
2d218a4e06f06dbb356ec00767904f91d00db7cc
|
refs/heads/master
| 2023-09-04T16:51:34.485240
| 2022-01-19T01:26:16
| 2022-01-19T01:26:16
| 161,133,933
| 344
| 238
|
Apache-2.0
| 2023-06-06T04:10:57
| 2018-12-10T07:21:46
|
C
|
UTF-8
|
C
| false
| false
| 3,243
|
h
|
moduos_file.h
|
/*
* This file is part of the MicroPython project, http://micropython.org/
*
* The MIT License (MIT)
*
* Copyright (c) 2017 SummerGift <zhangyuan@rt-thread.com>
*
* 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.
*/
#ifndef MICROPY_INCLUDED_PY_MODUOS_FILE_H
#define MICROPY_INCLUDED_PY_MODUOS_FILE_H
#include "py/lexer.h"
#include "py/obj.h"
// MicroPython's port-standardized versions of stat constants
#define MP_S_IFDIR (0x4000)
#define MP_S_IFREG (0x8000)
// constants for block protocol ioctl
#define BP_IOCTL_INIT (1)
#define BP_IOCTL_DEINIT (2)
#define BP_IOCTL_SYNC (3)
#define BP_IOCTL_SEC_COUNT (4)
#define BP_IOCTL_SEC_SIZE (5)
mp_obj_t mp_posix_mount(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
mp_obj_t mp_posix_umount(mp_obj_t mnt_in);
mp_obj_t mp_posix_open(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args);
mp_obj_t mp_posix_chdir(mp_obj_t path_in);
mp_obj_t mp_posix_getcwd(void);
mp_obj_t mp_posix_listdir(size_t n_args, const mp_obj_t *args);
mp_obj_t mp_posix_mkdir(mp_obj_t path_in);
mp_obj_t mp_posix_remove(uint n_args, const mp_obj_t *arg);
mp_obj_t mp_posix_rename(mp_obj_t old_path_in, mp_obj_t new_path_in);
mp_obj_t mp_posix_rmdir(uint n_args, const mp_obj_t *arg);
mp_obj_t mp_posix_stat(mp_obj_t path_in);
mp_obj_t mp_posix_statvfs(mp_obj_t path_in);
mp_obj_t mp_posix_file_crc32(mp_obj_t path_in);
mp_obj_t mp_posix_mkfs(size_t n_args, const mp_obj_t *args);
MP_DECLARE_CONST_FUN_OBJ_KW(mp_posix_mount_obj);
MP_DECLARE_CONST_FUN_OBJ_1(mp_posix_umount_obj);
MP_DECLARE_CONST_FUN_OBJ_KW(mp_posix_open_obj);
MP_DECLARE_CONST_FUN_OBJ_1(mp_posix_chdir_obj);
MP_DECLARE_CONST_FUN_OBJ_0(mp_posix_getcwd_obj);
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_posix_listdir_obj);
MP_DECLARE_CONST_FUN_OBJ_1(mp_posix_mkdir_obj);
MP_DECLARE_CONST_FUN_OBJ_VAR(mp_posix_remove_obj);
MP_DECLARE_CONST_FUN_OBJ_2(mp_posix_rename_obj);
MP_DECLARE_CONST_FUN_OBJ_VAR(mp_posix_rmdir_obj);
MP_DECLARE_CONST_FUN_OBJ_1(mp_posix_stat_obj);
MP_DECLARE_CONST_FUN_OBJ_1(mp_posix_statvfs_obj);
MP_DECLARE_CONST_FUN_OBJ_1(mp_posix_file_crc32_obj);
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(mp_posix_mkfs_obj);
#endif // MICROPY_INCLUDED_PY_MODUOS_FILE_H
|
53a2946842bb3f3374273fe5c25e6670eff9163d
|
a3d6556180e74af7b555f8d47d3fea55b94bcbda
|
/gpu/command_buffer/service/webgpu_cmd_validation_autogen.h
|
3f4b8cce94b1e5a75949781ae62c29b4aecb4999
|
[
"BSD-3-Clause"
] |
permissive
|
chromium/chromium
|
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
|
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
|
refs/heads/main
| 2023-08-24T00:35:12.585945
| 2023-08-23T22:01:11
| 2023-08-23T22:01:11
| 120,360,765
| 17,408
| 7,102
|
BSD-3-Clause
| 2023-09-10T23:44:27
| 2018-02-05T20:55:32
| null |
UTF-8
|
C
| false
| false
| 659
|
h
|
webgpu_cmd_validation_autogen.h
|
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file is auto-generated from
// gpu/command_buffer/build_webgpu_cmd_buffer.py
// It's formatted by clang-format using chromium coding style:
// clang-format -i -style=chromium filename
// DO NOT EDIT!
#ifndef GPU_COMMAND_BUFFER_SERVICE_WEBGPU_CMD_VALIDATION_AUTOGEN_H_
#define GPU_COMMAND_BUFFER_SERVICE_WEBGPU_CMD_VALIDATION_AUTOGEN_H_
ValueValidator<MailboxFlags> mailbox_flags;
ValueValidator<PowerPreference> power_preference;
#endif // GPU_COMMAND_BUFFER_SERVICE_WEBGPU_CMD_VALIDATION_AUTOGEN_H_
|
ddd04219c402122745725074ee1924fb7361df21
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/imx6sx/iMX6_Platform_SDK/sdk/include/mx6dq/registers/regsssi.h
|
a186f97168f2f5bb5ef5804d696f35baafad363c
|
[
"Apache-2.0",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 184,119
|
h
|
regsssi.h
|
/*
* Copyright (c) 2012, Freescale Semiconductor, Inc.
* All rights reserved.
*
* THIS SOFTWARE IS PROVIDED BY FREESCALE "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 FREESCALE 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.
*/
/*
* WARNING! DO NOT EDIT THIS FILE DIRECTLY!
*
* This file was generated automatically and any changes may be lost.
*/
#ifndef __HW_SSI_REGISTERS_H__
#define __HW_SSI_REGISTERS_H__
#include "regs.h"
/*
* i.MX6DQ SSI
*
* SSI
*
* Registers defined in this header file:
* - HW_SSI_STXn - SSI Transmit Data Register n
* - HW_SSI_SRXn - SSI Receive Data Register n
* - HW_SSI_SCR - SSI Control Register
* - HW_SSI_SISR - SSI Interrupt Status Register
* - HW_SSI_SIER - SSI Interrupt Enable Register
* - HW_SSI_STCR - SSI Transmit Configuration Register
* - HW_SSI_SRCR - SSI Receive Configuration Register
* - HW_SSI_STCCR - SSI Transmit Clock Control Register
* - HW_SSI_SRCCR - SSI Receive Clock Control Register
* - HW_SSI_SFCSR - SSI FIFO Control/Status Register
* - HW_SSI_SACNT - SSI AC97 Control Register
* - HW_SSI_SACADD - SSI AC97 Command Address Register
* - HW_SSI_SACDAT - SSI AC97 Command Data Register
* - HW_SSI_SATAG - SSI AC97 Tag Register
* - HW_SSI_STMSK - SSI Transmit Time Slot Mask Register
* - HW_SSI_SRMSK - SSI Receive Time Slot Mask Register
* - HW_SSI_SACCST - SSI AC97 Channel Status Register
* - HW_SSI_SACCEN - SSI AC97 Channel Enable Register
* - HW_SSI_SACCDIS - SSI AC97 Channel Disable Register
*
* - hw_ssi_t - Struct containing all module registers.
*/
//! @name Module base addresses
//@{
#ifndef REGS_SSI_BASE
#define HW_SSI_INSTANCE_COUNT (3) //!< Number of instances of the SSI module.
#define HW_SSI1 (1) //!< Instance number for SSI1.
#define HW_SSI2 (2) //!< Instance number for SSI2.
#define HW_SSI3 (3) //!< Instance number for SSI3.
#define REGS_SSI1_BASE (0x02028000) //!< Base address for SSI instance number 1.
#define REGS_SSI2_BASE (0x0202c000) //!< Base address for SSI instance number 2.
#define REGS_SSI3_BASE (0x02030000) //!< Base address for SSI instance number 3.
//! @brief Get the base address of SSI by instance number.
//! @param x SSI instance number, from 1 through 3.
#define REGS_SSI_BASE(x) ( (x) == HW_SSI1 ? REGS_SSI1_BASE : (x) == HW_SSI2 ? REGS_SSI2_BASE : (x) == HW_SSI3 ? REGS_SSI3_BASE : 0x00d00000)
//! @brief Get the instance number given a base address.
//! @param b Base address for an instance of SSI.
#define REGS_SSI_INSTANCE(b) ( (b) == REGS_SSI1_BASE ? HW_SSI1 : (b) == REGS_SSI2_BASE ? HW_SSI2 : (b) == REGS_SSI3_BASE ? HW_SSI3 : 0)
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_STXn - SSI Transmit Data Register n
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_STXn - SSI Transmit Data Register n (RW)
*
* Reset value: 0x00000000
*
* Enable SSI (SSIEN=1) before writing to SSI Transmit Data Registers.
*/
typedef union _hw_ssi_stxn
{
reg32_t U;
struct _hw_ssi_stxn_bitfields
{
unsigned STXN : 32; //!< [31:0] SSI Transmit Data.
} B;
} hw_ssi_stxn_t;
#endif
/*!
* @name Constants and macros for entire SSI_STXn register
*/
//@{
//! @brief Number of instances of the SSI_STXn register.
#define HW_SSI_STXn_COUNT (2)
#define HW_SSI_STXn_ADDR(n, x) (REGS_SSI_BASE(x) + 0x0 + (0x4 * (n)))
#ifndef __LANGUAGE_ASM__
#define HW_SSI_STXn(x, n) (*(volatile hw_ssi_stxn_t *) HW_SSI_STXn_ADDR(n, x))
#define HW_SSI_STXn_RD(x, n) (HW_SSI_STXn(x, n).U)
#define HW_SSI_STXn_WR(x, n, v) (HW_SSI_STXn(x, n).U = (v))
#define HW_SSI_STXn_SET(x, n, v) (HW_SSI_STXn_WR(x, n, HW_SSI_STXn_RD(x, n) | (v)))
#define HW_SSI_STXn_CLR(x, n, v) (HW_SSI_STXn_WR(x, n, HW_SSI_STXn_RD(x, n) & ~(v)))
#define HW_SSI_STXn_TOG(x, n, v) (HW_SSI_STXn_WR(x, n, HW_SSI_STXn_RD(x, n) ^ (v)))
#endif
//@}
/*
* constants & macros for individual SSI_STXn bitfields
*/
/*! @name Register SSI_STXn, field STXN[31:0] (RW)
*
* SSI Transmit Data. These bits store the data to be transmitted by the These are implemented as
* the first word of their respective Tx FIFOs. Data written to these registers is transferred to
* the Transmit Shift Register (TXSR), when shifting of the previous data is complete. If both FIFOs
* are in use, data is alternately transferred from STX0 and STX1, to TXSR. Multiple writes to the
* STX registers will not result in the previous data being over-written by the subsequent data.
* STX1 can only be used in Two-Channel mode of operation. Protection from over-writing is present
* irrespective of whether the transmitter is enabled or not. Example 1: If Tx FIFO0 is in use and
* user writes Data1... Data16 to STX0, Data16 will not over-write Data1. Data1... Data15 are stored
* in the FIFO while Data16 is discarded. Example 2: If Tx FIFO0 is not in use and user writes
* Data1, Data2 to STX0, then Data2 will not over-write Data1 and will be discarded.
*/
//@{
#define BP_SSI_STXn_STXN (0) //!< Bit position for SSI_STXn_STXN.
#define BM_SSI_STXn_STXN (0xffffffff) //!< Bit mask for SSI_STXn_STXN.
//! @brief Get value of SSI_STXn_STXN from a register value.
#define BG_SSI_STXn_STXN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STXn_STXN) >> BP_SSI_STXn_STXN)
//! @brief Format value for bitfield SSI_STXn_STXN.
#define BF_SSI_STXn_STXN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STXn_STXN) & BM_SSI_STXn_STXN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the STXN field to a new value.
#define BW_SSI_STXn_STXN(x, n, v) (HW_SSI_STXn_WR(x, n, (HW_SSI_STXn_RD(x, n) & ~BM_SSI_STXn_STXN) | BF_SSI_STXn_STXN(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_SRXn - SSI Receive Data Register n
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_SRXn - SSI Receive Data Register n (RO)
*
* Reset value: 0x00000000
*/
typedef union _hw_ssi_srxn
{
reg32_t U;
struct _hw_ssi_srxn_bitfields
{
unsigned SRXN : 32; //!< [31:0] SSI Receive Data.
} B;
} hw_ssi_srxn_t;
#endif
/*!
* @name Constants and macros for entire SSI_SRXn register
*/
//@{
//! @brief Number of instances of the SSI_SRXn register.
#define HW_SSI_SRXn_COUNT (2)
#define HW_SSI_SRXn_ADDR(n, x) (REGS_SSI_BASE(x) + 0x8 + (0x4 * (n)))
#ifndef __LANGUAGE_ASM__
#define HW_SSI_SRXn(x, n) (*(volatile hw_ssi_srxn_t *) HW_SSI_SRXn_ADDR(n, x))
#define HW_SSI_SRXn_RD(x, n) (HW_SSI_SRXn(x, n).U)
#endif
//@}
/*
* constants & macros for individual SSI_SRXn bitfields
*/
/*! @name Register SSI_SRXn, field SRXN[31:0] (RO)
*
* SSI Receive Data. These bits store the data received by the These are implemented as the first
* word of their respective Rx FIFOs. These bits receive data from the RXSR depending on the mode of
* operation. In case both FIFOs are in use, data is transferred to each data register alternately.
* SRX1 can only be used in Two-Channel mode of operation.
*/
//@{
#define BP_SSI_SRXn_SRXN (0) //!< Bit position for SSI_SRXn_SRXN.
#define BM_SSI_SRXn_SRXN (0xffffffff) //!< Bit mask for SSI_SRXn_SRXN.
//! @brief Get value of SSI_SRXn_SRXN from a register value.
#define BG_SSI_SRXn_SRXN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRXn_SRXN) >> BP_SSI_SRXn_SRXN)
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_SCR - SSI Control Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_SCR - SSI Control Register (RW)
*
* Reset value: 0x00000000
*
* The SSI Control Register (SSI_SCR) sets up the SSI reset is controlled by bit 0 in the SSI_SCR.
* SSI operating modes are also selected in this register (except AC97 mode which is selected in the
* SSI_SACNT register).
*/
typedef union _hw_ssi_scr
{
reg32_t U;
struct _hw_ssi_scr_bitfields
{
unsigned SSIEN : 1; //!< [0] SSIEN - SSI Enable
unsigned TE : 1; //!< [1] Transmit Enable.
unsigned RE : 1; //!< [2] Receive Enable.
unsigned NET : 1; //!< [3] Network Mode.
unsigned SYN : 1; //!< [4] Synchronous Mode.
unsigned I2S_MODE : 2; //!< [6:5] I2S Mode Select.
unsigned SYS_CLK_EN : 1; //!< [7] Network Clock (Oversampling Clock) Enable.
unsigned TCH_EN : 1; //!< [8] Two-Channel Operation Enable.
unsigned CLK_IST : 1; //!< [9] Clock Idle State.
unsigned TFR_CLK_DIS : 1; //!< [10] Transmit Frame Clock Disable.
unsigned RFR_CLK_DIS : 1; //!< [11] Receive Frame Clock Disable.
unsigned SYNC_TX_FS : 1; //!< [12] SYNC_FS_TX bit provides a safe window for TE to be visible to the internal circuit which is just after FS occurrence.
unsigned RESERVED0 : 19; //!< [31:13] Reserved
} B;
} hw_ssi_scr_t;
#endif
/*!
* @name Constants and macros for entire SSI_SCR register
*/
//@{
#define HW_SSI_SCR_ADDR(x) (REGS_SSI_BASE(x) + 0x10)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_SCR(x) (*(volatile hw_ssi_scr_t *) HW_SSI_SCR_ADDR(x))
#define HW_SSI_SCR_RD(x) (HW_SSI_SCR(x).U)
#define HW_SSI_SCR_WR(x, v) (HW_SSI_SCR(x).U = (v))
#define HW_SSI_SCR_SET(x, v) (HW_SSI_SCR_WR(x, HW_SSI_SCR_RD(x) | (v)))
#define HW_SSI_SCR_CLR(x, v) (HW_SSI_SCR_WR(x, HW_SSI_SCR_RD(x) & ~(v)))
#define HW_SSI_SCR_TOG(x, v) (HW_SSI_SCR_WR(x, HW_SSI_SCR_RD(x) ^ (v)))
#endif
//@}
/*
* constants & macros for individual SSI_SCR bitfields
*/
/*! @name Register SSI_SCR, field SSIEN[0] (RW)
*
* SSIEN - SSI Enable This bit is used to enable/disable the SSI. When disabled, all SSI status bits
* are preset to the same state produced by the power-on reset, all control bits are unaffected, the
* contents of Tx and Rx FIFOs are cleared. When SSI is disabled, all internal clocks are disabled
* (except register access clock).
*
* Values:
* - DISABLED = 0 - SSI is disabled.
* - ENABLED = 1 - SSI is enabled.
*/
//@{
#define BP_SSI_SCR_SSIEN (0) //!< Bit position for SSI_SCR_SSIEN.
#define BM_SSI_SCR_SSIEN (0x00000001) //!< Bit mask for SSI_SCR_SSIEN.
//! @brief Get value of SSI_SCR_SSIEN from a register value.
#define BG_SSI_SCR_SSIEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SCR_SSIEN) >> BP_SSI_SCR_SSIEN)
//! @brief Format value for bitfield SSI_SCR_SSIEN.
#define BF_SSI_SCR_SSIEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SCR_SSIEN) & BM_SSI_SCR_SSIEN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SSIEN field to a new value.
#define BW_SSI_SCR_SSIEN(x, v) (HW_SSI_SCR_WR(x, (HW_SSI_SCR_RD(x) & ~BM_SSI_SCR_SSIEN) | BF_SSI_SCR_SSIEN(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SCR_SSIEN_V(v) BF_SSI_SCR_SSIEN(BV_SSI_SCR_SSIEN__##v)
#define BV_SSI_SCR_SSIEN__DISABLED (0x0) //!< SSI is disabled.
#define BV_SSI_SCR_SSIEN__ENABLED (0x1) //!< SSI is enabled.
//@}
/*! @name Register SSI_SCR, field TE[1] (RW)
*
* Transmit Enable. This control bit enables the transmit section of the SSI. It enables the
* transfer of the contents of the STX registers to the TXSR and also enables the internal transmit
* clock. The transmit section is enabled when this bit is set and a frame boundary is detected.
* When this bit is cleared, the transmitter continues to send data until the end of the current
* frame and then stops. Data can be written to the STX registers with the TE bit cleared (the
* corresponding TDE bit will be cleared). If the TE bit is cleared and then set again before the
* second to last bit of the last time slot in the current frame, data transmission continues
* without interruption. The normal transmit enable sequence is to write data to the STX register(s)
* and then set the TE bit. The normal disable sequence is to clear the TE and TIE bits after the
* TDE bit is set. In gated clock mode, clearing the TE bit results in the clock stopping after the
* data currently in TXSR has shifted out. When the TE bit is set, the clock starts immediately (for
* internal gated clock mode). TE should not be toggled in the same frame. After enabling/disabling
* transmission, SSI expects 4 setup clock cycles before arrival of frame-sync for frame-sync to be
* accepted/rejected by In case of fewer clock cycles, there is high probability of the frame-sync
* to get missed. Note: If continuos clock is not provided, SSI expects 6 clock cycles before
* arrival of frame-sync for frame-sync to be accepted by
*
* Values:
* - DISABLED = 0 - Transmit section disabled.
* - ENABLED = 1 - Transmit section enabled.
*/
//@{
#define BP_SSI_SCR_TE (1) //!< Bit position for SSI_SCR_TE.
#define BM_SSI_SCR_TE (0x00000002) //!< Bit mask for SSI_SCR_TE.
//! @brief Get value of SSI_SCR_TE from a register value.
#define BG_SSI_SCR_TE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SCR_TE) >> BP_SSI_SCR_TE)
//! @brief Format value for bitfield SSI_SCR_TE.
#define BF_SSI_SCR_TE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SCR_TE) & BM_SSI_SCR_TE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TE field to a new value.
#define BW_SSI_SCR_TE(x, v) (HW_SSI_SCR_WR(x, (HW_SSI_SCR_RD(x) & ~BM_SSI_SCR_TE) | BF_SSI_SCR_TE(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SCR_TE_V(v) BF_SSI_SCR_TE(BV_SSI_SCR_TE__##v)
#define BV_SSI_SCR_TE__DISABLED (0x0) //!< Transmit section disabled.
#define BV_SSI_SCR_TE__ENABLED (0x1) //!< Transmit section enabled.
//@}
/*! @name Register SSI_SCR, field RE[2] (RW)
*
* Receive Enable. This control bit enables the receive section of the SSI. When this bit is
* enabled, data reception starts with the arrival of the next frame sync. If data is being received
* when this bit is cleared, data reception continues until the end of the current frame and then
* stops. If this bit is set again before the second to last bit of the last time slot in the
* current frame, then reception continues without interruption. RE should not be toggled in the
* same frame.
*
* Values:
* - DISABLED = 0 - Receive section disabled.
* - ENABLED = 1 - Receive section enabled.
*/
//@{
#define BP_SSI_SCR_RE (2) //!< Bit position for SSI_SCR_RE.
#define BM_SSI_SCR_RE (0x00000004) //!< Bit mask for SSI_SCR_RE.
//! @brief Get value of SSI_SCR_RE from a register value.
#define BG_SSI_SCR_RE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SCR_RE) >> BP_SSI_SCR_RE)
//! @brief Format value for bitfield SSI_SCR_RE.
#define BF_SSI_SCR_RE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SCR_RE) & BM_SSI_SCR_RE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RE field to a new value.
#define BW_SSI_SCR_RE(x, v) (HW_SSI_SCR_WR(x, (HW_SSI_SCR_RD(x) & ~BM_SSI_SCR_RE) | BF_SSI_SCR_RE(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SCR_RE_V(v) BF_SSI_SCR_RE(BV_SSI_SCR_RE__##v)
#define BV_SSI_SCR_RE__DISABLED (0x0) //!< Receive section disabled.
#define BV_SSI_SCR_RE__ENABLED (0x1) //!< Receive section enabled.
//@}
/*! @name Register SSI_SCR, field NET[3] (RW)
*
* Network Mode. This bit controls whether SSI is in network mode or not.
*
* Values:
* - DISABLED = 0 - Network mode not selected.
* - ENABLED = 1 - Network mode selected.
*/
//@{
#define BP_SSI_SCR_NET (3) //!< Bit position for SSI_SCR_NET.
#define BM_SSI_SCR_NET (0x00000008) //!< Bit mask for SSI_SCR_NET.
//! @brief Get value of SSI_SCR_NET from a register value.
#define BG_SSI_SCR_NET(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SCR_NET) >> BP_SSI_SCR_NET)
//! @brief Format value for bitfield SSI_SCR_NET.
#define BF_SSI_SCR_NET(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SCR_NET) & BM_SSI_SCR_NET)
#ifndef __LANGUAGE_ASM__
//! @brief Set the NET field to a new value.
#define BW_SSI_SCR_NET(x, v) (HW_SSI_SCR_WR(x, (HW_SSI_SCR_RD(x) & ~BM_SSI_SCR_NET) | BF_SSI_SCR_NET(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SCR_NET_V(v) BF_SSI_SCR_NET(BV_SSI_SCR_NET__##v)
#define BV_SSI_SCR_NET__DISABLED (0x0) //!< Network mode not selected.
#define BV_SSI_SCR_NET__ENABLED (0x1) //!< Network mode selected.
//@}
/*! @name Register SSI_SCR, field SYN[4] (RW)
*
* Synchronous Mode. This bit controls whether SSI is in synchronous mode or not. In synchronous
* mode, the transmit and receive sections of SSI share a common clock port (STCK) and frame sync
* port (STFS).
*
* Values:
* - ASYNC_MODE = 0 - Asynchronous mode selected.
* - SYNC_MODE = 1 - Synchronous mode selected.
*/
//@{
#define BP_SSI_SCR_SYN (4) //!< Bit position for SSI_SCR_SYN.
#define BM_SSI_SCR_SYN (0x00000010) //!< Bit mask for SSI_SCR_SYN.
//! @brief Get value of SSI_SCR_SYN from a register value.
#define BG_SSI_SCR_SYN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SCR_SYN) >> BP_SSI_SCR_SYN)
//! @brief Format value for bitfield SSI_SCR_SYN.
#define BF_SSI_SCR_SYN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SCR_SYN) & BM_SSI_SCR_SYN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SYN field to a new value.
#define BW_SSI_SCR_SYN(x, v) (HW_SSI_SCR_WR(x, (HW_SSI_SCR_RD(x) & ~BM_SSI_SCR_SYN) | BF_SSI_SCR_SYN(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SCR_SYN_V(v) BF_SSI_SCR_SYN(BV_SSI_SCR_SYN__##v)
#define BV_SSI_SCR_SYN__ASYNC_MODE (0x0) //!< Asynchronous mode selected.
#define BV_SSI_SCR_SYN__SYNC_MODE (0x1) //!< Synchronous mode selected.
//@}
/*! @name Register SSI_SCR, field I2S_MODE[6:5] (RW)
*
* I2S Mode Select. These bits allow the SSI to operate in Normal, I2S Master or I2S Slave mode.
* Refer to for a detailed description of I2S Mode of operation. Refer to for details regarding
* settings.
*/
//@{
#define BP_SSI_SCR_I2S_MODE (5) //!< Bit position for SSI_SCR_I2S_MODE.
#define BM_SSI_SCR_I2S_MODE (0x00000060) //!< Bit mask for SSI_SCR_I2S_MODE.
//! @brief Get value of SSI_SCR_I2S_MODE from a register value.
#define BG_SSI_SCR_I2S_MODE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SCR_I2S_MODE) >> BP_SSI_SCR_I2S_MODE)
//! @brief Format value for bitfield SSI_SCR_I2S_MODE.
#define BF_SSI_SCR_I2S_MODE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SCR_I2S_MODE) & BM_SSI_SCR_I2S_MODE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the I2S_MODE field to a new value.
#define BW_SSI_SCR_I2S_MODE(x, v) (HW_SSI_SCR_WR(x, (HW_SSI_SCR_RD(x) & ~BM_SSI_SCR_I2S_MODE) | BF_SSI_SCR_I2S_MODE(v)))
#endif
//@}
/*! @name Register SSI_SCR, field SYS_CLK_EN[7] (RW)
*
* Network Clock (Oversampling Clock) Enable. When set, this bit allows the SSI to output the
* network clock at the SRCK port, provided that synchronous mode, and transmit internal clock mode
* are set. The relationship between bit clock and network clock is determined by DIV2, PSR, and PM
* bits. This feature is especially useful in I2S Master mode to output network clock (oversampling
* clock) on SRCK port.
*
* Values:
* - NOT_OUTPUT = 0 - network clock not output on SRCK port.
* - OUTPUT = 1 - network clock output on SRCK port.
*/
//@{
#define BP_SSI_SCR_SYS_CLK_EN (7) //!< Bit position for SSI_SCR_SYS_CLK_EN.
#define BM_SSI_SCR_SYS_CLK_EN (0x00000080) //!< Bit mask for SSI_SCR_SYS_CLK_EN.
//! @brief Get value of SSI_SCR_SYS_CLK_EN from a register value.
#define BG_SSI_SCR_SYS_CLK_EN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SCR_SYS_CLK_EN) >> BP_SSI_SCR_SYS_CLK_EN)
//! @brief Format value for bitfield SSI_SCR_SYS_CLK_EN.
#define BF_SSI_SCR_SYS_CLK_EN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SCR_SYS_CLK_EN) & BM_SSI_SCR_SYS_CLK_EN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SYS_CLK_EN field to a new value.
#define BW_SSI_SCR_SYS_CLK_EN(x, v) (HW_SSI_SCR_WR(x, (HW_SSI_SCR_RD(x) & ~BM_SSI_SCR_SYS_CLK_EN) | BF_SSI_SCR_SYS_CLK_EN(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SCR_SYS_CLK_EN_V(v) BF_SSI_SCR_SYS_CLK_EN(BV_SSI_SCR_SYS_CLK_EN__##v)
#define BV_SSI_SCR_SYS_CLK_EN__NOT_OUTPUT (0x0) //!< network clock not output on SRCK port.
#define BV_SSI_SCR_SYS_CLK_EN__OUTPUT (0x1) //!< network clock output on SRCK port.
//@}
/*! @name Register SSI_SCR, field TCH_EN[8] (RW)
*
* Two-Channel Operation Enable. This bit allows SSI to operate in the two-channel mode.In this mode
* while receiving, the RXSR transfers data to SRX0 and SRX1 alternately and while transmitting,
* data is alternately transferred from STX0 and STX1 to TXSR. For an even number of slots, Two-
* Channel Operation can be enabled to optimize usage of both FIFOs or disabled as in the case of
* odd number of active slots. This feature is especially useful in I2S mode, where data for Left
* Speaker can be placed in Tx-FIFO0 and for Right speaker in Tx-FIFO1.
*
* Values:
* - DISABLED = 0 - Two-channel mode disabled.
* - ENABLED = 1 - Two-channel mode enabled.
*/
//@{
#define BP_SSI_SCR_TCH_EN (8) //!< Bit position for SSI_SCR_TCH_EN.
#define BM_SSI_SCR_TCH_EN (0x00000100) //!< Bit mask for SSI_SCR_TCH_EN.
//! @brief Get value of SSI_SCR_TCH_EN from a register value.
#define BG_SSI_SCR_TCH_EN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SCR_TCH_EN) >> BP_SSI_SCR_TCH_EN)
//! @brief Format value for bitfield SSI_SCR_TCH_EN.
#define BF_SSI_SCR_TCH_EN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SCR_TCH_EN) & BM_SSI_SCR_TCH_EN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TCH_EN field to a new value.
#define BW_SSI_SCR_TCH_EN(x, v) (HW_SSI_SCR_WR(x, (HW_SSI_SCR_RD(x) & ~BM_SSI_SCR_TCH_EN) | BF_SSI_SCR_TCH_EN(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SCR_TCH_EN_V(v) BF_SSI_SCR_TCH_EN(BV_SSI_SCR_TCH_EN__##v)
#define BV_SSI_SCR_TCH_EN__DISABLED (0x0) //!< Two-channel mode disabled.
#define BV_SSI_SCR_TCH_EN__ENABLED (0x1) //!< Two-channel mode enabled.
//@}
/*! @name Register SSI_SCR, field CLK_IST[9] (RW)
*
* Clock Idle State. This bit controls the idle state of the transmit clock port during SSI internal
* gated mode. Note: When Clock idle state is '1' the clock polarity should always be negedge
* triggered and when Clock idle = '0' the clock polarity should always be positive edge triggered.
*
* Values:
* - IDLE_0 = 0 - Clock idle state is '0'.
* - IDLE_1 = 1 - Clock idle state is '1'.
*/
//@{
#define BP_SSI_SCR_CLK_IST (9) //!< Bit position for SSI_SCR_CLK_IST.
#define BM_SSI_SCR_CLK_IST (0x00000200) //!< Bit mask for SSI_SCR_CLK_IST.
//! @brief Get value of SSI_SCR_CLK_IST from a register value.
#define BG_SSI_SCR_CLK_IST(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SCR_CLK_IST) >> BP_SSI_SCR_CLK_IST)
//! @brief Format value for bitfield SSI_SCR_CLK_IST.
#define BF_SSI_SCR_CLK_IST(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SCR_CLK_IST) & BM_SSI_SCR_CLK_IST)
#ifndef __LANGUAGE_ASM__
//! @brief Set the CLK_IST field to a new value.
#define BW_SSI_SCR_CLK_IST(x, v) (HW_SSI_SCR_WR(x, (HW_SSI_SCR_RD(x) & ~BM_SSI_SCR_CLK_IST) | BF_SSI_SCR_CLK_IST(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SCR_CLK_IST_V(v) BF_SSI_SCR_CLK_IST(BV_SSI_SCR_CLK_IST__##v)
#define BV_SSI_SCR_CLK_IST__IDLE_0 (0x0) //!< Clock idle state is '0'.
#define BV_SSI_SCR_CLK_IST__IDLE_1 (0x1) //!< Clock idle state is '1'.
//@}
/*! @name Register SSI_SCR, field TFR_CLK_DIS[10] (RW)
*
* Transmit Frame Clock Disable. This bit provide option to keep the Frame-sync and Clock enabled or
* disabled after current transmit frame, in which transmitter is disabled by clearing TE bit.
* Writing to this bit has effect only when SSI is enabled TE is disabled.
*
* Values:
* - CONTINUE = 0 - Continue Frame-sync/Clock generation after current frame during which TE is cleared. This may be
* required when Frame-sync and Clocks are required from SSI, even when no data is to be
* received.
* - STOP = 1 - Stop Frame-sync/Clock generation at next frame boundary. This will be effective also in case where
* transmitter is already disabled in current or previous frames.
*/
//@{
#define BP_SSI_SCR_TFR_CLK_DIS (10) //!< Bit position for SSI_SCR_TFR_CLK_DIS.
#define BM_SSI_SCR_TFR_CLK_DIS (0x00000400) //!< Bit mask for SSI_SCR_TFR_CLK_DIS.
//! @brief Get value of SSI_SCR_TFR_CLK_DIS from a register value.
#define BG_SSI_SCR_TFR_CLK_DIS(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SCR_TFR_CLK_DIS) >> BP_SSI_SCR_TFR_CLK_DIS)
//! @brief Format value for bitfield SSI_SCR_TFR_CLK_DIS.
#define BF_SSI_SCR_TFR_CLK_DIS(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SCR_TFR_CLK_DIS) & BM_SSI_SCR_TFR_CLK_DIS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TFR_CLK_DIS field to a new value.
#define BW_SSI_SCR_TFR_CLK_DIS(x, v) (HW_SSI_SCR_WR(x, (HW_SSI_SCR_RD(x) & ~BM_SSI_SCR_TFR_CLK_DIS) | BF_SSI_SCR_TFR_CLK_DIS(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SCR_TFR_CLK_DIS_V(v) BF_SSI_SCR_TFR_CLK_DIS(BV_SSI_SCR_TFR_CLK_DIS__##v)
#define BV_SSI_SCR_TFR_CLK_DIS__CONTINUE (0x0) //!< Continue Frame-sync/Clock generation after current frame during which TE is cleared. This may be required when Frame-sync and Clocks are required from SSI, even when no data is to be received.
#define BV_SSI_SCR_TFR_CLK_DIS__STOP (0x1) //!< Stop Frame-sync/Clock generation at next frame boundary. This will be effective also in case where transmitter is already disabled in current or previous frames.
//@}
/*! @name Register SSI_SCR, field RFR_CLK_DIS[11] (RW)
*
* Receive Frame Clock Disable. This bit provides the option to keep the Frame-sync and Clock
* enabled or to disable them after the receive frame in which the receiver is disabled. Writing to
* this bit has effect only when RE is disabled.The receiver is disabled by clearing the RE bit.
*
* Values:
* - CONTINUE = 0 - Continue Frame-sync/Clock generation after current frame during which RE is cleared. This may be
* required when Frame-sync and Clocks are required from SSI, even when no data is to be
* received.
* - STOP = 1 - Stop Frame-sync/Clock generation at next frame boundary. This will be effective also in case where
* receiver is already disabled in current or previous frames.
*/
//@{
#define BP_SSI_SCR_RFR_CLK_DIS (11) //!< Bit position for SSI_SCR_RFR_CLK_DIS.
#define BM_SSI_SCR_RFR_CLK_DIS (0x00000800) //!< Bit mask for SSI_SCR_RFR_CLK_DIS.
//! @brief Get value of SSI_SCR_RFR_CLK_DIS from a register value.
#define BG_SSI_SCR_RFR_CLK_DIS(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SCR_RFR_CLK_DIS) >> BP_SSI_SCR_RFR_CLK_DIS)
//! @brief Format value for bitfield SSI_SCR_RFR_CLK_DIS.
#define BF_SSI_SCR_RFR_CLK_DIS(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SCR_RFR_CLK_DIS) & BM_SSI_SCR_RFR_CLK_DIS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RFR_CLK_DIS field to a new value.
#define BW_SSI_SCR_RFR_CLK_DIS(x, v) (HW_SSI_SCR_WR(x, (HW_SSI_SCR_RD(x) & ~BM_SSI_SCR_RFR_CLK_DIS) | BF_SSI_SCR_RFR_CLK_DIS(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SCR_RFR_CLK_DIS_V(v) BF_SSI_SCR_RFR_CLK_DIS(BV_SSI_SCR_RFR_CLK_DIS__##v)
#define BV_SSI_SCR_RFR_CLK_DIS__CONTINUE (0x0) //!< Continue Frame-sync/Clock generation after current frame during which RE is cleared. This may be required when Frame-sync and Clocks are required from SSI, even when no data is to be received.
#define BV_SSI_SCR_RFR_CLK_DIS__STOP (0x1) //!< Stop Frame-sync/Clock generation at next frame boundary. This will be effective also in case where receiver is already disabled in current or previous frames.
//@}
/*! @name Register SSI_SCR, field SYNC_TX_FS[12] (RW)
*
* SYNC_FS_TX bit provides a safe window for TE to be visible to the internal circuit which is just
* after FS occurrence. When SYNC_TX_FS is set, TE(SCR[1]) gets latched on FS occurrence & latched
* TE is used to enable/disable SSI transmitter. TE needs setup of 2 bit-clock cycles before
* occurrence of FS. If TE is changed within 2 bit-clock cycles of FS occurrence, there is high
* probability that TE will be latched on next FS. Note: With TFR_CLK_DIS feature on, TE is used
* directly to enable transmitter in following cases (i) Sync mode & Rx disabled (ii) Async Mode.
* Latched-TE is used to disable the transmitter. This bit has no relevance in gated mode and AC97
* mode.
*
* Values:
* - TE_NOT_LATCHED = 0 - TE not latched with FS occurrence & used directly for transmitter enable/disable.
* - TE_LATCHED = 1 - TE latched with FS occurrence & latched-TE used for transmitter enable/disable.
*/
//@{
#define BP_SSI_SCR_SYNC_TX_FS (12) //!< Bit position for SSI_SCR_SYNC_TX_FS.
#define BM_SSI_SCR_SYNC_TX_FS (0x00001000) //!< Bit mask for SSI_SCR_SYNC_TX_FS.
//! @brief Get value of SSI_SCR_SYNC_TX_FS from a register value.
#define BG_SSI_SCR_SYNC_TX_FS(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SCR_SYNC_TX_FS) >> BP_SSI_SCR_SYNC_TX_FS)
//! @brief Format value for bitfield SSI_SCR_SYNC_TX_FS.
#define BF_SSI_SCR_SYNC_TX_FS(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SCR_SYNC_TX_FS) & BM_SSI_SCR_SYNC_TX_FS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SYNC_TX_FS field to a new value.
#define BW_SSI_SCR_SYNC_TX_FS(x, v) (HW_SSI_SCR_WR(x, (HW_SSI_SCR_RD(x) & ~BM_SSI_SCR_SYNC_TX_FS) | BF_SSI_SCR_SYNC_TX_FS(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SCR_SYNC_TX_FS_V(v) BF_SSI_SCR_SYNC_TX_FS(BV_SSI_SCR_SYNC_TX_FS__##v)
#define BV_SSI_SCR_SYNC_TX_FS__TE_NOT_LATCHED (0x0) //!< TE not latched with FS occurrence & used directly for transmitter enable/disable.
#define BV_SSI_SCR_SYNC_TX_FS__TE_LATCHED (0x1) //!< TE latched with FS occurrence & latched-TE used for transmitter enable/disable.
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_SISR - SSI Interrupt Status Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_SISR - SSI Interrupt Status Register (W1C)
*
* Reset value: 0x00003003
*
* The SSI Interrupt Status Register (SSI_SISR) is used to monitor the SSI. This register is used by
* the core to interrogate the status of the In gated mode of operation the TFS, RFS, TLS, RLS, TFRC
* and RFRC bits of AISR register are not generated. The status bits are described in the following
* table. SSI Status flags are valid when SSI is enabled. See and for interrupt source mapping. All
* the flags in the SSI_SISR are updated after the first bit of the next SSI word has completed
* transmission or reception. Certain status bits (ROE0/1 and TUE0/1) are cleared by writing 1 to
* the corresponding interrupt status bit in SSI_SISR.
*/
typedef union _hw_ssi_sisr
{
reg32_t U;
struct _hw_ssi_sisr_bitfields
{
unsigned TFE0 : 1; //!< [0] Transmit FIFO Empty 0.
unsigned TFE1 : 1; //!< [1] Transmit FIFO Empty 1.
unsigned RFF0 : 1; //!< [2] Receive FIFO Full 0.
unsigned RFF1 : 1; //!< [3] Receive FIFO Full 1.
unsigned RLS : 1; //!< [4] Receive Last Time Slot.
unsigned TLS : 1; //!< [5] Transmit Last Time Slot.
unsigned RFS : 1; //!< [6] Receive Frame Sync.
unsigned TFS : 1; //!< [7] Transmit Frame Sync.
unsigned TUE0 : 1; //!< [8] Transmitter Underrun Error 0.
unsigned TUE1 : 1; //!< [9] Transmitter Underrun Error 1.
unsigned ROE0 : 1; //!< [10] Receiver Overrun Error 0.
unsigned ROE1 : 1; //!< [11] Receiver Overrun Error 1.
unsigned TDE0 : 1; //!< [12] Transmit Data Register Empty 0.
unsigned TDE1 : 1; //!< [13] Transmit Data Register Empty 1.
unsigned RDR0 : 1; //!< [14] Receive Data Ready 0.
unsigned RDR1 : 1; //!< [15] Receive Data Ready 1.
unsigned RXT : 1; //!< [16] Receive Tag Updated.
unsigned CMDDU : 1; //!< [17] Command Data Register Updated.
unsigned CMDAU : 1; //!< [18] Command Address Register Updated.
unsigned RESERVED0 : 4; //!< [22:19] Reserved
unsigned TFRC : 1; //!< [23] Transmit Frame Complete.
unsigned RFRC : 1; //!< [24] Receive Frame Complete.
unsigned RESERVED1 : 7; //!< [31:25] Reserved
} B;
} hw_ssi_sisr_t;
#endif
/*!
* @name Constants and macros for entire SSI_SISR register
*/
//@{
#define HW_SSI_SISR_ADDR(x) (REGS_SSI_BASE(x) + 0x14)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_SISR(x) (*(volatile hw_ssi_sisr_t *) HW_SSI_SISR_ADDR(x))
#define HW_SSI_SISR_RD(x) (HW_SSI_SISR(x).U)
#define HW_SSI_SISR_WR(x, v) (HW_SSI_SISR(x).U = (v))
#define HW_SSI_SISR_SET(x, v) (HW_SSI_SISR_WR(x, HW_SSI_SISR_RD(x) | (v)))
#define HW_SSI_SISR_CLR(x, v) (HW_SSI_SISR_WR(x, HW_SSI_SISR_RD(x) & ~(v)))
#define HW_SSI_SISR_TOG(x, v) (HW_SSI_SISR_WR(x, HW_SSI_SISR_RD(x) ^ (v)))
#endif
//@}
/*
* constants & macros for individual SSI_SISR bitfields
*/
/*! @name Register SSI_SISR, field TFE0[0] (RO)
*
* Transmit FIFO Empty 0. This flag is set when the empty slots in Tx FIFO exceed or are equal to
* the selected Tx FIFO WaterMark 0 (TFWM0) threshold. The setting of TFE0 only causes an interrupt
* when TIE and TFE0_EN are set and Tx FIFO0 is enabled. The TFE0 bit is automatically cleared when
* the data level in Tx FIFO0 becomes more than the amount specified by the watermark bits. The TFE0
* bit is set by POR and SSI reset.
*
* Values:
* - HAS_DATA = 0 - Transmit FIFO0 has data for transmission.
* - EMPTY = 1 - Transmit FIFO0 is empty.
*/
//@{
#define BP_SSI_SISR_TFE0 (0) //!< Bit position for SSI_SISR_TFE0.
#define BM_SSI_SISR_TFE0 (0x00000001) //!< Bit mask for SSI_SISR_TFE0.
//! @brief Get value of SSI_SISR_TFE0 from a register value.
#define BG_SSI_SISR_TFE0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_TFE0) >> BP_SSI_SISR_TFE0)
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SISR_TFE0_V(v) BF_SSI_SISR_TFE0(BV_SSI_SISR_TFE0__##v)
#define BV_SSI_SISR_TFE0__HAS_DATA (0x0) //!< Transmit FIFO0 has data for transmission.
#define BV_SSI_SISR_TFE0__EMPTY (0x1) //!< Transmit FIFO0 is empty.
//@}
/*! @name Register SSI_SISR, field TFE1[1] (RO)
*
* Transmit FIFO Empty 1. This flag is set when the empty slots in Tx FIFO exceed or are equal to
* the selected Tx FIFO WaterMark 1 (TFWM1) threshold and the Two-Channel mode is selected. The
* setting of TFE1 only causes an interrupt when TIE and TFE1_EN are set, Tx FIFO1 is enabled and
* Two-Channel mode is selected. The TFE1 bit is automatically cleared when the data level in Tx
* FIFO1 becomes more than the amount specified by the watermark bits. The TFE1 bit is set by POR
* and SSI reset.
*
* Values:
* - HAS_DATA = 0 - Transmit FIFO1 has data for transmission.
* - EMPTY = 1 - Transmit FIFO1 is empty.
*/
//@{
#define BP_SSI_SISR_TFE1 (1) //!< Bit position for SSI_SISR_TFE1.
#define BM_SSI_SISR_TFE1 (0x00000002) //!< Bit mask for SSI_SISR_TFE1.
//! @brief Get value of SSI_SISR_TFE1 from a register value.
#define BG_SSI_SISR_TFE1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_TFE1) >> BP_SSI_SISR_TFE1)
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SISR_TFE1_V(v) BF_SSI_SISR_TFE1(BV_SSI_SISR_TFE1__##v)
#define BV_SSI_SISR_TFE1__HAS_DATA (0x0) //!< Transmit FIFO1 has data for transmission.
#define BV_SSI_SISR_TFE1__EMPTY (0x1) //!< Transmit FIFO1 is empty.
//@}
/*! @name Register SSI_SISR, field RFF0[2] (RO)
*
* Receive FIFO Full 0. This flag is set when Rx FIFO0 is enabled and the data level in Rx FIFO0
* reaches the selected Rx FIFO WaterMark 0 (RFWM0) threshold. The setting of RFF0 only causes an
* interrupt when RIE and RFF0_EN are set and Rx FIFO0 is enabled. RFF0 is automatically cleared
* when the amount of data in Rx FIFO0 falls below the threshold. The RFF0 bit is cleared by POR and
* SSI reset. When Rx FIFO0 contains 15 words, the maximum it can hold, all further data received
* (for storage in this FIFO) is ignored until the FIFO contents are read.
*
* Values:
* - NOT_FULL = 0 - Space available in Receive FIFO0.
* - FULL = 1 - Receive FIFO0 is full.
*/
//@{
#define BP_SSI_SISR_RFF0 (2) //!< Bit position for SSI_SISR_RFF0.
#define BM_SSI_SISR_RFF0 (0x00000004) //!< Bit mask for SSI_SISR_RFF0.
//! @brief Get value of SSI_SISR_RFF0 from a register value.
#define BG_SSI_SISR_RFF0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_RFF0) >> BP_SSI_SISR_RFF0)
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SISR_RFF0_V(v) BF_SSI_SISR_RFF0(BV_SSI_SISR_RFF0__##v)
#define BV_SSI_SISR_RFF0__NOT_FULL (0x0) //!< Space available in Receive FIFO0.
#define BV_SSI_SISR_RFF0__FULL (0x1) //!< Receive FIFO0 is full.
//@}
/*! @name Register SSI_SISR, field RFF1[3] (RO)
*
* Receive FIFO Full 1. This flag is set when Rx FIFO1 is enabled, the data level in Rx FIFO1
* reaches the selected Rx FIFO WaterMark 1 (RFWM1) threshold and the SSI is in Two-Channel mode.
* The setting of RFF1 only causes an interrupt when RIE and RFF1_EN are set, Rx FIFO1 is enabled
* and the Two-Channel mode is selected. RFF1 is automatically cleared when the amount of data in Rx
* FIFO1 falls below the threshold. The RFF1 bit is cleared by POR and SSI reset. When Rx FIFO1
* contains 15 words, the maximum it can hold, all further data received (for storage in this FIFO)
* is ignored until the FIFO contents are read.
*
* Values:
* - NOT_FULL = 0 - Space available in Receive FIFO1.
* - FULL = 1 - Receive FIFO1 is full.
*/
//@{
#define BP_SSI_SISR_RFF1 (3) //!< Bit position for SSI_SISR_RFF1.
#define BM_SSI_SISR_RFF1 (0x00000008) //!< Bit mask for SSI_SISR_RFF1.
//! @brief Get value of SSI_SISR_RFF1 from a register value.
#define BG_SSI_SISR_RFF1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_RFF1) >> BP_SSI_SISR_RFF1)
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SISR_RFF1_V(v) BF_SSI_SISR_RFF1(BV_SSI_SISR_RFF1__##v)
#define BV_SSI_SISR_RFF1__NOT_FULL (0x0) //!< Space available in Receive FIFO1.
#define BV_SSI_SISR_RFF1__FULL (0x1) //!< Receive FIFO1 is full.
//@}
/*! @name Register SSI_SISR, field RLS[4] (RO)
*
* Receive Last Time Slot. This flag indicates the last time slot in a frame. When set, it indicates
* that the current time slot is the last receive time slot of the frame. RLS is set at the end of
* the last time slot and causes the SSI to issue an interrupt (if RIE and RLS_EN are set). RLS is
* cleared when the SISR is read with this bit set. The RLS bit is cleared by POR and SSI reset.
*
* Values:
* - 0 - Current time slot is not last time slot of frame.
* - 1 - Current time slot is the last receive time slot of frame.
*/
//@{
#define BP_SSI_SISR_RLS (4) //!< Bit position for SSI_SISR_RLS.
#define BM_SSI_SISR_RLS (0x00000010) //!< Bit mask for SSI_SISR_RLS.
//! @brief Get value of SSI_SISR_RLS from a register value.
#define BG_SSI_SISR_RLS(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_RLS) >> BP_SSI_SISR_RLS)
//@}
/*! @name Register SSI_SISR, field TLS[5] (RO)
*
* Transmit Last Time Slot. This flag indicates the last time slot in a frame. When set, it
* indicates that the current time slot is the last time slot of the frame. TLS is set at the start
* of the last transmit time slot and causes the SSI to issue an interrupt (if TIE and TLS_EN are
* set). TLS is not generated when frame rate is 1 in normal mode of operation. TLS is cleared when
* the SISR is read with this bit set. The TLS bit is cleared by POR and SSI reset.
*
* Values:
* - 0 - Current time slot is not last time slot of frame.
* - 1 - Current time slot is the last transmit time slot of frame.
*/
//@{
#define BP_SSI_SISR_TLS (5) //!< Bit position for SSI_SISR_TLS.
#define BM_SSI_SISR_TLS (0x00000020) //!< Bit mask for SSI_SISR_TLS.
//! @brief Get value of SSI_SISR_TLS from a register value.
#define BG_SSI_SISR_TLS(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_TLS) >> BP_SSI_SISR_TLS)
//@}
/*! @name Register SSI_SISR, field RFS[6] (RO)
*
* Receive Frame Sync. This flag indicates the occurrence of receive frame sync. In Network mode,
* the RFS bit is set when the first slot of the frame is being received. It is cleared when the
* next slot begins to be received. In Normal mode, this bit is always high (When DC = 0). This flag
* causes an interrupt if RIE and RFS_EN are set. The RFS bit is cleared by POR and SSI reset.
*
* Values:
* - 0 - No Occurrence of Receive frame sync.
* - 1 - Receive frame sync occurred during reception of next word in SRX registers.
*/
//@{
#define BP_SSI_SISR_RFS (6) //!< Bit position for SSI_SISR_RFS.
#define BM_SSI_SISR_RFS (0x00000040) //!< Bit mask for SSI_SISR_RFS.
//! @brief Get value of SSI_SISR_RFS from a register value.
#define BG_SSI_SISR_RFS(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_RFS) >> BP_SSI_SISR_RFS)
//@}
/*! @name Register SSI_SISR, field TFS[7] (RO)
*
* Transmit Frame Sync. This flag indicates the occurrence of transmit frame sync. Data written to
* the STX registers during the time slot when the TFS flag is set, is sent during the second time
* slot (in Network mode) or in the next first time slot (in Normal mode). In Network mode, the TFS
* bit is set during transmission of the first time slot of the frame and is then cleared when
* starting transmission of the next time slot. In Normal mode, this bit is high for the first time
* slot. This flag causes an interrupt if TIE and TFS_EN are set. The TFS bit is cleared by POR and
* SSI reset.
*
* Values:
* - 0 - No Occurrence of Transmit frame sync.
* - 1 - Transmit frame sync occurred during transmission of last word written to STX registers.
*/
//@{
#define BP_SSI_SISR_TFS (7) //!< Bit position for SSI_SISR_TFS.
#define BM_SSI_SISR_TFS (0x00000080) //!< Bit mask for SSI_SISR_TFS.
//! @brief Get value of SSI_SISR_TFS from a register value.
#define BG_SSI_SISR_TFS(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_TFS) >> BP_SSI_SISR_TFS)
//@}
/*! @name Register SSI_SISR, field TUE0[8] (W1C)
*
* Transmitter Underrun Error 0. This flag is set when the TXSR is empty (no data to be
* transmitted), the TDE0 flag is set and a transmit time slot occurs. When a transmit underrun
* error occurs, the previous data is retransmitted. In Network mode, each time slot requires data
* transmission (unless masked through STMSK register), when the transmitter is enabled (TE is set).
* The TUE0 flag causes an interrupt if TIE and TUE0_EN are set. The TUE0 bit is cleared by POR and
* SSI reset. It is also cleared by writing '1' to this bit.
*
* Values:
* - 0 - Default interrupt issued to the Core.
* - 1 - Exception interrupt issued to the Core.
*/
//@{
#define BP_SSI_SISR_TUE0 (8) //!< Bit position for SSI_SISR_TUE0.
#define BM_SSI_SISR_TUE0 (0x00000100) //!< Bit mask for SSI_SISR_TUE0.
//! @brief Get value of SSI_SISR_TUE0 from a register value.
#define BG_SSI_SISR_TUE0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_TUE0) >> BP_SSI_SISR_TUE0)
//! @brief Format value for bitfield SSI_SISR_TUE0.
#define BF_SSI_SISR_TUE0(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SISR_TUE0) & BM_SSI_SISR_TUE0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TUE0 field to a new value.
#define BW_SSI_SISR_TUE0(x, v) (HW_SSI_SISR_WR(x, (HW_SSI_SISR_RD(x) & ~BM_SSI_SISR_TUE0) | BF_SSI_SISR_TUE0(v)))
#endif
//@}
/*! @name Register SSI_SISR, field TUE1[9] (W1C)
*
* Transmitter Underrun Error 1. This flag is set when the TXSR is empty (no data to be
* transmitted), the TDE1 flag is set, a transmit time slot occurs and the SSI is in Two-Channel
* mode. When a transmit underrun error occurs, the previous data is retransmitted. In Network mode,
* each time slot requires data transmission (unless masked through STMSK register), when the
* transmitter is enabled (TE is set). The TUE1 flag causes an interrupt if TIE and TUE1_EN are set.
* The TUE1 bit is cleared by POR and SSI reset. It is also cleared by writing '1' to this bit.
*
* Values:
* - 0 - Default interrupt issued to the Core.
* - 1 - Exception interrupt issued to the Core.
*/
//@{
#define BP_SSI_SISR_TUE1 (9) //!< Bit position for SSI_SISR_TUE1.
#define BM_SSI_SISR_TUE1 (0x00000200) //!< Bit mask for SSI_SISR_TUE1.
//! @brief Get value of SSI_SISR_TUE1 from a register value.
#define BG_SSI_SISR_TUE1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_TUE1) >> BP_SSI_SISR_TUE1)
//! @brief Format value for bitfield SSI_SISR_TUE1.
#define BF_SSI_SISR_TUE1(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SISR_TUE1) & BM_SSI_SISR_TUE1)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TUE1 field to a new value.
#define BW_SSI_SISR_TUE1(x, v) (HW_SSI_SISR_WR(x, (HW_SSI_SISR_RD(x) & ~BM_SSI_SISR_TUE1) | BF_SSI_SISR_TUE1(v)))
#endif
//@}
/*! @name Register SSI_SISR, field ROE0[10] (W1C)
*
* Receiver Overrun Error 0. This flag is set when the RXSR is filled and ready to transfer to SRX0
* register or to Rx FIFO 0 (when enabled) and these are already full. If Rx FIFO 0 is enabled, this
* is indicated by RFF0 flag, else this is indicated by the RDR0 flag. The RXSR is not transferred
* in this case. The ROE0 flag causes an interrupt if RIE and ROE0_EN are set. The ROE0 bit is
* cleared by POR and SSI reset. It is also cleared by writing '1' to this bit. Clearing the RE bit
* does not affect the ROE0 bit.
*
* Values:
* - 0 - Default interrupt issued to the Core.
* - 1 - Exception interrupt issued to the Core.
*/
//@{
#define BP_SSI_SISR_ROE0 (10) //!< Bit position for SSI_SISR_ROE0.
#define BM_SSI_SISR_ROE0 (0x00000400) //!< Bit mask for SSI_SISR_ROE0.
//! @brief Get value of SSI_SISR_ROE0 from a register value.
#define BG_SSI_SISR_ROE0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_ROE0) >> BP_SSI_SISR_ROE0)
//! @brief Format value for bitfield SSI_SISR_ROE0.
#define BF_SSI_SISR_ROE0(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SISR_ROE0) & BM_SSI_SISR_ROE0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the ROE0 field to a new value.
#define BW_SSI_SISR_ROE0(x, v) (HW_SSI_SISR_WR(x, (HW_SSI_SISR_RD(x) & ~BM_SSI_SISR_ROE0) | BF_SSI_SISR_ROE0(v)))
#endif
//@}
/*! @name Register SSI_SISR, field ROE1[11] (W1C)
*
* Receiver Overrun Error 1. This flag is set when the RXSR is filled and ready to transfer to SRX1
* register or to Rx FIFO 1 (when enabled) and these are already full and Two-Channel mode is
* selected. If Rx FIFO 1 is enabled, this is indicated by RFF1 flag, else this is indicated by the
* RDR1 flag. The RXSR is not transferred in this case. The ROE1 flag causes an interrupt if RIE and
* ROE1_EN are set. The ROE1 bit is cleared by POR and SSI reset. It is also cleared by writing '1'
* to this bit. Clearing the RE bit does not affect the ROE1 bit.
*
* Values:
* - 0 - Default interrupt issued to the Core.
* - 1 - Exception interrupt issued to the Core.
*/
//@{
#define BP_SSI_SISR_ROE1 (11) //!< Bit position for SSI_SISR_ROE1.
#define BM_SSI_SISR_ROE1 (0x00000800) //!< Bit mask for SSI_SISR_ROE1.
//! @brief Get value of SSI_SISR_ROE1 from a register value.
#define BG_SSI_SISR_ROE1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_ROE1) >> BP_SSI_SISR_ROE1)
//! @brief Format value for bitfield SSI_SISR_ROE1.
#define BF_SSI_SISR_ROE1(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SISR_ROE1) & BM_SSI_SISR_ROE1)
#ifndef __LANGUAGE_ASM__
//! @brief Set the ROE1 field to a new value.
#define BW_SSI_SISR_ROE1(x, v) (HW_SSI_SISR_WR(x, (HW_SSI_SISR_RD(x) & ~BM_SSI_SISR_ROE1) | BF_SSI_SISR_ROE1(v)))
#endif
//@}
/*! @name Register SSI_SISR, field TDE0[12] (RO)
*
* Transmit Data Register Empty 0. This flag is set whenever data is transferred to TXSR from STX0
* register. If Tx FIFO 0 is enabled, this occurs when there is at least one empty slot in STX0 or
* Tx FIFO 0. If Tx FIFO 0 is not enabled, this occurs when the contents of STX0 are transferred to
* TXSR. The TDE0 bit is cleared when the Core writes to STX0. If TIE and TDE0_EN are set, an SSI
* Transmit Data 0 interrupt request is issued on setting of TDE0 bit. The TDE0 bit is cleared by
* POR and SSI reset.
*
* Values:
* - 0 - Data available for transmission.
* - 1 - Data needs to be written by the Core for transmission.
*/
//@{
#define BP_SSI_SISR_TDE0 (12) //!< Bit position for SSI_SISR_TDE0.
#define BM_SSI_SISR_TDE0 (0x00001000) //!< Bit mask for SSI_SISR_TDE0.
//! @brief Get value of SSI_SISR_TDE0 from a register value.
#define BG_SSI_SISR_TDE0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_TDE0) >> BP_SSI_SISR_TDE0)
//@}
/*! @name Register SSI_SISR, field TDE1[13] (RO)
*
* Transmit Data Register Empty 1. This flag is set whenever data is transferred to TXSR from STX1
* register and Two-Channel mode is selected. If Tx FIFO1 is enabled, this occurs when there is at
* least one empty slot in STX1 or Tx FIFO1. If Tx FIFO1 is not enabled, this occurs when the
* contents of STX1 are transferred to TXSR. The TDE1 bit is cleared when the Core writes to STX1.
* If TIE and TDE1_EN are set, an SSI Transmit Data 1 interrupt request is issued on setting of TDE1
* bit. The TDE1 bit is cleared by POR and SSI reset.
*
* Values:
* - 0 - Data available for transmission.
* - 1 - Data needs to be written by the Core for transmission.
*/
//@{
#define BP_SSI_SISR_TDE1 (13) //!< Bit position for SSI_SISR_TDE1.
#define BM_SSI_SISR_TDE1 (0x00002000) //!< Bit mask for SSI_SISR_TDE1.
//! @brief Get value of SSI_SISR_TDE1 from a register value.
#define BG_SSI_SISR_TDE1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_TDE1) >> BP_SSI_SISR_TDE1)
//@}
/*! @name Register SSI_SISR, field RDR0[14] (RO)
*
* Receive Data Ready 0. This flag bit is set when SRX0 or Rx FIFO 0 is loaded with a new value.
* RDR0 is cleared when the Core reads the SRX0 register. If Rx FIFO 0 is enabled, RDR0 is cleared
* when the FIFO is empty. If RIE and RDR0_EN are set, a Receive Data 0 interrupt request is issued
* on setting of RDR0 bit in case Rx FIFO0 is disabled, if the FIFO is enabled, the interrupt is
* issued on RFF0 assertion. The RDR0 bit is cleared by POR and SSI reset.
*
* Values:
* - 0 - No new data for Core to read.
* - 1 - New data for Core to read.
*/
//@{
#define BP_SSI_SISR_RDR0 (14) //!< Bit position for SSI_SISR_RDR0.
#define BM_SSI_SISR_RDR0 (0x00004000) //!< Bit mask for SSI_SISR_RDR0.
//! @brief Get value of SSI_SISR_RDR0 from a register value.
#define BG_SSI_SISR_RDR0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_RDR0) >> BP_SSI_SISR_RDR0)
//@}
/*! @name Register SSI_SISR, field RDR1[15] (RO)
*
* Receive Data Ready 1. This flag bit is set when SRX1 or Rx FIFO 1 is loaded with a new value and
* Two-Channel mode is selected. RDR1 is cleared when the Core reads the SRX1 register. If Rx FIFO 1
* is enabled, RDR1 is cleared when the FIFO is empty. If RIE and RDR1_EN are set, a Receive Data 1
* interrupt request is issued on setting of RDR1 bit in case Rx FIFO1 is disabled, if the FIFO is
* enabled, the interrupt is issued on RFF1 assertion. The RDR1 bit is cleared by POR and SSI reset.
*
* Values:
* - 0 - No new data for Core to read.
* - 1 - New data for Core to read.
*/
//@{
#define BP_SSI_SISR_RDR1 (15) //!< Bit position for SSI_SISR_RDR1.
#define BM_SSI_SISR_RDR1 (0x00008000) //!< Bit mask for SSI_SISR_RDR1.
//! @brief Get value of SSI_SISR_RDR1 from a register value.
#define BG_SSI_SISR_RDR1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_RDR1) >> BP_SSI_SISR_RDR1)
//@}
/*! @name Register SSI_SISR, field RXT[16] (RO)
*
* Receive Tag Updated. This status bit is set each time there is a difference in the previous and
* current value of the received tag. It causes the Receive Tag Interrupt (if RXT_EN bit is set).
* This bit is cleared on reading the SATAG register.
*
* Values:
* - 0 - No change in SATAG register.
* - 1 - SATAG register updated with different value.
*/
//@{
#define BP_SSI_SISR_RXT (16) //!< Bit position for SSI_SISR_RXT.
#define BM_SSI_SISR_RXT (0x00010000) //!< Bit mask for SSI_SISR_RXT.
//! @brief Get value of SSI_SISR_RXT from a register value.
#define BG_SSI_SISR_RXT(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_RXT) >> BP_SSI_SISR_RXT)
//@}
/*! @name Register SSI_SISR, field CMDDU[17] (RO)
*
* Command Data Register Updated. This bit causes the Command Data Updated interrupt (when CMDDU_EN
* bit is set). This status bit is set each time there is a difference in the previous and current
* value of the received Command Data. This bit is cleared on reading the SACDAT register.
*
* Values:
* - 0 - No change in SACDAT register.
* - 1 - SACDAT register updated with different value.
*/
//@{
#define BP_SSI_SISR_CMDDU (17) //!< Bit position for SSI_SISR_CMDDU.
#define BM_SSI_SISR_CMDDU (0x00020000) //!< Bit mask for SSI_SISR_CMDDU.
//! @brief Get value of SSI_SISR_CMDDU from a register value.
#define BG_SSI_SISR_CMDDU(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_CMDDU) >> BP_SSI_SISR_CMDDU)
//@}
/*! @name Register SSI_SISR, field CMDAU[18] (RO)
*
* Command Address Register Updated. This bit causes the Command Address Updated interrupt (when
* CMDAU_EN bit is set). This status bit is set each time there is a difference in the previous and
* current value of the received Command Address. This bit is cleared on reading the SACADD
* register.
*
* Values:
* - 0 - No change in SACADD register.
* - 1 - SACADD register updated with different value.
*/
//@{
#define BP_SSI_SISR_CMDAU (18) //!< Bit position for SSI_SISR_CMDAU.
#define BM_SSI_SISR_CMDAU (0x00040000) //!< Bit mask for SSI_SISR_CMDAU.
//! @brief Get value of SSI_SISR_CMDAU from a register value.
#define BG_SSI_SISR_CMDAU(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_CMDAU) >> BP_SSI_SISR_CMDAU)
//@}
/*! @name Register SSI_SISR, field TFRC[23] (RO)
*
* Transmit Frame Complete. This flag is set at the end of the frame during which Transmitter is
* disabled. If Transmit Frame & Clock are not disabled in the same frame, this flag is also set at
* the end of the frame in which Transmit Frame & Clock are disabled. See description of TFR_CLK_DIS
* bit for more details on how to disable Transmit Frame & Clock or keep them enabled after
* transmitter is disabled.
*
* Values:
* - 0 - End of Frame not reached
* - 1 - End of frame reached after disabling TE or disabling TFR_CLK_DIS, when transmitter is already
* disabled.
*/
//@{
#define BP_SSI_SISR_TFRC (23) //!< Bit position for SSI_SISR_TFRC.
#define BM_SSI_SISR_TFRC (0x00800000) //!< Bit mask for SSI_SISR_TFRC.
//! @brief Get value of SSI_SISR_TFRC from a register value.
#define BG_SSI_SISR_TFRC(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_TFRC) >> BP_SSI_SISR_TFRC)
//@}
/*! @name Register SSI_SISR, field RFRC[24] (RO)
*
* Receive Frame Complete. This flag is set at the end of the frame during which Receiver is
* disabled. If Receive Frame & Clock are not disabled in the same frame, this flag is also set at
* the end of the frame in which Receive Frame & Clock are disabled. See the description of
* RFR_CLK_DIS bit for more details on how to disable Receiver Frame & Clock or keep them enabled
* after receiver is disabled.
*
* Values:
* - 0 - End of Frame not reached
* - 1 - End of frame reached after disabling RE or disabling RFR_CLK_DIS, when receiver is already disabled.
*/
//@{
#define BP_SSI_SISR_RFRC (24) //!< Bit position for SSI_SISR_RFRC.
#define BM_SSI_SISR_RFRC (0x01000000) //!< Bit mask for SSI_SISR_RFRC.
//! @brief Get value of SSI_SISR_RFRC from a register value.
#define BG_SSI_SISR_RFRC(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SISR_RFRC) >> BP_SSI_SISR_RFRC)
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_SIER - SSI Interrupt Enable Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_SIER - SSI Interrupt Enable Register (RW)
*
* Reset value: 0x00003003
*
* The SSI Interrupt Enable Register (SIER) is a 25-bit register used to set up the SSI interrupts
* and DMA requests.
*/
typedef union _hw_ssi_sier
{
reg32_t U;
struct _hw_ssi_sier_bitfields
{
unsigned TFE0IE : 1; //!< [0] Transmit FIFO Empty 0 Interrupt Enable.
unsigned TFE1IE : 1; //!< [1] Transmit FIFO Empty 1 Interrupt Enable.
unsigned RFF0IE : 1; //!< [2] Receive FIFO Full 0 Interrupt Enable.
unsigned RFF1IE : 1; //!< [3] Receive FIFO Full 1 Interrupt Enable.
unsigned RLSIE : 1; //!< [4] Receive Last Time Slot Interrupt Enable.
unsigned TLSIE : 1; //!< [5] Transmit Last Time Slot Interrupt Enable.
unsigned RFSIE : 1; //!< [6] Receive Frame Sync Interrupt Enable.
unsigned TFSIE : 1; //!< [7] Transmit Frame Sync Interrupt Enable.
unsigned TUE0IE : 1; //!< [8] Transmitter Underrun Error 0 Interrupt Enable.
unsigned TUE1IE : 1; //!< [9] Transmitter Underrun Error 1 Interrupt Enable.
unsigned ROE0IE : 1; //!< [10] Receiver Overrun Error 0 Interrupt Enable.
unsigned ROE1IE : 1; //!< [11] Receiver Overrun Error 1 Interrupt Enable.
unsigned TDE0IE : 1; //!< [12] Transmit Data Register Empty 0 Interrupt Enable.
unsigned TDE1IE : 1; //!< [13] Transmit Data Register Empty 1 Interrupt Enable.
unsigned RDR0IE : 1; //!< [14] Receive Data Ready 0 Interrupt Enable.
unsigned RDR1IE : 1; //!< [15] Receive Data Ready 1 Interrupt Enable.
unsigned RXTIE : 1; //!< [16] Receive Tag Updated Interrupt Enable.
unsigned CMDDUIE : 1; //!< [17] Command Data Register Updated Interrupt Enable.
unsigned CMDAUIE : 1; //!< [18] Command Address Register Updated Interrupt Enable.
unsigned TIE : 1; //!< [19] Transmit Interrupt Enable.
unsigned TDMAE : 1; //!< [20] Transmit DMA Enable.
unsigned RIE : 1; //!< [21] Receive Interrupt Enable.
unsigned RDMAE : 1; //!< [22] Receive DMA Enable.
unsigned TFRCIE : 1; //!< [23] Transmit Frame Complete Interrupt Enable.
unsigned RFRCIE : 1; //!< [24] Receive Frame Complete Interrupt Enable.
unsigned RESERVED0 : 7; //!< [31:25] Reserved
} B;
} hw_ssi_sier_t;
#endif
/*!
* @name Constants and macros for entire SSI_SIER register
*/
//@{
#define HW_SSI_SIER_ADDR(x) (REGS_SSI_BASE(x) + 0x18)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_SIER(x) (*(volatile hw_ssi_sier_t *) HW_SSI_SIER_ADDR(x))
#define HW_SSI_SIER_RD(x) (HW_SSI_SIER(x).U)
#define HW_SSI_SIER_WR(x, v) (HW_SSI_SIER(x).U = (v))
#define HW_SSI_SIER_SET(x, v) (HW_SSI_SIER_WR(x, HW_SSI_SIER_RD(x) | (v)))
#define HW_SSI_SIER_CLR(x, v) (HW_SSI_SIER_WR(x, HW_SSI_SIER_RD(x) & ~(v)))
#define HW_SSI_SIER_TOG(x, v) (HW_SSI_SIER_WR(x, HW_SSI_SIER_RD(x) ^ (v)))
#endif
//@}
/*
* constants & macros for individual SSI_SIER bitfields
*/
/*! @name Register SSI_SIER, field TFE0IE[0] (RW)
*
* Transmit FIFO Empty 0 Interrupt Enable. Enable Bit. Controls whether the corresponding status bit
* in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_TFE0IE (0) //!< Bit position for SSI_SIER_TFE0IE.
#define BM_SSI_SIER_TFE0IE (0x00000001) //!< Bit mask for SSI_SIER_TFE0IE.
//! @brief Get value of SSI_SIER_TFE0IE from a register value.
#define BG_SSI_SIER_TFE0IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_TFE0IE) >> BP_SSI_SIER_TFE0IE)
//! @brief Format value for bitfield SSI_SIER_TFE0IE.
#define BF_SSI_SIER_TFE0IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_TFE0IE) & BM_SSI_SIER_TFE0IE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TFE0IE field to a new value.
#define BW_SSI_SIER_TFE0IE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_TFE0IE) | BF_SSI_SIER_TFE0IE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field TFE1IE[1] (RW)
*
* Transmit FIFO Empty 1 Interrupt Enable. Enable Bit. Controls whether the corresponding status bit
* in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_TFE1IE (1) //!< Bit position for SSI_SIER_TFE1IE.
#define BM_SSI_SIER_TFE1IE (0x00000002) //!< Bit mask for SSI_SIER_TFE1IE.
//! @brief Get value of SSI_SIER_TFE1IE from a register value.
#define BG_SSI_SIER_TFE1IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_TFE1IE) >> BP_SSI_SIER_TFE1IE)
//! @brief Format value for bitfield SSI_SIER_TFE1IE.
#define BF_SSI_SIER_TFE1IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_TFE1IE) & BM_SSI_SIER_TFE1IE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TFE1IE field to a new value.
#define BW_SSI_SIER_TFE1IE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_TFE1IE) | BF_SSI_SIER_TFE1IE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field RFF0IE[2] (RW)
*
* Receive FIFO Full 0 Interrupt Enable. Enable Bit. Controls whether the corresponding status bit
* in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_RFF0IE (2) //!< Bit position for SSI_SIER_RFF0IE.
#define BM_SSI_SIER_RFF0IE (0x00000004) //!< Bit mask for SSI_SIER_RFF0IE.
//! @brief Get value of SSI_SIER_RFF0IE from a register value.
#define BG_SSI_SIER_RFF0IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_RFF0IE) >> BP_SSI_SIER_RFF0IE)
//! @brief Format value for bitfield SSI_SIER_RFF0IE.
#define BF_SSI_SIER_RFF0IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_RFF0IE) & BM_SSI_SIER_RFF0IE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RFF0IE field to a new value.
#define BW_SSI_SIER_RFF0IE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_RFF0IE) | BF_SSI_SIER_RFF0IE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field RFF1IE[3] (RW)
*
* Receive FIFO Full 1 Interrupt Enable. Enable Bit. Controls whether the corresponding status bit
* in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_RFF1IE (3) //!< Bit position for SSI_SIER_RFF1IE.
#define BM_SSI_SIER_RFF1IE (0x00000008) //!< Bit mask for SSI_SIER_RFF1IE.
//! @brief Get value of SSI_SIER_RFF1IE from a register value.
#define BG_SSI_SIER_RFF1IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_RFF1IE) >> BP_SSI_SIER_RFF1IE)
//! @brief Format value for bitfield SSI_SIER_RFF1IE.
#define BF_SSI_SIER_RFF1IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_RFF1IE) & BM_SSI_SIER_RFF1IE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RFF1IE field to a new value.
#define BW_SSI_SIER_RFF1IE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_RFF1IE) | BF_SSI_SIER_RFF1IE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field RLSIE[4] (RW)
*
* Receive Last Time Slot Interrupt Enable. Enable Bit. Controls whether the corresponding status
* bit in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_RLSIE (4) //!< Bit position for SSI_SIER_RLSIE.
#define BM_SSI_SIER_RLSIE (0x00000010) //!< Bit mask for SSI_SIER_RLSIE.
//! @brief Get value of SSI_SIER_RLSIE from a register value.
#define BG_SSI_SIER_RLSIE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_RLSIE) >> BP_SSI_SIER_RLSIE)
//! @brief Format value for bitfield SSI_SIER_RLSIE.
#define BF_SSI_SIER_RLSIE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_RLSIE) & BM_SSI_SIER_RLSIE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RLSIE field to a new value.
#define BW_SSI_SIER_RLSIE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_RLSIE) | BF_SSI_SIER_RLSIE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field TLSIE[5] (RO)
*
* Transmit Last Time Slot Interrupt Enable. Enable Bit. Controls whether the corresponding status
* bit in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_TLSIE (5) //!< Bit position for SSI_SIER_TLSIE.
#define BM_SSI_SIER_TLSIE (0x00000020) //!< Bit mask for SSI_SIER_TLSIE.
//! @brief Get value of SSI_SIER_TLSIE from a register value.
#define BG_SSI_SIER_TLSIE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_TLSIE) >> BP_SSI_SIER_TLSIE)
//@}
/*! @name Register SSI_SIER, field RFSIE[6] (RW)
*
* Receive Frame Sync Interrupt Enable. Enable Bit. Controls whether the corresponding status bit in
* SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_RFSIE (6) //!< Bit position for SSI_SIER_RFSIE.
#define BM_SSI_SIER_RFSIE (0x00000040) //!< Bit mask for SSI_SIER_RFSIE.
//! @brief Get value of SSI_SIER_RFSIE from a register value.
#define BG_SSI_SIER_RFSIE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_RFSIE) >> BP_SSI_SIER_RFSIE)
//! @brief Format value for bitfield SSI_SIER_RFSIE.
#define BF_SSI_SIER_RFSIE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_RFSIE) & BM_SSI_SIER_RFSIE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RFSIE field to a new value.
#define BW_SSI_SIER_RFSIE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_RFSIE) | BF_SSI_SIER_RFSIE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field TFSIE[7] (RW)
*
* Transmit Frame Sync Interrupt Enable. Enable Bit. Controls whether the corresponding status bit
* in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_TFSIE (7) //!< Bit position for SSI_SIER_TFSIE.
#define BM_SSI_SIER_TFSIE (0x00000080) //!< Bit mask for SSI_SIER_TFSIE.
//! @brief Get value of SSI_SIER_TFSIE from a register value.
#define BG_SSI_SIER_TFSIE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_TFSIE) >> BP_SSI_SIER_TFSIE)
//! @brief Format value for bitfield SSI_SIER_TFSIE.
#define BF_SSI_SIER_TFSIE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_TFSIE) & BM_SSI_SIER_TFSIE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TFSIE field to a new value.
#define BW_SSI_SIER_TFSIE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_TFSIE) | BF_SSI_SIER_TFSIE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field TUE0IE[8] (RW)
*
* Transmitter Underrun Error 0 Interrupt Enable. Enable Bit. Controls whether the corresponding
* status bit in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_TUE0IE (8) //!< Bit position for SSI_SIER_TUE0IE.
#define BM_SSI_SIER_TUE0IE (0x00000100) //!< Bit mask for SSI_SIER_TUE0IE.
//! @brief Get value of SSI_SIER_TUE0IE from a register value.
#define BG_SSI_SIER_TUE0IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_TUE0IE) >> BP_SSI_SIER_TUE0IE)
//! @brief Format value for bitfield SSI_SIER_TUE0IE.
#define BF_SSI_SIER_TUE0IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_TUE0IE) & BM_SSI_SIER_TUE0IE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TUE0IE field to a new value.
#define BW_SSI_SIER_TUE0IE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_TUE0IE) | BF_SSI_SIER_TUE0IE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field TUE1IE[9] (RW)
*
* Transmitter Underrun Error 1 Interrupt Enable. Enable Bit. Controls whether the corresponding
* status bit in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_TUE1IE (9) //!< Bit position for SSI_SIER_TUE1IE.
#define BM_SSI_SIER_TUE1IE (0x00000200) //!< Bit mask for SSI_SIER_TUE1IE.
//! @brief Get value of SSI_SIER_TUE1IE from a register value.
#define BG_SSI_SIER_TUE1IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_TUE1IE) >> BP_SSI_SIER_TUE1IE)
//! @brief Format value for bitfield SSI_SIER_TUE1IE.
#define BF_SSI_SIER_TUE1IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_TUE1IE) & BM_SSI_SIER_TUE1IE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TUE1IE field to a new value.
#define BW_SSI_SIER_TUE1IE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_TUE1IE) | BF_SSI_SIER_TUE1IE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field ROE0IE[10] (RW)
*
* Receiver Overrun Error 0 Interrupt Enable. Enable Bit. Controls whether the corresponding status
* bit in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_ROE0IE (10) //!< Bit position for SSI_SIER_ROE0IE.
#define BM_SSI_SIER_ROE0IE (0x00000400) //!< Bit mask for SSI_SIER_ROE0IE.
//! @brief Get value of SSI_SIER_ROE0IE from a register value.
#define BG_SSI_SIER_ROE0IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_ROE0IE) >> BP_SSI_SIER_ROE0IE)
//! @brief Format value for bitfield SSI_SIER_ROE0IE.
#define BF_SSI_SIER_ROE0IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_ROE0IE) & BM_SSI_SIER_ROE0IE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the ROE0IE field to a new value.
#define BW_SSI_SIER_ROE0IE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_ROE0IE) | BF_SSI_SIER_ROE0IE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field ROE1IE[11] (RW)
*
* Receiver Overrun Error 1 Interrupt Enable. Enable Bit. Controls whether the corresponding status
* bit in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_ROE1IE (11) //!< Bit position for SSI_SIER_ROE1IE.
#define BM_SSI_SIER_ROE1IE (0x00000800) //!< Bit mask for SSI_SIER_ROE1IE.
//! @brief Get value of SSI_SIER_ROE1IE from a register value.
#define BG_SSI_SIER_ROE1IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_ROE1IE) >> BP_SSI_SIER_ROE1IE)
//! @brief Format value for bitfield SSI_SIER_ROE1IE.
#define BF_SSI_SIER_ROE1IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_ROE1IE) & BM_SSI_SIER_ROE1IE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the ROE1IE field to a new value.
#define BW_SSI_SIER_ROE1IE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_ROE1IE) | BF_SSI_SIER_ROE1IE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field TDE0IE[12] (RW)
*
* Transmit Data Register Empty 0 Interrupt Enable. Enable Bit. Controls whether the corresponding
* status bit in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_TDE0IE (12) //!< Bit position for SSI_SIER_TDE0IE.
#define BM_SSI_SIER_TDE0IE (0x00001000) //!< Bit mask for SSI_SIER_TDE0IE.
//! @brief Get value of SSI_SIER_TDE0IE from a register value.
#define BG_SSI_SIER_TDE0IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_TDE0IE) >> BP_SSI_SIER_TDE0IE)
//! @brief Format value for bitfield SSI_SIER_TDE0IE.
#define BF_SSI_SIER_TDE0IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_TDE0IE) & BM_SSI_SIER_TDE0IE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TDE0IE field to a new value.
#define BW_SSI_SIER_TDE0IE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_TDE0IE) | BF_SSI_SIER_TDE0IE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field TDE1IE[13] (RW)
*
* Transmit Data Register Empty 1 Interrupt Enable. Enable Bit. Controls whether the corresponding
* status bit in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_TDE1IE (13) //!< Bit position for SSI_SIER_TDE1IE.
#define BM_SSI_SIER_TDE1IE (0x00002000) //!< Bit mask for SSI_SIER_TDE1IE.
//! @brief Get value of SSI_SIER_TDE1IE from a register value.
#define BG_SSI_SIER_TDE1IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_TDE1IE) >> BP_SSI_SIER_TDE1IE)
//! @brief Format value for bitfield SSI_SIER_TDE1IE.
#define BF_SSI_SIER_TDE1IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_TDE1IE) & BM_SSI_SIER_TDE1IE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TDE1IE field to a new value.
#define BW_SSI_SIER_TDE1IE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_TDE1IE) | BF_SSI_SIER_TDE1IE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field RDR0IE[14] (RW)
*
* Receive Data Ready 0 Interrupt Enable. Enable Bit. Controls whether the corresponding status bit
* in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_RDR0IE (14) //!< Bit position for SSI_SIER_RDR0IE.
#define BM_SSI_SIER_RDR0IE (0x00004000) //!< Bit mask for SSI_SIER_RDR0IE.
//! @brief Get value of SSI_SIER_RDR0IE from a register value.
#define BG_SSI_SIER_RDR0IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_RDR0IE) >> BP_SSI_SIER_RDR0IE)
//! @brief Format value for bitfield SSI_SIER_RDR0IE.
#define BF_SSI_SIER_RDR0IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_RDR0IE) & BM_SSI_SIER_RDR0IE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RDR0IE field to a new value.
#define BW_SSI_SIER_RDR0IE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_RDR0IE) | BF_SSI_SIER_RDR0IE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field RDR1IE[15] (RW)
*
* Receive Data Ready 1 Interrupt Enable. Enable Bit. Controls whether the corresponding status bit
* in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_RDR1IE (15) //!< Bit position for SSI_SIER_RDR1IE.
#define BM_SSI_SIER_RDR1IE (0x00008000) //!< Bit mask for SSI_SIER_RDR1IE.
//! @brief Get value of SSI_SIER_RDR1IE from a register value.
#define BG_SSI_SIER_RDR1IE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_RDR1IE) >> BP_SSI_SIER_RDR1IE)
//! @brief Format value for bitfield SSI_SIER_RDR1IE.
#define BF_SSI_SIER_RDR1IE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_RDR1IE) & BM_SSI_SIER_RDR1IE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RDR1IE field to a new value.
#define BW_SSI_SIER_RDR1IE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_RDR1IE) | BF_SSI_SIER_RDR1IE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field RXTIE[16] (RW)
*
* Receive Tag Updated Interrupt Enable. Enable Bit. Controls whether the corresponding status bit
* in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_RXTIE (16) //!< Bit position for SSI_SIER_RXTIE.
#define BM_SSI_SIER_RXTIE (0x00010000) //!< Bit mask for SSI_SIER_RXTIE.
//! @brief Get value of SSI_SIER_RXTIE from a register value.
#define BG_SSI_SIER_RXTIE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_RXTIE) >> BP_SSI_SIER_RXTIE)
//! @brief Format value for bitfield SSI_SIER_RXTIE.
#define BF_SSI_SIER_RXTIE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_RXTIE) & BM_SSI_SIER_RXTIE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RXTIE field to a new value.
#define BW_SSI_SIER_RXTIE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_RXTIE) | BF_SSI_SIER_RXTIE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field CMDDUIE[17] (RW)
*
* Command Data Register Updated Interrupt Enable. Enable Bit. Controls whether the corresponding
* status bit in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_CMDDUIE (17) //!< Bit position for SSI_SIER_CMDDUIE.
#define BM_SSI_SIER_CMDDUIE (0x00020000) //!< Bit mask for SSI_SIER_CMDDUIE.
//! @brief Get value of SSI_SIER_CMDDUIE from a register value.
#define BG_SSI_SIER_CMDDUIE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_CMDDUIE) >> BP_SSI_SIER_CMDDUIE)
//! @brief Format value for bitfield SSI_SIER_CMDDUIE.
#define BF_SSI_SIER_CMDDUIE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_CMDDUIE) & BM_SSI_SIER_CMDDUIE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the CMDDUIE field to a new value.
#define BW_SSI_SIER_CMDDUIE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_CMDDUIE) | BF_SSI_SIER_CMDDUIE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field CMDAUIE[18] (RW)
*
* Command Address Register Updated Interrupt Enable. Enable Bit. Controls whether the corresponding
* status bit in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_CMDAUIE (18) //!< Bit position for SSI_SIER_CMDAUIE.
#define BM_SSI_SIER_CMDAUIE (0x00040000) //!< Bit mask for SSI_SIER_CMDAUIE.
//! @brief Get value of SSI_SIER_CMDAUIE from a register value.
#define BG_SSI_SIER_CMDAUIE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_CMDAUIE) >> BP_SSI_SIER_CMDAUIE)
//! @brief Format value for bitfield SSI_SIER_CMDAUIE.
#define BF_SSI_SIER_CMDAUIE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_CMDAUIE) & BM_SSI_SIER_CMDAUIE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the CMDAUIE field to a new value.
#define BW_SSI_SIER_CMDAUIE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_CMDAUIE) | BF_SSI_SIER_CMDAUIE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field TIE[19] (RW)
*
* Transmit Interrupt Enable. This control bit allows the SSI to issue transmitter data related
* interrupts to the Core. Refer to for a detailed description of this bit.
*
* Values:
* - 0 - SSI Transmitter Interrupt requests disabled.
* - 1 - SSI Transmitter Interrupt requests enabled.
*/
//@{
#define BP_SSI_SIER_TIE (19) //!< Bit position for SSI_SIER_TIE.
#define BM_SSI_SIER_TIE (0x00080000) //!< Bit mask for SSI_SIER_TIE.
//! @brief Get value of SSI_SIER_TIE from a register value.
#define BG_SSI_SIER_TIE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_TIE) >> BP_SSI_SIER_TIE)
//! @brief Format value for bitfield SSI_SIER_TIE.
#define BF_SSI_SIER_TIE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_TIE) & BM_SSI_SIER_TIE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TIE field to a new value.
#define BW_SSI_SIER_TIE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_TIE) | BF_SSI_SIER_TIE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field TDMAE[20] (RW)
*
* Transmit DMA Enable. This bit allows SSI to request for DMA transfers. When enabled, DMA requests
* are generated when any of the TFE0/1 bits in the SISR are set and if the corresponding TFEN bit
* is also set. If the corresponding FIFO is disabled, a DMA request is generated when the
* corresponding TDE bit is set.
*
* Values:
* - 0 - SSI Transmitter DMA requests disabled.
* - 1 - SSI Transmitter DMA requests enabled.
*/
//@{
#define BP_SSI_SIER_TDMAE (20) //!< Bit position for SSI_SIER_TDMAE.
#define BM_SSI_SIER_TDMAE (0x00100000) //!< Bit mask for SSI_SIER_TDMAE.
//! @brief Get value of SSI_SIER_TDMAE from a register value.
#define BG_SSI_SIER_TDMAE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_TDMAE) >> BP_SSI_SIER_TDMAE)
//! @brief Format value for bitfield SSI_SIER_TDMAE.
#define BF_SSI_SIER_TDMAE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_TDMAE) & BM_SSI_SIER_TDMAE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TDMAE field to a new value.
#define BW_SSI_SIER_TDMAE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_TDMAE) | BF_SSI_SIER_TDMAE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field RIE[21] (RW)
*
* Receive Interrupt Enable. This control bit allows the SSI to issue receiver related interrupts to
* the Core. Refer to for a detailed description of this bit.
*
* Values:
* - 0 - SSI Receiver Interrupt requests disabled.
* - 1 - SSI Receiver Interrupt requests enabled.
*/
//@{
#define BP_SSI_SIER_RIE (21) //!< Bit position for SSI_SIER_RIE.
#define BM_SSI_SIER_RIE (0x00200000) //!< Bit mask for SSI_SIER_RIE.
//! @brief Get value of SSI_SIER_RIE from a register value.
#define BG_SSI_SIER_RIE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_RIE) >> BP_SSI_SIER_RIE)
//! @brief Format value for bitfield SSI_SIER_RIE.
#define BF_SSI_SIER_RIE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_RIE) & BM_SSI_SIER_RIE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RIE field to a new value.
#define BW_SSI_SIER_RIE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_RIE) | BF_SSI_SIER_RIE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field RDMAE[22] (RW)
*
* Receive DMA Enable. This bit allows SSI to request for DMA transfers. When enabled, DMA requests
* are generated when any of the RFF0/1 bits in the SISR are set and if the corresponding RFEN bit
* is also set. If the corresponding FIFO is disabled, a DMA request is generated when the
* corresponding RDR bit is set.
*
* Values:
* - 0 - SSI Receiver DMA requests disabled.
* - 1 - SSI Receiver DMA requests enabled.
*/
//@{
#define BP_SSI_SIER_RDMAE (22) //!< Bit position for SSI_SIER_RDMAE.
#define BM_SSI_SIER_RDMAE (0x00400000) //!< Bit mask for SSI_SIER_RDMAE.
//! @brief Get value of SSI_SIER_RDMAE from a register value.
#define BG_SSI_SIER_RDMAE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_RDMAE) >> BP_SSI_SIER_RDMAE)
//! @brief Format value for bitfield SSI_SIER_RDMAE.
#define BF_SSI_SIER_RDMAE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_RDMAE) & BM_SSI_SIER_RDMAE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RDMAE field to a new value.
#define BW_SSI_SIER_RDMAE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_RDMAE) | BF_SSI_SIER_RDMAE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field TFRCIE[23] (RW)
*
* Transmit Frame Complete Interrupt Enable. Enable Bit. Controls whether the corresponding status
* bit in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_TFRCIE (23) //!< Bit position for SSI_SIER_TFRCIE.
#define BM_SSI_SIER_TFRCIE (0x00800000) //!< Bit mask for SSI_SIER_TFRCIE.
//! @brief Get value of SSI_SIER_TFRCIE from a register value.
#define BG_SSI_SIER_TFRCIE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_TFRCIE) >> BP_SSI_SIER_TFRCIE)
//! @brief Format value for bitfield SSI_SIER_TFRCIE.
#define BF_SSI_SIER_TFRCIE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_TFRCIE) & BM_SSI_SIER_TFRCIE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TFRCIE field to a new value.
#define BW_SSI_SIER_TFRCIE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_TFRCIE) | BF_SSI_SIER_TFRCIE(v)))
#endif
//@}
/*! @name Register SSI_SIER, field RFRCIE[24] (RW)
*
* Receive Frame Complete Interrupt Enable. Enable Bit. Controls whether the corresponding status
* bit in SISR can issue an interrupt to the core or not.
*
* Values:
* - 0 - Corresponding status bit cannot issue interrupt.
* - 1 - Corresponding status bit can issue interrupt.
*/
//@{
#define BP_SSI_SIER_RFRCIE (24) //!< Bit position for SSI_SIER_RFRCIE.
#define BM_SSI_SIER_RFRCIE (0x01000000) //!< Bit mask for SSI_SIER_RFRCIE.
//! @brief Get value of SSI_SIER_RFRCIE from a register value.
#define BG_SSI_SIER_RFRCIE(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SIER_RFRCIE) >> BP_SSI_SIER_RFRCIE)
//! @brief Format value for bitfield SSI_SIER_RFRCIE.
#define BF_SSI_SIER_RFRCIE(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SIER_RFRCIE) & BM_SSI_SIER_RFRCIE)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RFRCIE field to a new value.
#define BW_SSI_SIER_RFRCIE(x, v) (HW_SSI_SIER_WR(x, (HW_SSI_SIER_RD(x) & ~BM_SSI_SIER_RFRCIE) | BF_SSI_SIER_RFRCIE(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_STCR - SSI Transmit Configuration Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_STCR - SSI Transmit Configuration Register (RW)
*
* Reset value: 0x00000200
*
* The SSI Transmit Configuration Register (SSI_STCR) is a read/write control register used to
* direct the transmit operation of the STCR controls the direction of the bit clock and frame sync
* ports, STCK and STFS. Interrupt enable bit for the transmit sections is provided in this control
* register. The Power-on reset clears all SSI_STCR bits. However, SSI reset does not affect the
* SSI_STCR bits. The SSI_STCR bits are described in the following paragraphs. See the Programmable
* Registers section for the programming model of the SSI. The SSI Control Register (SSI_SCR) must
* first be set to enable interrupts. Next, the SSI interrupt bit in the Interrupt Enable Register
* (SSI_SIER) must be set to enable the interrupt. Finally, the interrupt can be enabled from within
* the
*/
typedef union _hw_ssi_stcr
{
reg32_t U;
struct _hw_ssi_stcr_bitfields
{
unsigned TEFS : 1; //!< [0] Transmit Early Frame Sync.
unsigned TFSL : 1; //!< [1] Transmit Frame Sync Length.
unsigned TFSI : 1; //!< [2] Transmit Frame Sync Invert.
unsigned TSCKP : 1; //!< [3] Transmit Clock Polarity.
unsigned TSHFD : 1; //!< [4] Transmit Shift Direction.
unsigned TXDIR : 1; //!< [5] Transmit Clock Direction.
unsigned TFDIR : 1; //!< [6] Transmit Frame Direction.
unsigned TFEN0 : 1; //!< [7] Transmit FIFO Enable 0.
unsigned TFEN1 : 1; //!< [8] Transmit FIFO Enable 1.
unsigned TXBIT0 : 1; //!< [9] Transmit Bit 0.
unsigned RESERVED0 : 22; //!< [31:10] Reserved
} B;
} hw_ssi_stcr_t;
#endif
/*!
* @name Constants and macros for entire SSI_STCR register
*/
//@{
#define HW_SSI_STCR_ADDR(x) (REGS_SSI_BASE(x) + 0x1c)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_STCR(x) (*(volatile hw_ssi_stcr_t *) HW_SSI_STCR_ADDR(x))
#define HW_SSI_STCR_RD(x) (HW_SSI_STCR(x).U)
#define HW_SSI_STCR_WR(x, v) (HW_SSI_STCR(x).U = (v))
#define HW_SSI_STCR_SET(x, v) (HW_SSI_STCR_WR(x, HW_SSI_STCR_RD(x) | (v)))
#define HW_SSI_STCR_CLR(x, v) (HW_SSI_STCR_WR(x, HW_SSI_STCR_RD(x) & ~(v)))
#define HW_SSI_STCR_TOG(x, v) (HW_SSI_STCR_WR(x, HW_SSI_STCR_RD(x) ^ (v)))
#endif
//@}
/*
* constants & macros for individual SSI_STCR bitfields
*/
/*! @name Register SSI_STCR, field TEFS[0] (RW)
*
* Transmit Early Frame Sync. This bit controls when the frame sync is initiated for the transmit
* section. The frame sync signal is deasserted after one bit-for-bit length frame sync and after
* one word-for-word length frame sync. In case of synchronous operation, the frame sync can also be
* initiated on receiving the first bit of data.
*
* Values:
* - FIRST_BIT = 0 - Transmit frame sync initiated as the first bit of data is transmitted.
* - ONE_BIT_BEFORE = 1 - Transmit frame sync is initiated one bit before the data is transmitted.
*/
//@{
#define BP_SSI_STCR_TEFS (0) //!< Bit position for SSI_STCR_TEFS.
#define BM_SSI_STCR_TEFS (0x00000001) //!< Bit mask for SSI_STCR_TEFS.
//! @brief Get value of SSI_STCR_TEFS from a register value.
#define BG_SSI_STCR_TEFS(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STCR_TEFS) >> BP_SSI_STCR_TEFS)
//! @brief Format value for bitfield SSI_STCR_TEFS.
#define BF_SSI_STCR_TEFS(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STCR_TEFS) & BM_SSI_STCR_TEFS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TEFS field to a new value.
#define BW_SSI_STCR_TEFS(x, v) (HW_SSI_STCR_WR(x, (HW_SSI_STCR_RD(x) & ~BM_SSI_STCR_TEFS) | BF_SSI_STCR_TEFS(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_STCR_TEFS_V(v) BF_SSI_STCR_TEFS(BV_SSI_STCR_TEFS__##v)
#define BV_SSI_STCR_TEFS__FIRST_BIT (0x0) //!< Transmit frame sync initiated as the first bit of data is transmitted.
#define BV_SSI_STCR_TEFS__ONE_BIT_BEFORE (0x1) //!< Transmit frame sync is initiated one bit before the data is transmitted.
//@}
/*! @name Register SSI_STCR, field TFSL[1] (RW)
*
* Transmit Frame Sync Length. This bit controls the length of the frame sync signal to be generated
* or recognized for the transmit section. The length of a word-long frame sync is same as the
* length of the data word selected by WL[3:0].
*
* Values:
* - ONE_WORD = 0 - Transmit frame sync is one-word long.
* - ONE_CLOCK_BIT = 1 - Transmit frame sync is one-clock-bit long.
*/
//@{
#define BP_SSI_STCR_TFSL (1) //!< Bit position for SSI_STCR_TFSL.
#define BM_SSI_STCR_TFSL (0x00000002) //!< Bit mask for SSI_STCR_TFSL.
//! @brief Get value of SSI_STCR_TFSL from a register value.
#define BG_SSI_STCR_TFSL(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STCR_TFSL) >> BP_SSI_STCR_TFSL)
//! @brief Format value for bitfield SSI_STCR_TFSL.
#define BF_SSI_STCR_TFSL(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STCR_TFSL) & BM_SSI_STCR_TFSL)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TFSL field to a new value.
#define BW_SSI_STCR_TFSL(x, v) (HW_SSI_STCR_WR(x, (HW_SSI_STCR_RD(x) & ~BM_SSI_STCR_TFSL) | BF_SSI_STCR_TFSL(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_STCR_TFSL_V(v) BF_SSI_STCR_TFSL(BV_SSI_STCR_TFSL__##v)
#define BV_SSI_STCR_TFSL__ONE_WORD (0x0) //!< Transmit frame sync is one-word long.
#define BV_SSI_STCR_TFSL__ONE_CLOCK_BIT (0x1) //!< Transmit frame sync is one-clock-bit long.
//@}
/*! @name Register SSI_STCR, field TFSI[2] (RW)
*
* Transmit Frame Sync Invert. This bit controls the active state of the frame sync I/O signal for
* the transmit section of SSI.
*
* Values:
* - ACTIVE_HIGH = 0 - Transmit frame sync is active high.
* - ACTIVE_LOW = 1 - Transmit frame sync is active low.
*/
//@{
#define BP_SSI_STCR_TFSI (2) //!< Bit position for SSI_STCR_TFSI.
#define BM_SSI_STCR_TFSI (0x00000004) //!< Bit mask for SSI_STCR_TFSI.
//! @brief Get value of SSI_STCR_TFSI from a register value.
#define BG_SSI_STCR_TFSI(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STCR_TFSI) >> BP_SSI_STCR_TFSI)
//! @brief Format value for bitfield SSI_STCR_TFSI.
#define BF_SSI_STCR_TFSI(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STCR_TFSI) & BM_SSI_STCR_TFSI)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TFSI field to a new value.
#define BW_SSI_STCR_TFSI(x, v) (HW_SSI_STCR_WR(x, (HW_SSI_STCR_RD(x) & ~BM_SSI_STCR_TFSI) | BF_SSI_STCR_TFSI(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_STCR_TFSI_V(v) BF_SSI_STCR_TFSI(BV_SSI_STCR_TFSI__##v)
#define BV_SSI_STCR_TFSI__ACTIVE_HIGH (0x0) //!< Transmit frame sync is active high.
#define BV_SSI_STCR_TFSI__ACTIVE_LOW (0x1) //!< Transmit frame sync is active low.
//@}
/*! @name Register SSI_STCR, field TSCKP[3] (RW)
*
* Transmit Clock Polarity. This bit controls which bit clock edge is used to clock out data for the
* transmit section. Note: TSCKP is 0 CLK_IST = 0; TSCKP is 1CLK_IST = 1
*
* Values:
* - RISING_EDGE = 0 - Data clocked out on rising edge of bit clock.
* - FALLING_EDGE = 1 - Data clocked out on falling edge of bit clock.
*/
//@{
#define BP_SSI_STCR_TSCKP (3) //!< Bit position for SSI_STCR_TSCKP.
#define BM_SSI_STCR_TSCKP (0x00000008) //!< Bit mask for SSI_STCR_TSCKP.
//! @brief Get value of SSI_STCR_TSCKP from a register value.
#define BG_SSI_STCR_TSCKP(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STCR_TSCKP) >> BP_SSI_STCR_TSCKP)
//! @brief Format value for bitfield SSI_STCR_TSCKP.
#define BF_SSI_STCR_TSCKP(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STCR_TSCKP) & BM_SSI_STCR_TSCKP)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TSCKP field to a new value.
#define BW_SSI_STCR_TSCKP(x, v) (HW_SSI_STCR_WR(x, (HW_SSI_STCR_RD(x) & ~BM_SSI_STCR_TSCKP) | BF_SSI_STCR_TSCKP(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_STCR_TSCKP_V(v) BF_SSI_STCR_TSCKP(BV_SSI_STCR_TSCKP__##v)
#define BV_SSI_STCR_TSCKP__RISING_EDGE (0x0) //!< Data clocked out on rising edge of bit clock.
#define BV_SSI_STCR_TSCKP__FALLING_EDGE (0x1) //!< Data clocked out on falling edge of bit clock.
//@}
/*! @name Register SSI_STCR, field TSHFD[4] (RW)
*
* Transmit Shift Direction. This bit controls whether the MSB or LSB will be transmitted first in a
* sample. The CODEC device labels the MSB as bit 0, whereas the Core labels the LSB as bit 0.
* Therefore, when using a standard CODEC, Core MSB (CODEC LSB) is shifted in first (TSHFD cleared).
*
* Values:
* - MSB_FIRST = 0 - Data transmitted MSB first.
* - LSB_FIRST = 1 - Data transmitted LSB first.
*/
//@{
#define BP_SSI_STCR_TSHFD (4) //!< Bit position for SSI_STCR_TSHFD.
#define BM_SSI_STCR_TSHFD (0x00000010) //!< Bit mask for SSI_STCR_TSHFD.
//! @brief Get value of SSI_STCR_TSHFD from a register value.
#define BG_SSI_STCR_TSHFD(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STCR_TSHFD) >> BP_SSI_STCR_TSHFD)
//! @brief Format value for bitfield SSI_STCR_TSHFD.
#define BF_SSI_STCR_TSHFD(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STCR_TSHFD) & BM_SSI_STCR_TSHFD)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TSHFD field to a new value.
#define BW_SSI_STCR_TSHFD(x, v) (HW_SSI_STCR_WR(x, (HW_SSI_STCR_RD(x) & ~BM_SSI_STCR_TSHFD) | BF_SSI_STCR_TSHFD(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_STCR_TSHFD_V(v) BF_SSI_STCR_TSHFD(BV_SSI_STCR_TSHFD__##v)
#define BV_SSI_STCR_TSHFD__MSB_FIRST (0x0) //!< Data transmitted MSB first.
#define BV_SSI_STCR_TSHFD__LSB_FIRST (0x1) //!< Data transmitted LSB first.
//@}
/*! @name Register SSI_STCR, field TXDIR[5] (RW)
*
* Transmit Clock Direction. This bit controls the direction and source of the clock signal used to
* clock the TXSR. Internally generated clock is output through the STCK port. External clock is
* taken from this port. Refer to for details of clock pin configurations.
*
* Values:
* - EXTERNAL = 0 - Transmit Clock is external.
* - INTERNAL = 1 - Transmit Clock generated internally.
*/
//@{
#define BP_SSI_STCR_TXDIR (5) //!< Bit position for SSI_STCR_TXDIR.
#define BM_SSI_STCR_TXDIR (0x00000020) //!< Bit mask for SSI_STCR_TXDIR.
//! @brief Get value of SSI_STCR_TXDIR from a register value.
#define BG_SSI_STCR_TXDIR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STCR_TXDIR) >> BP_SSI_STCR_TXDIR)
//! @brief Format value for bitfield SSI_STCR_TXDIR.
#define BF_SSI_STCR_TXDIR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STCR_TXDIR) & BM_SSI_STCR_TXDIR)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TXDIR field to a new value.
#define BW_SSI_STCR_TXDIR(x, v) (HW_SSI_STCR_WR(x, (HW_SSI_STCR_RD(x) & ~BM_SSI_STCR_TXDIR) | BF_SSI_STCR_TXDIR(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_STCR_TXDIR_V(v) BF_SSI_STCR_TXDIR(BV_SSI_STCR_TXDIR__##v)
#define BV_SSI_STCR_TXDIR__EXTERNAL (0x0) //!< Transmit Clock is external.
#define BV_SSI_STCR_TXDIR__INTERNAL (0x1) //!< Transmit Clock generated internally.
//@}
/*! @name Register SSI_STCR, field TFDIR[6] (RW)
*
* Transmit Frame Direction. This bit controls the direction and source of the transmit frame sync
* signal. Internally generated frame sync signal is sent out through the STFS port and external
* frame sync is taken from the same port.
*
* Values:
* - EXTERNAL = 0 - Frame Sync is external.
* - INTERNAL = 1 - Frame Sync generated internally.
*/
//@{
#define BP_SSI_STCR_TFDIR (6) //!< Bit position for SSI_STCR_TFDIR.
#define BM_SSI_STCR_TFDIR (0x00000040) //!< Bit mask for SSI_STCR_TFDIR.
//! @brief Get value of SSI_STCR_TFDIR from a register value.
#define BG_SSI_STCR_TFDIR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STCR_TFDIR) >> BP_SSI_STCR_TFDIR)
//! @brief Format value for bitfield SSI_STCR_TFDIR.
#define BF_SSI_STCR_TFDIR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STCR_TFDIR) & BM_SSI_STCR_TFDIR)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TFDIR field to a new value.
#define BW_SSI_STCR_TFDIR(x, v) (HW_SSI_STCR_WR(x, (HW_SSI_STCR_RD(x) & ~BM_SSI_STCR_TFDIR) | BF_SSI_STCR_TFDIR(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_STCR_TFDIR_V(v) BF_SSI_STCR_TFDIR(BV_SSI_STCR_TFDIR__##v)
#define BV_SSI_STCR_TFDIR__EXTERNAL (0x0) //!< Frame Sync is external.
#define BV_SSI_STCR_TFDIR__INTERNAL (0x1) //!< Frame Sync generated internally.
//@}
/*! @name Register SSI_STCR, field TFEN0[7] (RW)
*
* Transmit FIFO Enable 0. This bit enables transmit FIFO 0. When enabled, the FIFO allows 15
* samples to be transmitted by the SSI per channel (a 9th sample can be shifting out) before TDE0
* bit is set. When the FIFO is disabled, an interrupt is generated when a single sample is
* transferred to the transmit shift register (provided the interrupt is enabled).
*
* Values:
* - 0 - Transmit FIFO 0 disabled.
* - 1 - Transmit FIFO 0 enabled.
*/
//@{
#define BP_SSI_STCR_TFEN0 (7) //!< Bit position for SSI_STCR_TFEN0.
#define BM_SSI_STCR_TFEN0 (0x00000080) //!< Bit mask for SSI_STCR_TFEN0.
//! @brief Get value of SSI_STCR_TFEN0 from a register value.
#define BG_SSI_STCR_TFEN0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STCR_TFEN0) >> BP_SSI_STCR_TFEN0)
//! @brief Format value for bitfield SSI_STCR_TFEN0.
#define BF_SSI_STCR_TFEN0(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STCR_TFEN0) & BM_SSI_STCR_TFEN0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TFEN0 field to a new value.
#define BW_SSI_STCR_TFEN0(x, v) (HW_SSI_STCR_WR(x, (HW_SSI_STCR_RD(x) & ~BM_SSI_STCR_TFEN0) | BF_SSI_STCR_TFEN0(v)))
#endif
//@}
/*! @name Register SSI_STCR, field TFEN1[8] (RW)
*
* Transmit FIFO Enable 1. This bit enables transmit FIFO 1. When enabled, the FIFO allows 15
* samples to be transmitted by the SSI (per channel) (a 9th sample can be shifting out) before TDE1
* bit is set. When the FIFO is disabled, an interrupt is generated when a single sample is
* transferred to the transmit shift register (provided the interrupt is enabled).
*
* Values:
* - 0 - Transmit FIFO 1 disabled.
* - 1 - Transmit FIFO 1 enabled.
*/
//@{
#define BP_SSI_STCR_TFEN1 (8) //!< Bit position for SSI_STCR_TFEN1.
#define BM_SSI_STCR_TFEN1 (0x00000100) //!< Bit mask for SSI_STCR_TFEN1.
//! @brief Get value of SSI_STCR_TFEN1 from a register value.
#define BG_SSI_STCR_TFEN1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STCR_TFEN1) >> BP_SSI_STCR_TFEN1)
//! @brief Format value for bitfield SSI_STCR_TFEN1.
#define BF_SSI_STCR_TFEN1(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STCR_TFEN1) & BM_SSI_STCR_TFEN1)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TFEN1 field to a new value.
#define BW_SSI_STCR_TFEN1(x, v) (HW_SSI_STCR_WR(x, (HW_SSI_STCR_RD(x) & ~BM_SSI_STCR_TFEN1) | BF_SSI_STCR_TFEN1(v)))
#endif
//@}
/*! @name Register SSI_STCR, field TXBIT0[9] (RW)
*
* Transmit Bit 0. This control bit allows SSI to transmit the data word from bit position 0 or
* 15/31 in the transmit shift register. The shifting data direction can be MSB or LSB first,
* controlled by the TSHFD bit.
*
* Values:
* - MSB_ALIGNED = 0 - Shifting with respect to bit 31 (if word length = 16, 18, 20, 22 or 24) or bit 15 (if word length =
* 8, 10 or 12) of transmit shift register (MSB aligned).
* - LSB_ALIGNED = 1 - Shifting with respect to bit 0 of transmit shift register (LSB aligned).
*/
//@{
#define BP_SSI_STCR_TXBIT0 (9) //!< Bit position for SSI_STCR_TXBIT0.
#define BM_SSI_STCR_TXBIT0 (0x00000200) //!< Bit mask for SSI_STCR_TXBIT0.
//! @brief Get value of SSI_STCR_TXBIT0 from a register value.
#define BG_SSI_STCR_TXBIT0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STCR_TXBIT0) >> BP_SSI_STCR_TXBIT0)
//! @brief Format value for bitfield SSI_STCR_TXBIT0.
#define BF_SSI_STCR_TXBIT0(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STCR_TXBIT0) & BM_SSI_STCR_TXBIT0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TXBIT0 field to a new value.
#define BW_SSI_STCR_TXBIT0(x, v) (HW_SSI_STCR_WR(x, (HW_SSI_STCR_RD(x) & ~BM_SSI_STCR_TXBIT0) | BF_SSI_STCR_TXBIT0(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_STCR_TXBIT0_V(v) BF_SSI_STCR_TXBIT0(BV_SSI_STCR_TXBIT0__##v)
#define BV_SSI_STCR_TXBIT0__MSB_ALIGNED (0x0) //!< Shifting with respect to bit 31 (if word length = 16, 18, 20, 22 or 24) or bit 15 (if word length = 8, 10 or 12) of transmit shift register (MSB aligned).
#define BV_SSI_STCR_TXBIT0__LSB_ALIGNED (0x1) //!< Shifting with respect to bit 0 of transmit shift register (LSB aligned).
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_SRCR - SSI Receive Configuration Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_SRCR - SSI Receive Configuration Register (RW)
*
* Reset value: 0x00000200
*
* The SSI Receive Configuration Register (SSI_SRCR) is a read/write control register used to direct
* the receive operation of the SSI. SSI.SRCR controls the direction of the bit clock and frame sync
* ports, SRCK and SRFS. Interrupt enable bit for the transmit sections is provided in this control
* register. The Power-on reset clears all SSI_SRCR bits. However, SSI reset does not affect the
* SSI_SRCR bits.
*/
typedef union _hw_ssi_srcr
{
reg32_t U;
struct _hw_ssi_srcr_bitfields
{
unsigned REFS : 1; //!< [0] Receive Early Frame Sync.
unsigned RFSL : 1; //!< [1] Receive Frame Sync Length.
unsigned RFSI : 1; //!< [2] Receive Frame Sync Invert.
unsigned RSCKP : 1; //!< [3] Receive Clock Polarity.
unsigned RSHFD : 1; //!< [4] Receive Shift Direction.
unsigned RXDIR : 1; //!< [5] Receive Clock Direction.
unsigned RFDIR : 1; //!< [6] Receive Frame Direction.
unsigned RFEN0 : 1; //!< [7] Receive FIFO Enable 0.
unsigned RFEN1 : 1; //!< [8] Receive FIFO Enable 1.
unsigned RXBIT0 : 1; //!< [9] Receive Bit 0.
unsigned RXEXT : 1; //!< [10] Receive Data Extension.
unsigned RESERVED0 : 21; //!< [31:11] Reserved
} B;
} hw_ssi_srcr_t;
#endif
/*!
* @name Constants and macros for entire SSI_SRCR register
*/
//@{
#define HW_SSI_SRCR_ADDR(x) (REGS_SSI_BASE(x) + 0x20)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_SRCR(x) (*(volatile hw_ssi_srcr_t *) HW_SSI_SRCR_ADDR(x))
#define HW_SSI_SRCR_RD(x) (HW_SSI_SRCR(x).U)
#define HW_SSI_SRCR_WR(x, v) (HW_SSI_SRCR(x).U = (v))
#define HW_SSI_SRCR_SET(x, v) (HW_SSI_SRCR_WR(x, HW_SSI_SRCR_RD(x) | (v)))
#define HW_SSI_SRCR_CLR(x, v) (HW_SSI_SRCR_WR(x, HW_SSI_SRCR_RD(x) & ~(v)))
#define HW_SSI_SRCR_TOG(x, v) (HW_SSI_SRCR_WR(x, HW_SSI_SRCR_RD(x) ^ (v)))
#endif
//@}
/*
* constants & macros for individual SSI_SRCR bitfields
*/
/*! @name Register SSI_SRCR, field REFS[0] (RW)
*
* Receive Early Frame Sync. This bit controls when the frame sync is initiated for the receive
* section. The frame sync is disabled after one bit-for-bit length frame sync and after one word-
* for-word length frame sync.
*
* Values:
* - FIRST_BIT = 0 - Receive frame sync initiated as the first bit of data is received.
* - ONE_BIT_BEFORE = 1 - Receive frame sync is initiated one bit before the data is received.
*/
//@{
#define BP_SSI_SRCR_REFS (0) //!< Bit position for SSI_SRCR_REFS.
#define BM_SSI_SRCR_REFS (0x00000001) //!< Bit mask for SSI_SRCR_REFS.
//! @brief Get value of SSI_SRCR_REFS from a register value.
#define BG_SSI_SRCR_REFS(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRCR_REFS) >> BP_SSI_SRCR_REFS)
//! @brief Format value for bitfield SSI_SRCR_REFS.
#define BF_SSI_SRCR_REFS(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRCR_REFS) & BM_SSI_SRCR_REFS)
#ifndef __LANGUAGE_ASM__
//! @brief Set the REFS field to a new value.
#define BW_SSI_SRCR_REFS(x, v) (HW_SSI_SRCR_WR(x, (HW_SSI_SRCR_RD(x) & ~BM_SSI_SRCR_REFS) | BF_SSI_SRCR_REFS(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SRCR_REFS_V(v) BF_SSI_SRCR_REFS(BV_SSI_SRCR_REFS__##v)
#define BV_SSI_SRCR_REFS__FIRST_BIT (0x0) //!< Receive frame sync initiated as the first bit of data is received.
#define BV_SSI_SRCR_REFS__ONE_BIT_BEFORE (0x1) //!< Receive frame sync is initiated one bit before the data is received.
//@}
/*! @name Register SSI_SRCR, field RFSL[1] (RW)
*
* Receive Frame Sync Length. This bit controls the length of the frame sync signal to be generated
* or recognized for the receive section. The length of a word-long frame sync is same as the length
* of the data word selected by WL[3:0].
*
* Values:
* - ONE_WORD = 0 - Receive frame sync is one-word long.
* - ONE_CLOCK_BIT = 1 - Receive frame sync is one-clock-bit long.
*/
//@{
#define BP_SSI_SRCR_RFSL (1) //!< Bit position for SSI_SRCR_RFSL.
#define BM_SSI_SRCR_RFSL (0x00000002) //!< Bit mask for SSI_SRCR_RFSL.
//! @brief Get value of SSI_SRCR_RFSL from a register value.
#define BG_SSI_SRCR_RFSL(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRCR_RFSL) >> BP_SSI_SRCR_RFSL)
//! @brief Format value for bitfield SSI_SRCR_RFSL.
#define BF_SSI_SRCR_RFSL(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRCR_RFSL) & BM_SSI_SRCR_RFSL)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RFSL field to a new value.
#define BW_SSI_SRCR_RFSL(x, v) (HW_SSI_SRCR_WR(x, (HW_SSI_SRCR_RD(x) & ~BM_SSI_SRCR_RFSL) | BF_SSI_SRCR_RFSL(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SRCR_RFSL_V(v) BF_SSI_SRCR_RFSL(BV_SSI_SRCR_RFSL__##v)
#define BV_SSI_SRCR_RFSL__ONE_WORD (0x0) //!< Receive frame sync is one-word long.
#define BV_SSI_SRCR_RFSL__ONE_CLOCK_BIT (0x1) //!< Receive frame sync is one-clock-bit long.
//@}
/*! @name Register SSI_SRCR, field RFSI[2] (RW)
*
* Receive Frame Sync Invert. This bit controls the active state of the frame sync I/O signal for
* the receive section of SSI.
*
* Values:
* - ACTIVE_HIGH = 0 - Receive frame sync is active high.
* - ACTIVE_LOW = 1 - Receive frame sync is active low.
*/
//@{
#define BP_SSI_SRCR_RFSI (2) //!< Bit position for SSI_SRCR_RFSI.
#define BM_SSI_SRCR_RFSI (0x00000004) //!< Bit mask for SSI_SRCR_RFSI.
//! @brief Get value of SSI_SRCR_RFSI from a register value.
#define BG_SSI_SRCR_RFSI(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRCR_RFSI) >> BP_SSI_SRCR_RFSI)
//! @brief Format value for bitfield SSI_SRCR_RFSI.
#define BF_SSI_SRCR_RFSI(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRCR_RFSI) & BM_SSI_SRCR_RFSI)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RFSI field to a new value.
#define BW_SSI_SRCR_RFSI(x, v) (HW_SSI_SRCR_WR(x, (HW_SSI_SRCR_RD(x) & ~BM_SSI_SRCR_RFSI) | BF_SSI_SRCR_RFSI(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SRCR_RFSI_V(v) BF_SSI_SRCR_RFSI(BV_SSI_SRCR_RFSI__##v)
#define BV_SSI_SRCR_RFSI__ACTIVE_HIGH (0x0) //!< Receive frame sync is active high.
#define BV_SSI_SRCR_RFSI__ACTIVE_LOW (0x1) //!< Receive frame sync is active low.
//@}
/*! @name Register SSI_SRCR, field RSCKP[3] (RW)
*
* Receive Clock Polarity. This bit controls which bit clock edge is used to latch in data for the
* receive section.
*
* Values:
* - FALLING_EDGE = 0 - Data latched on falling edge of bit clock.
* - RISING_EDGE = 1 - Data latched on rising edge of bit clock.
*/
//@{
#define BP_SSI_SRCR_RSCKP (3) //!< Bit position for SSI_SRCR_RSCKP.
#define BM_SSI_SRCR_RSCKP (0x00000008) //!< Bit mask for SSI_SRCR_RSCKP.
//! @brief Get value of SSI_SRCR_RSCKP from a register value.
#define BG_SSI_SRCR_RSCKP(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRCR_RSCKP) >> BP_SSI_SRCR_RSCKP)
//! @brief Format value for bitfield SSI_SRCR_RSCKP.
#define BF_SSI_SRCR_RSCKP(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRCR_RSCKP) & BM_SSI_SRCR_RSCKP)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RSCKP field to a new value.
#define BW_SSI_SRCR_RSCKP(x, v) (HW_SSI_SRCR_WR(x, (HW_SSI_SRCR_RD(x) & ~BM_SSI_SRCR_RSCKP) | BF_SSI_SRCR_RSCKP(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SRCR_RSCKP_V(v) BF_SSI_SRCR_RSCKP(BV_SSI_SRCR_RSCKP__##v)
#define BV_SSI_SRCR_RSCKP__FALLING_EDGE (0x0) //!< Data latched on falling edge of bit clock.
#define BV_SSI_SRCR_RSCKP__RISING_EDGE (0x1) //!< Data latched on rising edge of bit clock.
//@}
/*! @name Register SSI_SRCR, field RSHFD[4] (RW)
*
* Receive Shift Direction. This bit controls whether the MSB or LSB will be received first in a
* sample. The CODEC device labels the MSB as bit 0, whereas the Core labels the LSB as bit 0.
* Therefore, when using a standard CODEC, Core MSB (CODEC LSB) is shifted in first (RSHFD cleared).
*
* Values:
* - MSB_FIRST = 0 - Data received MSB first.
* - LSB_FIRST = 1 - Data received LSB first.
*/
//@{
#define BP_SSI_SRCR_RSHFD (4) //!< Bit position for SSI_SRCR_RSHFD.
#define BM_SSI_SRCR_RSHFD (0x00000010) //!< Bit mask for SSI_SRCR_RSHFD.
//! @brief Get value of SSI_SRCR_RSHFD from a register value.
#define BG_SSI_SRCR_RSHFD(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRCR_RSHFD) >> BP_SSI_SRCR_RSHFD)
//! @brief Format value for bitfield SSI_SRCR_RSHFD.
#define BF_SSI_SRCR_RSHFD(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRCR_RSHFD) & BM_SSI_SRCR_RSHFD)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RSHFD field to a new value.
#define BW_SSI_SRCR_RSHFD(x, v) (HW_SSI_SRCR_WR(x, (HW_SSI_SRCR_RD(x) & ~BM_SSI_SRCR_RSHFD) | BF_SSI_SRCR_RSHFD(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SRCR_RSHFD_V(v) BF_SSI_SRCR_RSHFD(BV_SSI_SRCR_RSHFD__##v)
#define BV_SSI_SRCR_RSHFD__MSB_FIRST (0x0) //!< Data received MSB first.
#define BV_SSI_SRCR_RSHFD__LSB_FIRST (0x1) //!< Data received LSB first.
//@}
/*! @name Register SSI_SRCR, field RXDIR[5] (RW)
*
* Receive Clock Direction. This bit controls the direction and source of the clock signal used to
* clock the RXSR. Internally generated clock is output through the SRCK port. External clock is
* taken from this port. Refer to for details on clock pin configurations.
*
* Values:
* - EXTERNAL = 0 - Receive Clock is external.
* - INTERNAL = 1 - Receive Clock generated internally.
*/
//@{
#define BP_SSI_SRCR_RXDIR (5) //!< Bit position for SSI_SRCR_RXDIR.
#define BM_SSI_SRCR_RXDIR (0x00000020) //!< Bit mask for SSI_SRCR_RXDIR.
//! @brief Get value of SSI_SRCR_RXDIR from a register value.
#define BG_SSI_SRCR_RXDIR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRCR_RXDIR) >> BP_SSI_SRCR_RXDIR)
//! @brief Format value for bitfield SSI_SRCR_RXDIR.
#define BF_SSI_SRCR_RXDIR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRCR_RXDIR) & BM_SSI_SRCR_RXDIR)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RXDIR field to a new value.
#define BW_SSI_SRCR_RXDIR(x, v) (HW_SSI_SRCR_WR(x, (HW_SSI_SRCR_RD(x) & ~BM_SSI_SRCR_RXDIR) | BF_SSI_SRCR_RXDIR(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SRCR_RXDIR_V(v) BF_SSI_SRCR_RXDIR(BV_SSI_SRCR_RXDIR__##v)
#define BV_SSI_SRCR_RXDIR__EXTERNAL (0x0) //!< Receive Clock is external.
#define BV_SSI_SRCR_RXDIR__INTERNAL (0x1) //!< Receive Clock generated internally.
//@}
/*! @name Register SSI_SRCR, field RFDIR[6] (RW)
*
* Receive Frame Direction. This bit controls the direction and source of the receive frame sync
* signal. Internally generated frame sync signal is sent out through the SRFS port and external
* frame sync is taken from the same port.
*
* Values:
* - EXTERNAL = 0 - Frame Sync is external.
* - INTERNAL = 1 - Frame Sync generated internally.
*/
//@{
#define BP_SSI_SRCR_RFDIR (6) //!< Bit position for SSI_SRCR_RFDIR.
#define BM_SSI_SRCR_RFDIR (0x00000040) //!< Bit mask for SSI_SRCR_RFDIR.
//! @brief Get value of SSI_SRCR_RFDIR from a register value.
#define BG_SSI_SRCR_RFDIR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRCR_RFDIR) >> BP_SSI_SRCR_RFDIR)
//! @brief Format value for bitfield SSI_SRCR_RFDIR.
#define BF_SSI_SRCR_RFDIR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRCR_RFDIR) & BM_SSI_SRCR_RFDIR)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RFDIR field to a new value.
#define BW_SSI_SRCR_RFDIR(x, v) (HW_SSI_SRCR_WR(x, (HW_SSI_SRCR_RD(x) & ~BM_SSI_SRCR_RFDIR) | BF_SSI_SRCR_RFDIR(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SRCR_RFDIR_V(v) BF_SSI_SRCR_RFDIR(BV_SSI_SRCR_RFDIR__##v)
#define BV_SSI_SRCR_RFDIR__EXTERNAL (0x0) //!< Frame Sync is external.
#define BV_SSI_SRCR_RFDIR__INTERNAL (0x1) //!< Frame Sync generated internally.
//@}
/*! @name Register SSI_SRCR, field RFEN0[7] (RW)
*
* Receive FIFO Enable 0. This bit enables receive FIFO 0. When enabled, the FIFO allows 15 samples
* to be received by the SSI (per channel) (a 16th sample can be shifting in) before RDR0 bit is
* set. When the FIFO is disabled, an interrupt is generated when a single sample is received by the
* SSI (provided the interrupt is enabled).
*
* Values:
* - 0 - Receive FIFO 0 disabled.
* - 1 - Receive FIFO 0 enabled.
*/
//@{
#define BP_SSI_SRCR_RFEN0 (7) //!< Bit position for SSI_SRCR_RFEN0.
#define BM_SSI_SRCR_RFEN0 (0x00000080) //!< Bit mask for SSI_SRCR_RFEN0.
//! @brief Get value of SSI_SRCR_RFEN0 from a register value.
#define BG_SSI_SRCR_RFEN0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRCR_RFEN0) >> BP_SSI_SRCR_RFEN0)
//! @brief Format value for bitfield SSI_SRCR_RFEN0.
#define BF_SSI_SRCR_RFEN0(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRCR_RFEN0) & BM_SSI_SRCR_RFEN0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RFEN0 field to a new value.
#define BW_SSI_SRCR_RFEN0(x, v) (HW_SSI_SRCR_WR(x, (HW_SSI_SRCR_RD(x) & ~BM_SSI_SRCR_RFEN0) | BF_SSI_SRCR_RFEN0(v)))
#endif
//@}
/*! @name Register SSI_SRCR, field RFEN1[8] (RW)
*
* Receive FIFO Enable 1. This bit enables receive FIFO 1. When enabled, the FIFO allows 15 samples
* to be received by the SSI per channel (a 16th sample can be shifting in) before RDR1 bit is set.
* When the FIFO is disabled, an interrupt is generated when a single sample is received by the SSI
* (provided the interrupt is enabled).
*
* Values:
* - 0 - Receive FIFO 1 disabled.
* - 1 - Receive FIFO 1 enabled.
*/
//@{
#define BP_SSI_SRCR_RFEN1 (8) //!< Bit position for SSI_SRCR_RFEN1.
#define BM_SSI_SRCR_RFEN1 (0x00000100) //!< Bit mask for SSI_SRCR_RFEN1.
//! @brief Get value of SSI_SRCR_RFEN1 from a register value.
#define BG_SSI_SRCR_RFEN1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRCR_RFEN1) >> BP_SSI_SRCR_RFEN1)
//! @brief Format value for bitfield SSI_SRCR_RFEN1.
#define BF_SSI_SRCR_RFEN1(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRCR_RFEN1) & BM_SSI_SRCR_RFEN1)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RFEN1 field to a new value.
#define BW_SSI_SRCR_RFEN1(x, v) (HW_SSI_SRCR_WR(x, (HW_SSI_SRCR_RD(x) & ~BM_SSI_SRCR_RFEN1) | BF_SSI_SRCR_RFEN1(v)))
#endif
//@}
/*! @name Register SSI_SRCR, field RXBIT0[9] (RW)
*
* Receive Bit 0. This control bit allows SSI to receive the data word at bit position 0 or 15/31 in
* the receive shift register. The shifting data direction can be MSB or LSB first, controlled by
* the RSHFD bit.
*
* Values:
* - MSB_ALIGNED = 0 - Shifting with respect to bit 31 (if word length = 16, 18, 20, 22 or 24) or bit 15 (if word length =
* 8, 10 or 12) of receive shift register (MSB aligned).
* - LSB_ALIGNED = 1 - Shifting with respect to bit 0 of receive shift register (LSB aligned).
*/
//@{
#define BP_SSI_SRCR_RXBIT0 (9) //!< Bit position for SSI_SRCR_RXBIT0.
#define BM_SSI_SRCR_RXBIT0 (0x00000200) //!< Bit mask for SSI_SRCR_RXBIT0.
//! @brief Get value of SSI_SRCR_RXBIT0 from a register value.
#define BG_SSI_SRCR_RXBIT0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRCR_RXBIT0) >> BP_SSI_SRCR_RXBIT0)
//! @brief Format value for bitfield SSI_SRCR_RXBIT0.
#define BF_SSI_SRCR_RXBIT0(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRCR_RXBIT0) & BM_SSI_SRCR_RXBIT0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RXBIT0 field to a new value.
#define BW_SSI_SRCR_RXBIT0(x, v) (HW_SSI_SRCR_WR(x, (HW_SSI_SRCR_RD(x) & ~BM_SSI_SRCR_RXBIT0) | BF_SSI_SRCR_RXBIT0(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SRCR_RXBIT0_V(v) BF_SSI_SRCR_RXBIT0(BV_SSI_SRCR_RXBIT0__##v)
#define BV_SSI_SRCR_RXBIT0__MSB_ALIGNED (0x0) //!< Shifting with respect to bit 31 (if word length = 16, 18, 20, 22 or 24) or bit 15 (if word length = 8, 10 or 12) of receive shift register (MSB aligned).
#define BV_SSI_SRCR_RXBIT0__LSB_ALIGNED (0x1) //!< Shifting with respect to bit 0 of receive shift register (LSB aligned).
//@}
/*! @name Register SSI_SRCR, field RXEXT[10] (RW)
*
* Receive Data Extension. This control bit allows SSI to store the received data word in sign
* extended form. This bit affects data storage only in case received data is LSB aligned
* (SRCR[9]=1)
*
* Values:
* - OFF = 0 - Sign extension turned off.
* - ON = 1 - Sign extension turned on.
*/
//@{
#define BP_SSI_SRCR_RXEXT (10) //!< Bit position for SSI_SRCR_RXEXT.
#define BM_SSI_SRCR_RXEXT (0x00000400) //!< Bit mask for SSI_SRCR_RXEXT.
//! @brief Get value of SSI_SRCR_RXEXT from a register value.
#define BG_SSI_SRCR_RXEXT(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRCR_RXEXT) >> BP_SSI_SRCR_RXEXT)
//! @brief Format value for bitfield SSI_SRCR_RXEXT.
#define BF_SSI_SRCR_RXEXT(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRCR_RXEXT) & BM_SSI_SRCR_RXEXT)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RXEXT field to a new value.
#define BW_SSI_SRCR_RXEXT(x, v) (HW_SSI_SRCR_WR(x, (HW_SSI_SRCR_RD(x) & ~BM_SSI_SRCR_RXEXT) | BF_SSI_SRCR_RXEXT(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SRCR_RXEXT_V(v) BF_SSI_SRCR_RXEXT(BV_SSI_SRCR_RXEXT__##v)
#define BV_SSI_SRCR_RXEXT__OFF (0x0) //!< Sign extension turned off.
#define BV_SSI_SRCR_RXEXT__ON (0x1) //!< Sign extension turned on.
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_STCCR - SSI Transmit Clock Control Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_STCCR - SSI Transmit Clock Control Register (RW)
*
* Reset value: 0x00040000
*
* The SSI Transmit and Receive Control (SSI_STCCR and SSI_SRCCR) registers are 19-bit, read/write
* control registers used to direct the operation of the SSI. The Clock Controller Module (CCM) can
* source the SSI clock (SSI's sys clock from CCM's ssi_clk_root) from multiple sources and perform
* fractional division to support commonly used audio bit rates. The CCM can maintain the SSI's sys
* clock frequency at a constant rate even in cases where the ipg_clk (from CCM) frequency changes.
* These registers control the SSI clock generator, bit and frame sync rates, word length, and
* number of words per frame for the serial data. The SSI.STCCR register is dedicated to the
* transmit section, and the SSI_SRCCR register is dedicated to the receive section except in
* Synchronous mode, in which the SSI_STCCR register controls both the receive and transmit
* sections. Power-on reset clears all SSI_STCCR and SSI_SRCCR bits. SSI reset does not affect the
* SSI_STCCR and SSI_SRCCR bits. The control bits are described in the following paragraphs.
* Although the bit patterns of the SSI_STCCR and SSI_SRCCR registers are the same, the contents of
* these two registers can be programmed differently. SSI Data Length WL3 WL2 WL1 WL0 Number of
* Bits/Word Supported in Implementation 0 0 0 0 2 No 0 0 0 1 4 No 0 0 1 0 6 No 0 0 1 1 8 Yes 0 1 0
* 0 10 Yes 0 1 0 1 12 Yes 0 1 1 0 14 No 0 1 1 1 16 Yes 1 0 0 0 18 Yes 1 0 0 1 20 Yes 1 0 1 0 22 Yes
* 1 0 1 1 24 Yes 1 1 0 0 26 No 1 1 0 1 28 No 1 1 1 0 30 No 1 1 1 1 32 No
*/
typedef union _hw_ssi_stccr
{
reg32_t U;
struct _hw_ssi_stccr_bitfields
{
unsigned PM7_PM0 : 8; //!< [7:0] Prescaler Modulus Select.
unsigned DC4_DC0 : 5; //!< [12:8] Frame Rate Divider Control.
unsigned WL3_WL0 : 4; //!< [16:13] Word Length Control.
unsigned PSR : 1; //!< [17] Prescaler Range.
unsigned DIV2 : 1; //!< [18] Divide By 2.
unsigned RESERVED0 : 13; //!< [31:19] Reserved
} B;
} hw_ssi_stccr_t;
#endif
/*!
* @name Constants and macros for entire SSI_STCCR register
*/
//@{
#define HW_SSI_STCCR_ADDR(x) (REGS_SSI_BASE(x) + 0x24)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_STCCR(x) (*(volatile hw_ssi_stccr_t *) HW_SSI_STCCR_ADDR(x))
#define HW_SSI_STCCR_RD(x) (HW_SSI_STCCR(x).U)
#define HW_SSI_STCCR_WR(x, v) (HW_SSI_STCCR(x).U = (v))
#define HW_SSI_STCCR_SET(x, v) (HW_SSI_STCCR_WR(x, HW_SSI_STCCR_RD(x) | (v)))
#define HW_SSI_STCCR_CLR(x, v) (HW_SSI_STCCR_WR(x, HW_SSI_STCCR_RD(x) & ~(v)))
#define HW_SSI_STCCR_TOG(x, v) (HW_SSI_STCCR_WR(x, HW_SSI_STCCR_RD(x) ^ (v)))
#endif
//@}
/*
* constants & macros for individual SSI_STCCR bitfields
*/
/*! @name Register SSI_STCCR, field PM7_PM0[7:0] (RW)
*
* Prescaler Modulus Select. These bits control the prescale divider in the clock generator. This
* prescaler is used only in Internal Clock mode to divide the internal clock. The bit clock output
* is available at the clock port. A divide ratio from 1 to 256 (PM[7:0] = 0x00 to 0xFF) can be
* selected. Refer to for details regarding settings.
*/
//@{
#define BP_SSI_STCCR_PM7_PM0 (0) //!< Bit position for SSI_STCCR_PM7_PM0.
#define BM_SSI_STCCR_PM7_PM0 (0x000000ff) //!< Bit mask for SSI_STCCR_PM7_PM0.
//! @brief Get value of SSI_STCCR_PM7_PM0 from a register value.
#define BG_SSI_STCCR_PM7_PM0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STCCR_PM7_PM0) >> BP_SSI_STCCR_PM7_PM0)
//! @brief Format value for bitfield SSI_STCCR_PM7_PM0.
#define BF_SSI_STCCR_PM7_PM0(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STCCR_PM7_PM0) & BM_SSI_STCCR_PM7_PM0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PM7_PM0 field to a new value.
#define BW_SSI_STCCR_PM7_PM0(x, v) (HW_SSI_STCCR_WR(x, (HW_SSI_STCCR_RD(x) & ~BM_SSI_STCCR_PM7_PM0) | BF_SSI_STCCR_PM7_PM0(v)))
#endif
//@}
/*! @name Register SSI_STCCR, field DC4_DC0[12:8] (RW)
*
* Frame Rate Divider Control. These bits are used to control the divide ratio for the programmable
* frame rate dividers. The divide ratio works on the word clock. In Normal mode, this ratio
* determines the word transfer rate. In Network mode, this ratio sets the number of words per
* frame. The divide ratio ranges from 1 to 32 in Normal mode and from 2 to 32 in Network mode. In
* Normal mode, a divide ratio of 1 (DC=00000) provides continuous periodic data word transfer. A
* bit-length frame sync must be used in this case. These bits can be programmed with values ranging
* from "00000" to "11111" to control the number of words in a frame.
*/
//@{
#define BP_SSI_STCCR_DC4_DC0 (8) //!< Bit position for SSI_STCCR_DC4_DC0.
#define BM_SSI_STCCR_DC4_DC0 (0x00001f00) //!< Bit mask for SSI_STCCR_DC4_DC0.
//! @brief Get value of SSI_STCCR_DC4_DC0 from a register value.
#define BG_SSI_STCCR_DC4_DC0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STCCR_DC4_DC0) >> BP_SSI_STCCR_DC4_DC0)
//! @brief Format value for bitfield SSI_STCCR_DC4_DC0.
#define BF_SSI_STCCR_DC4_DC0(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STCCR_DC4_DC0) & BM_SSI_STCCR_DC4_DC0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DC4_DC0 field to a new value.
#define BW_SSI_STCCR_DC4_DC0(x, v) (HW_SSI_STCCR_WR(x, (HW_SSI_STCCR_RD(x) & ~BM_SSI_STCCR_DC4_DC0) | BF_SSI_STCCR_DC4_DC0(v)))
#endif
//@}
/*! @name Register SSI_STCCR, field WL3_WL0[16:13] (RW)
*
* Word Length Control. These bits are used to control the length of the data words being
* transferred by the SSI. These bits control the Word Length Divider in the Clock Generator. They
* also control the frame sync pulse length when the FSL bit is cleared. In I2S Master mode, the SSI
* works with a fixed word length of 32, and the WL bits are used to control the amount of valid
* data in those 32 bits. In AC97 Mode of operation, if word length is set to any value other than
* 16 bits, it will result in a word length of 20 bits.
*/
//@{
#define BP_SSI_STCCR_WL3_WL0 (13) //!< Bit position for SSI_STCCR_WL3_WL0.
#define BM_SSI_STCCR_WL3_WL0 (0x0001e000) //!< Bit mask for SSI_STCCR_WL3_WL0.
//! @brief Get value of SSI_STCCR_WL3_WL0 from a register value.
#define BG_SSI_STCCR_WL3_WL0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STCCR_WL3_WL0) >> BP_SSI_STCCR_WL3_WL0)
//! @brief Format value for bitfield SSI_STCCR_WL3_WL0.
#define BF_SSI_STCCR_WL3_WL0(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STCCR_WL3_WL0) & BM_SSI_STCCR_WL3_WL0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the WL3_WL0 field to a new value.
#define BW_SSI_STCCR_WL3_WL0(x, v) (HW_SSI_STCCR_WR(x, (HW_SSI_STCCR_RD(x) & ~BM_SSI_STCCR_WL3_WL0) | BF_SSI_STCCR_WL3_WL0(v)))
#endif
//@}
/*! @name Register SSI_STCCR, field PSR[17] (RW)
*
* Prescaler Range. This bit controls a fixed divide-by-eight prescaler in series with the variable
* prescaler. It extends the range of the prescaler for those cases where a slower bit clock is
* required. 0 Prescaler bypassed. 1 Prescaler used to divide clock by 8.
*/
//@{
#define BP_SSI_STCCR_PSR (17) //!< Bit position for SSI_STCCR_PSR.
#define BM_SSI_STCCR_PSR (0x00020000) //!< Bit mask for SSI_STCCR_PSR.
//! @brief Get value of SSI_STCCR_PSR from a register value.
#define BG_SSI_STCCR_PSR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STCCR_PSR) >> BP_SSI_STCCR_PSR)
//! @brief Format value for bitfield SSI_STCCR_PSR.
#define BF_SSI_STCCR_PSR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STCCR_PSR) & BM_SSI_STCCR_PSR)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PSR field to a new value.
#define BW_SSI_STCCR_PSR(x, v) (HW_SSI_STCCR_WR(x, (HW_SSI_STCCR_RD(x) & ~BM_SSI_STCCR_PSR) | BF_SSI_STCCR_PSR(v)))
#endif
//@}
/*! @name Register SSI_STCCR, field DIV2[18] (RW)
*
* Divide By 2. This bit controls a divide-by-two divider in series with the rest of the prescalers.
* 0 Divider bypassed. 1 Divider used to divide clock by 2.
*/
//@{
#define BP_SSI_STCCR_DIV2 (18) //!< Bit position for SSI_STCCR_DIV2.
#define BM_SSI_STCCR_DIV2 (0x00040000) //!< Bit mask for SSI_STCCR_DIV2.
//! @brief Get value of SSI_STCCR_DIV2 from a register value.
#define BG_SSI_STCCR_DIV2(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STCCR_DIV2) >> BP_SSI_STCCR_DIV2)
//! @brief Format value for bitfield SSI_STCCR_DIV2.
#define BF_SSI_STCCR_DIV2(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STCCR_DIV2) & BM_SSI_STCCR_DIV2)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DIV2 field to a new value.
#define BW_SSI_STCCR_DIV2(x, v) (HW_SSI_STCCR_WR(x, (HW_SSI_STCCR_RD(x) & ~BM_SSI_STCCR_DIV2) | BF_SSI_STCCR_DIV2(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_SRCCR - SSI Receive Clock Control Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_SRCCR - SSI Receive Clock Control Register (RW)
*
* Reset value: 0x00040000
*
* The SSI Transmit and Receive Control (SSI_STCCR and SSI_SRCCR) registers are 19-bit, read/write
* control registers used to direct the operation of the SSI. The Clock Controller Module (CCM) can
* source the SSI clock (SSI's sys clock-from CCM's ssi_clk_root) from multiple sources and perform
* fractional division to support commonly used audio bit rates. The CCM can maintain the SSI's sys
* clock frequency at a constant rate even in cases where the ipg_clk from CCM frequency changes.
* These registers control the SSI clock generator, bit and frame sync rates, word length, and
* number of words per frame for the serial data. The SSI_STCCR register is dedicated to the
* transmit section, and the SSI_SRCCR register is dedicated to the receive section except in
* Synchronous mode, in which the SSI_STCCR register controls both the receive and transmit
* sections. Power-on reset clears all SSI_STCCR and SSI_SRCCR bits. SSI reset does not affect the
* SSI_STCCR and SSI_SRCCR bits. The control bits are described in the following paragraphs.
* Although the bit patterns of the SSI_STCCR and SSI_SRCCR registers are the same, the contents of
* these two registers can be programmed differently. SSI Data Length WL3 WL2 WL1 WL0 Number of
* Bits/Word Supported in Implementation 0 0 0 0 2 No 0 0 0 1 4 No 0 0 1 0 6 No 0 0 1 1 8 Yes 0 1 0
* 0 10 Yes 0 1 0 1 12 Yes 0 1 1 0 14 No 0 1 1 1 16 Yes 1 0 0 0 18 Yes 1 0 0 1 20 Yes 1 0 1 0 22 Yes
* 1 0 1 1 24 Yes 1 1 0 0 26 No 1 1 0 1 28 No 1 1 1 0 30 No 1 1 1 1 32 No
*/
typedef union _hw_ssi_srccr
{
reg32_t U;
struct _hw_ssi_srccr_bitfields
{
unsigned PM7_PM0 : 8; //!< [7:0] Prescaler Modulus Select.
unsigned DC4_DC0 : 5; //!< [12:8] Frame Rate Divider Control.
unsigned WL3_WL0 : 4; //!< [16:13] Word Length Control.
unsigned PSR : 1; //!< [17] Prescaler Range.
unsigned DIV2 : 1; //!< [18] Divide By 2.
unsigned RESERVED0 : 13; //!< [31:19] Reserved
} B;
} hw_ssi_srccr_t;
#endif
/*!
* @name Constants and macros for entire SSI_SRCCR register
*/
//@{
#define HW_SSI_SRCCR_ADDR(x) (REGS_SSI_BASE(x) + 0x28)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_SRCCR(x) (*(volatile hw_ssi_srccr_t *) HW_SSI_SRCCR_ADDR(x))
#define HW_SSI_SRCCR_RD(x) (HW_SSI_SRCCR(x).U)
#define HW_SSI_SRCCR_WR(x, v) (HW_SSI_SRCCR(x).U = (v))
#define HW_SSI_SRCCR_SET(x, v) (HW_SSI_SRCCR_WR(x, HW_SSI_SRCCR_RD(x) | (v)))
#define HW_SSI_SRCCR_CLR(x, v) (HW_SSI_SRCCR_WR(x, HW_SSI_SRCCR_RD(x) & ~(v)))
#define HW_SSI_SRCCR_TOG(x, v) (HW_SSI_SRCCR_WR(x, HW_SSI_SRCCR_RD(x) ^ (v)))
#endif
//@}
/*
* constants & macros for individual SSI_SRCCR bitfields
*/
/*! @name Register SSI_SRCCR, field PM7_PM0[7:0] (RW)
*
* Prescaler Modulus Select. These bits control the prescale divider in the clock generator. This
* prescaler is used only in Internal Clock mode to divide the internal clock. The bit clock output
* is available at the clock port. A divide ratio from 1 to 256 (PM[7:0] = 0x00 to 0xFF) can be
* selected. Refer to for details regarding settings.
*/
//@{
#define BP_SSI_SRCCR_PM7_PM0 (0) //!< Bit position for SSI_SRCCR_PM7_PM0.
#define BM_SSI_SRCCR_PM7_PM0 (0x000000ff) //!< Bit mask for SSI_SRCCR_PM7_PM0.
//! @brief Get value of SSI_SRCCR_PM7_PM0 from a register value.
#define BG_SSI_SRCCR_PM7_PM0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRCCR_PM7_PM0) >> BP_SSI_SRCCR_PM7_PM0)
//! @brief Format value for bitfield SSI_SRCCR_PM7_PM0.
#define BF_SSI_SRCCR_PM7_PM0(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRCCR_PM7_PM0) & BM_SSI_SRCCR_PM7_PM0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PM7_PM0 field to a new value.
#define BW_SSI_SRCCR_PM7_PM0(x, v) (HW_SSI_SRCCR_WR(x, (HW_SSI_SRCCR_RD(x) & ~BM_SSI_SRCCR_PM7_PM0) | BF_SSI_SRCCR_PM7_PM0(v)))
#endif
//@}
/*! @name Register SSI_SRCCR, field DC4_DC0[12:8] (RW)
*
* Frame Rate Divider Control. These bits are used to control the divide ratio for the programmable
* frame rate dividers. The divide ratio works on the word clock. In Normal mode, this ratio
* determines the word transfer rate. In Network mode, this ratio sets the number of words per
* frame. The divide ratio ranges from 1 to 32 in Normal mode and from 2 to 32 in Network mode. In
* Normal mode, a divide ratio of 1 (DC=00000) provides continuous periodic data word transfer. A
* bit-length frame sync must be used in this case. These bits can be programmed with values ranging
* from "00000" to "11111" to control the number of words in a frame.
*/
//@{
#define BP_SSI_SRCCR_DC4_DC0 (8) //!< Bit position for SSI_SRCCR_DC4_DC0.
#define BM_SSI_SRCCR_DC4_DC0 (0x00001f00) //!< Bit mask for SSI_SRCCR_DC4_DC0.
//! @brief Get value of SSI_SRCCR_DC4_DC0 from a register value.
#define BG_SSI_SRCCR_DC4_DC0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRCCR_DC4_DC0) >> BP_SSI_SRCCR_DC4_DC0)
//! @brief Format value for bitfield SSI_SRCCR_DC4_DC0.
#define BF_SSI_SRCCR_DC4_DC0(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRCCR_DC4_DC0) & BM_SSI_SRCCR_DC4_DC0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DC4_DC0 field to a new value.
#define BW_SSI_SRCCR_DC4_DC0(x, v) (HW_SSI_SRCCR_WR(x, (HW_SSI_SRCCR_RD(x) & ~BM_SSI_SRCCR_DC4_DC0) | BF_SSI_SRCCR_DC4_DC0(v)))
#endif
//@}
/*! @name Register SSI_SRCCR, field WL3_WL0[16:13] (RW)
*
* Word Length Control. These bits are used to control the length of the data words being
* transferred by the SSI. These bits control the Word Length Divider in the Clock Generator. They
* also control the frame sync pulse length when the FSL bit is cleared. In I2S Master mode, the SSI
* works with a fixed word length of 32, and the WL bits are used to control the amount of valid
* data in those 32 bits. In AC97 Mode of operation, if word length is set to any value other than
* 16 bits, it will result in a word length of 20 bits.
*/
//@{
#define BP_SSI_SRCCR_WL3_WL0 (13) //!< Bit position for SSI_SRCCR_WL3_WL0.
#define BM_SSI_SRCCR_WL3_WL0 (0x0001e000) //!< Bit mask for SSI_SRCCR_WL3_WL0.
//! @brief Get value of SSI_SRCCR_WL3_WL0 from a register value.
#define BG_SSI_SRCCR_WL3_WL0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRCCR_WL3_WL0) >> BP_SSI_SRCCR_WL3_WL0)
//! @brief Format value for bitfield SSI_SRCCR_WL3_WL0.
#define BF_SSI_SRCCR_WL3_WL0(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRCCR_WL3_WL0) & BM_SSI_SRCCR_WL3_WL0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the WL3_WL0 field to a new value.
#define BW_SSI_SRCCR_WL3_WL0(x, v) (HW_SSI_SRCCR_WR(x, (HW_SSI_SRCCR_RD(x) & ~BM_SSI_SRCCR_WL3_WL0) | BF_SSI_SRCCR_WL3_WL0(v)))
#endif
//@}
/*! @name Register SSI_SRCCR, field PSR[17] (RW)
*
* Prescaler Range. This bit controls a fixed divide-by-eight prescaler in series with the variable
* prescaler. It extends the range of the prescaler for those cases where a slower bit clock is
* required. 0 Prescaler bypassed. 1 Prescaler used to divide clock by 8.
*/
//@{
#define BP_SSI_SRCCR_PSR (17) //!< Bit position for SSI_SRCCR_PSR.
#define BM_SSI_SRCCR_PSR (0x00020000) //!< Bit mask for SSI_SRCCR_PSR.
//! @brief Get value of SSI_SRCCR_PSR from a register value.
#define BG_SSI_SRCCR_PSR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRCCR_PSR) >> BP_SSI_SRCCR_PSR)
//! @brief Format value for bitfield SSI_SRCCR_PSR.
#define BF_SSI_SRCCR_PSR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRCCR_PSR) & BM_SSI_SRCCR_PSR)
#ifndef __LANGUAGE_ASM__
//! @brief Set the PSR field to a new value.
#define BW_SSI_SRCCR_PSR(x, v) (HW_SSI_SRCCR_WR(x, (HW_SSI_SRCCR_RD(x) & ~BM_SSI_SRCCR_PSR) | BF_SSI_SRCCR_PSR(v)))
#endif
//@}
/*! @name Register SSI_SRCCR, field DIV2[18] (RW)
*
* Divide By 2. This bit controls a divide-by-two divider in series with the rest of the prescalers.
* 0 Divider bypassed. 1 Divider used to divide clock by 2.
*/
//@{
#define BP_SSI_SRCCR_DIV2 (18) //!< Bit position for SSI_SRCCR_DIV2.
#define BM_SSI_SRCCR_DIV2 (0x00040000) //!< Bit mask for SSI_SRCCR_DIV2.
//! @brief Get value of SSI_SRCCR_DIV2 from a register value.
#define BG_SSI_SRCCR_DIV2(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRCCR_DIV2) >> BP_SSI_SRCCR_DIV2)
//! @brief Format value for bitfield SSI_SRCCR_DIV2.
#define BF_SSI_SRCCR_DIV2(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRCCR_DIV2) & BM_SSI_SRCCR_DIV2)
#ifndef __LANGUAGE_ASM__
//! @brief Set the DIV2 field to a new value.
#define BW_SSI_SRCCR_DIV2(x, v) (HW_SSI_SRCCR_WR(x, (HW_SSI_SRCCR_RD(x) & ~BM_SSI_SRCCR_DIV2) | BF_SSI_SRCCR_DIV2(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_SFCSR - SSI FIFO Control/Status Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_SFCSR - SSI FIFO Control/Status Register (RW)
*
* Reset value: 0x00810081
*
* The SSI FIFO Control / Status Register indicates the status of the Transmit FIFO Empty flag, with
* different settings of the Transmit FIFO WaterMark bits and varying amounts of data in the Tx FIFO
* . Status of Transmit FIFO Empty Flag Transmit FIFO Watermark (TFWM) Number of data in Tx-Fifo 1 2
* 3 4 5 6 7 8 9 10 11 12 13 14 15 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 2 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 3
* 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 4 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 5 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 6 1
* 1 1 1 1 1 1 1 1 0 0 0 0 0 0 7 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 8 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 9 1 1
* 1 1 1 1 0 0 0 0 0 0 0 0 0 10 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 11 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 12 1
* 1 1 0 0 0 0 0 0 0 0 0 0 0 0 13 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 14 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 15
* 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
*/
typedef union _hw_ssi_sfcsr
{
reg32_t U;
struct _hw_ssi_sfcsr_bitfields
{
unsigned TFWM0 : 4; //!< [3:0] Transmit FIFO Empty WaterMark 0.
unsigned RFWM0 : 4; //!< [7:4] Receive FIFO Full WaterMark 0.
unsigned TFCNT0 : 4; //!< [11:8] Transmit FIFO Counter 0.
unsigned RFCNT0 : 4; //!< [15:12] Receive FIFO Counter 0.
unsigned TFWM1 : 4; //!< [19:16] Transmit FIFO Empty WaterMark 1.
unsigned RFWM1 : 4; //!< [23:20] Receive FIFO Full WaterMark 1.
unsigned TFCNT1 : 4; //!< [27:24] Transmit FIFO Counter1.
unsigned RFCNT1 : 4; //!< [31:28] Receive FIFO Counter1.
} B;
} hw_ssi_sfcsr_t;
#endif
/*!
* @name Constants and macros for entire SSI_SFCSR register
*/
//@{
#define HW_SSI_SFCSR_ADDR(x) (REGS_SSI_BASE(x) + 0x2c)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_SFCSR(x) (*(volatile hw_ssi_sfcsr_t *) HW_SSI_SFCSR_ADDR(x))
#define HW_SSI_SFCSR_RD(x) (HW_SSI_SFCSR(x).U)
#define HW_SSI_SFCSR_WR(x, v) (HW_SSI_SFCSR(x).U = (v))
#define HW_SSI_SFCSR_SET(x, v) (HW_SSI_SFCSR_WR(x, HW_SSI_SFCSR_RD(x) | (v)))
#define HW_SSI_SFCSR_CLR(x, v) (HW_SSI_SFCSR_WR(x, HW_SSI_SFCSR_RD(x) & ~(v)))
#define HW_SSI_SFCSR_TOG(x, v) (HW_SSI_SFCSR_WR(x, HW_SSI_SFCSR_RD(x) ^ (v)))
#endif
//@}
/*
* constants & macros for individual SSI_SFCSR bitfields
*/
/*! @name Register SSI_SFCSR, field TFWM0[3:0] (RW)
*
* Transmit FIFO Empty WaterMark 0. These bits control the threshold at which the TFE0 flag will be
* set. The TFE0 flag is set whenever the empty slots in Tx FIFO exceed or are equal to the selected
* threshold. See SSI_SFCSR_bf4 for details regarding settings for transmit FIFO watermark bits.
*/
//@{
#define BP_SSI_SFCSR_TFWM0 (0) //!< Bit position for SSI_SFCSR_TFWM0.
#define BM_SSI_SFCSR_TFWM0 (0x0000000f) //!< Bit mask for SSI_SFCSR_TFWM0.
//! @brief Get value of SSI_SFCSR_TFWM0 from a register value.
#define BG_SSI_SFCSR_TFWM0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SFCSR_TFWM0) >> BP_SSI_SFCSR_TFWM0)
//! @brief Format value for bitfield SSI_SFCSR_TFWM0.
#define BF_SSI_SFCSR_TFWM0(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SFCSR_TFWM0) & BM_SSI_SFCSR_TFWM0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TFWM0 field to a new value.
#define BW_SSI_SFCSR_TFWM0(x, v) (HW_SSI_SFCSR_WR(x, (HW_SSI_SFCSR_RD(x) & ~BM_SSI_SFCSR_TFWM0) | BF_SSI_SFCSR_TFWM0(v)))
#endif
//@}
/*! @name Register SSI_SFCSR, field RFWM0[7:4] (RW)
*
* Receive FIFO Full WaterMark 0. These bits control the threshold at which the RFF0 flag will be
* set. The RFF0 flag is set whenever the data level in Rx FIFO 0 reaches the selected threshold.
* See SSI_SFCSR_bf3 for details regarding settings for receive FIFO watermark bits.
*/
//@{
#define BP_SSI_SFCSR_RFWM0 (4) //!< Bit position for SSI_SFCSR_RFWM0.
#define BM_SSI_SFCSR_RFWM0 (0x000000f0) //!< Bit mask for SSI_SFCSR_RFWM0.
//! @brief Get value of SSI_SFCSR_RFWM0 from a register value.
#define BG_SSI_SFCSR_RFWM0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SFCSR_RFWM0) >> BP_SSI_SFCSR_RFWM0)
//! @brief Format value for bitfield SSI_SFCSR_RFWM0.
#define BF_SSI_SFCSR_RFWM0(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SFCSR_RFWM0) & BM_SSI_SFCSR_RFWM0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RFWM0 field to a new value.
#define BW_SSI_SFCSR_RFWM0(x, v) (HW_SSI_SFCSR_WR(x, (HW_SSI_SFCSR_RD(x) & ~BM_SSI_SFCSR_RFWM0) | BF_SSI_SFCSR_RFWM0(v)))
#endif
//@}
/*! @name Register SSI_SFCSR, field TFCNT0[11:8] (RW)
*
* Transmit FIFO Counter 0. These bits indicate the number of data words in Transmit FIFO 0. See
* SSI_SFCSR_bf2 for details regarding settings for transmit FIFO counter bits.
*/
//@{
#define BP_SSI_SFCSR_TFCNT0 (8) //!< Bit position for SSI_SFCSR_TFCNT0.
#define BM_SSI_SFCSR_TFCNT0 (0x00000f00) //!< Bit mask for SSI_SFCSR_TFCNT0.
//! @brief Get value of SSI_SFCSR_TFCNT0 from a register value.
#define BG_SSI_SFCSR_TFCNT0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SFCSR_TFCNT0) >> BP_SSI_SFCSR_TFCNT0)
//! @brief Format value for bitfield SSI_SFCSR_TFCNT0.
#define BF_SSI_SFCSR_TFCNT0(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SFCSR_TFCNT0) & BM_SSI_SFCSR_TFCNT0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TFCNT0 field to a new value.
#define BW_SSI_SFCSR_TFCNT0(x, v) (HW_SSI_SFCSR_WR(x, (HW_SSI_SFCSR_RD(x) & ~BM_SSI_SFCSR_TFCNT0) | BF_SSI_SFCSR_TFCNT0(v)))
#endif
//@}
/*! @name Register SSI_SFCSR, field RFCNT0[15:12] (RW)
*
* Receive FIFO Counter 0. These bits indicate the number of data words in Receive FIFO 0. See
* SSI_SFCSR_bf1 for details regarding settings for receive FIFO counter bits.
*/
//@{
#define BP_SSI_SFCSR_RFCNT0 (12) //!< Bit position for SSI_SFCSR_RFCNT0.
#define BM_SSI_SFCSR_RFCNT0 (0x0000f000) //!< Bit mask for SSI_SFCSR_RFCNT0.
//! @brief Get value of SSI_SFCSR_RFCNT0 from a register value.
#define BG_SSI_SFCSR_RFCNT0(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SFCSR_RFCNT0) >> BP_SSI_SFCSR_RFCNT0)
//! @brief Format value for bitfield SSI_SFCSR_RFCNT0.
#define BF_SSI_SFCSR_RFCNT0(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SFCSR_RFCNT0) & BM_SSI_SFCSR_RFCNT0)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RFCNT0 field to a new value.
#define BW_SSI_SFCSR_RFCNT0(x, v) (HW_SSI_SFCSR_WR(x, (HW_SSI_SFCSR_RD(x) & ~BM_SSI_SFCSR_RFCNT0) | BF_SSI_SFCSR_RFCNT0(v)))
#endif
//@}
/*! @name Register SSI_SFCSR, field TFWM1[19:16] (RW)
*
* Transmit FIFO Empty WaterMark 1. These bits control the threshold at which the TFE1 flag will be
* set. The TFE1 flag is set whenever the empty slots in Tx FIFO exceed or are equal to the selected
* threshold.
*
* Values:
* - 0000 - Reserved
* - 0001 - TFE set when there are more than or equal to 1 empty slots in Transmit FIFO (default). Transmit FIFO
* empty is set when TxFIFO <= 14 data.
* - 0010 - TFE set when there are more than or equal to 2 empty slots in Transmit FIFO. Transmit FIFO empty is
* set when TxFIFO <= 13 data.
* - 0011 - TFE set when there are more than or equal to 3 empty slots in Transmit FIFO. Transmit FIFO empty is
* set when TxFIFO <= 12 data.
* - 0100 - TFE set when there are more than or equal to 4 empty slots in Transmit FIFO. Transmit FIFO empty is
* set when TxFIFO <= 11 data.
* - 0101 - TFE set when there are more than or equal to 5 empty slots in Transmit FIFO. Transmit FIFO empty is
* set when TxFIFO <= 10 data.
* - 0110 - TFE set when there are more than or equal to 6 empty slots in Transmit FIFO. Transmit FIFO empty is
* set when TxFIFO <= 9 data.
* - 0111 - TFE set when there are more than or equal to 7 empty slots in Transmit FIFO. Transmit FIFO empty is
* set when TxFIFO <= 8 data.
* - 1000 - TFE set when there are more than or equal to 8 empty slots in Transmit FIFO. Transmit FIFO empty is
* set when TxFIFO <= 7 data.
* - 1001 - TFE set when there are more than or equal to 9 empty slots in Transmit FIFO. Transmit FIFO empty is
* set when TxFIFO <= 6 data.
* - 1010 - TFE set when there are more than or equal to 10 empty slots in Transmit FIFO. Transmit FIFO empty is
* set when TxFIFO <= 5 data.
* - 1011 - TFE set when there are more than or equal to 11 empty slots in Transmit FIFO. Transmit FIFO empty is
* set when TxFIFO <= 4 data.
* - 1100 - TFE set when there are more than or equal to 12 empty slots in Transmit FIFO. Transmit FIFO empty is
* set when TxFIFO <= 3 data.
* - 1101 - TFE set when there are more than or equal to 13 empty slots in Transmit FIFO. Transmit FIFO empty is
* set when TxFIFO <= 2 data.
* - 1110 - TFE set when there are more than or equal to 14 empty slots in Transmit FIFO. Transmit FIFO empty is
* set when TxFIFO <= 1 data.
* - 1111 - TFE set when there are 15 empty slots in Transmit FIFO. Transmit FIFO empty is set when TxFIFO = 0
* data.
*/
//@{
#define BP_SSI_SFCSR_TFWM1 (16) //!< Bit position for SSI_SFCSR_TFWM1.
#define BM_SSI_SFCSR_TFWM1 (0x000f0000) //!< Bit mask for SSI_SFCSR_TFWM1.
//! @brief Get value of SSI_SFCSR_TFWM1 from a register value.
#define BG_SSI_SFCSR_TFWM1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SFCSR_TFWM1) >> BP_SSI_SFCSR_TFWM1)
//! @brief Format value for bitfield SSI_SFCSR_TFWM1.
#define BF_SSI_SFCSR_TFWM1(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SFCSR_TFWM1) & BM_SSI_SFCSR_TFWM1)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TFWM1 field to a new value.
#define BW_SSI_SFCSR_TFWM1(x, v) (HW_SSI_SFCSR_WR(x, (HW_SSI_SFCSR_RD(x) & ~BM_SSI_SFCSR_TFWM1) | BF_SSI_SFCSR_TFWM1(v)))
#endif
//@}
/*! @name Register SSI_SFCSR, field RFWM1[23:20] (RW)
*
* Receive FIFO Full WaterMark 1. These bits control the threshold at which the RFF1 flag will be
* set. The RFF1 flag is set whenever the data level in Rx FIFO 1 reaches the selected threshold.
*
* Values:
* - 0000 - Reserved
* - 0001 - RFF set when at least one data word has been written to the Receive FIFO. Set when RxFIFO = 1,2.....
* 15 data words
* - 0010 - RFF set when 2 or more data words have been written to the Receive FIFO. Set when RxFIFO = 2,3.....
* 15 data words
* - 0011 - RFF set when 3 or more data words have been written to the Receive FIFO. Set when RxFIFO = 3,4.....
* 15 data words
* - 0100 - RFF set when 4 or more data words have been written to the Receive FIFO. Set when RxFIFO = 4,5.....
* 15 data words
* - 0101 - RFF set when 5 or more data words have been written to the Receive FIFO. Set when RxFIFO = 5,6.....
* 15 data words
* - 0110 - RFF set when 6 or more data words have been written to the Receive.. Set when RxFIFO = 6,7 ......15
* data words
* - 0111 - RFF set when 7 or more data words have been written to the Receive FIFO. Set when RxFIFO = 7,8
* ......15 data words
* - 1000 - RFF set when 8 or more data words have been written to the Receive FIFO. Set when RxFIFO = 8,9.....
* 15 data words
* - 1001 - RFF set when 9 or more data words have been written to the Receive FIFO. Set when RxFIFO =
* 9,10.....15 data words
* - 1010 - RFF set when 10 or more data words have been written to the Receive FIFO. Set when RxFIFO =
* 10,11.....15 data words
* - 1011 - RFF set when 11 or more data words have been written to the Receive FIFO. Set when RxFIFO =
* 11,12.....15 data words
* - 1100 - RFF set when 12 or more data words have been written to the Receive FIFO. Set when RxFIFO =
* 12,13.....15 data words
* - 1101 - RFF set when 13 or more data words have been written to the Receive FIFO. Set when RxFIFO =
* 13,14,15data words
* - 1110 - RFF set when 14 or more data words have been written to the Receive FIFO. Set when RxFIFO = 14,15
* data words
* - 1111 - RFF set when 15 data words have been written to the Receive FIFO (default). Set when RxFIFO = 15
* data words
*/
//@{
#define BP_SSI_SFCSR_RFWM1 (20) //!< Bit position for SSI_SFCSR_RFWM1.
#define BM_SSI_SFCSR_RFWM1 (0x00f00000) //!< Bit mask for SSI_SFCSR_RFWM1.
//! @brief Get value of SSI_SFCSR_RFWM1 from a register value.
#define BG_SSI_SFCSR_RFWM1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SFCSR_RFWM1) >> BP_SSI_SFCSR_RFWM1)
//! @brief Format value for bitfield SSI_SFCSR_RFWM1.
#define BF_SSI_SFCSR_RFWM1(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SFCSR_RFWM1) & BM_SSI_SFCSR_RFWM1)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RFWM1 field to a new value.
#define BW_SSI_SFCSR_RFWM1(x, v) (HW_SSI_SFCSR_WR(x, (HW_SSI_SFCSR_RD(x) & ~BM_SSI_SFCSR_RFWM1) | BF_SSI_SFCSR_RFWM1(v)))
#endif
//@}
/*! @name Register SSI_SFCSR, field TFCNT1[27:24] (RW)
*
* Transmit FIFO Counter1. These bits indicate the number of data words in Transmit FIFO.
*
* Values:
* - 0000 - 0 data word in transmit FIFO
* - 0001 - 1 data word in transmit FIFO
* - 0010 - 2 data word in transmit FIFO
* - 0011 - 3 data word in transmit FIFO
* - 0100 - 4 data word in transmit FIFO
* - 0101 - 5 data word in transmit FIFO
* - 0110 - 6 data word in transmit FIFO
* - 0111 - 7 data word in transmit FIFO
* - 1000 - 8 data word in transmit FIFO
* - 1001 - 9 data word in transmit FIFO
* - 1010 - 10 data word in transmit FIFO
* - 1011 - 11 data word in transmit FIFO
* - 1100 - 12 data word in transmit FIFO
* - 1101 - 13 data word in transmit FIFO
* - 1110 - 14 data word in transmit FIFO
* - 1111 - 15 data word in transmit FIFO
*/
//@{
#define BP_SSI_SFCSR_TFCNT1 (24) //!< Bit position for SSI_SFCSR_TFCNT1.
#define BM_SSI_SFCSR_TFCNT1 (0x0f000000) //!< Bit mask for SSI_SFCSR_TFCNT1.
//! @brief Get value of SSI_SFCSR_TFCNT1 from a register value.
#define BG_SSI_SFCSR_TFCNT1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SFCSR_TFCNT1) >> BP_SSI_SFCSR_TFCNT1)
//! @brief Format value for bitfield SSI_SFCSR_TFCNT1.
#define BF_SSI_SFCSR_TFCNT1(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SFCSR_TFCNT1) & BM_SSI_SFCSR_TFCNT1)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TFCNT1 field to a new value.
#define BW_SSI_SFCSR_TFCNT1(x, v) (HW_SSI_SFCSR_WR(x, (HW_SSI_SFCSR_RD(x) & ~BM_SSI_SFCSR_TFCNT1) | BF_SSI_SFCSR_TFCNT1(v)))
#endif
//@}
/*! @name Register SSI_SFCSR, field RFCNT1[31:28] (RW)
*
* Receive FIFO Counter1. These bits indicate the number of data words in Receive FIFO 1.
*
* Values:
* - 0000 - 0 data word in receive FIFO
* - 0001 - 1 data word in receive FIFO
* - 0010 - 2 data word in receive FIFO
* - 0011 - 3 data word in receive FIFO
* - 0100 - 4 data word in receive FIFO
* - 0101 - 5 data word in receive FIFO
* - 0110 - 6 data word in receive FIFO
* - 0111 - 7 data word in receive FIFO
* - 1000 - 8 data word in receive FIFO
* - 1001 - 9 data word in receive FIFO
* - 1010 - 10 data word in receive FIFO
* - 1011 - 11 data word in receive FIFO
* - 1100 - 12 data word in receive FIFO
* - 1101 - 13 data word in receive FIFO
* - 1110 - 14 data word in receive FIFO
* - 1111 - 15 data word in receive FIFO
*/
//@{
#define BP_SSI_SFCSR_RFCNT1 (28) //!< Bit position for SSI_SFCSR_RFCNT1.
#define BM_SSI_SFCSR_RFCNT1 (0xf0000000) //!< Bit mask for SSI_SFCSR_RFCNT1.
//! @brief Get value of SSI_SFCSR_RFCNT1 from a register value.
#define BG_SSI_SFCSR_RFCNT1(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SFCSR_RFCNT1) >> BP_SSI_SFCSR_RFCNT1)
//! @brief Format value for bitfield SSI_SFCSR_RFCNT1.
#define BF_SSI_SFCSR_RFCNT1(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SFCSR_RFCNT1) & BM_SSI_SFCSR_RFCNT1)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RFCNT1 field to a new value.
#define BW_SSI_SFCSR_RFCNT1(x, v) (HW_SSI_SFCSR_WR(x, (HW_SSI_SFCSR_RD(x) & ~BM_SSI_SFCSR_RFCNT1) | BF_SSI_SFCSR_RFCNT1(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_SACNT - SSI AC97 Control Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_SACNT - SSI AC97 Control Register (RW)
*
* Reset value: 0x00000000
*/
typedef union _hw_ssi_sacnt
{
reg32_t U;
struct _hw_ssi_sacnt_bitfields
{
unsigned AC97EN : 1; //!< [0] AC97 Mode Enable.
unsigned FV : 1; //!< [1] Fixed/Variable Operation.
unsigned TIF : 1; //!< [2] Tag in FIFO.
unsigned RD : 1; //!< [3] Read Command.
unsigned WR : 1; //!< [4] Write Command.
unsigned FRDIV : 6; //!< [10:5] Frame Rate Divider.
unsigned RESERVED0 : 21; //!< [31:11] Reserved
} B;
} hw_ssi_sacnt_t;
#endif
/*!
* @name Constants and macros for entire SSI_SACNT register
*/
//@{
#define HW_SSI_SACNT_ADDR(x) (REGS_SSI_BASE(x) + 0x38)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_SACNT(x) (*(volatile hw_ssi_sacnt_t *) HW_SSI_SACNT_ADDR(x))
#define HW_SSI_SACNT_RD(x) (HW_SSI_SACNT(x).U)
#define HW_SSI_SACNT_WR(x, v) (HW_SSI_SACNT(x).U = (v))
#define HW_SSI_SACNT_SET(x, v) (HW_SSI_SACNT_WR(x, HW_SSI_SACNT_RD(x) | (v)))
#define HW_SSI_SACNT_CLR(x, v) (HW_SSI_SACNT_WR(x, HW_SSI_SACNT_RD(x) & ~(v)))
#define HW_SSI_SACNT_TOG(x, v) (HW_SSI_SACNT_WR(x, HW_SSI_SACNT_RD(x) ^ (v)))
#endif
//@}
/*
* constants & macros for individual SSI_SACNT bitfields
*/
/*! @name Register SSI_SACNT, field AC97EN[0] (RW)
*
* AC97 Mode Enable. This bit is used to enable SSI AC97 operation. Refer to for details of AC97
* operation.
*
* Values:
* - 0 - AC97 mode disabled.
* - 1 - SSI in AC97 mode.
*/
//@{
#define BP_SSI_SACNT_AC97EN (0) //!< Bit position for SSI_SACNT_AC97EN.
#define BM_SSI_SACNT_AC97EN (0x00000001) //!< Bit mask for SSI_SACNT_AC97EN.
//! @brief Get value of SSI_SACNT_AC97EN from a register value.
#define BG_SSI_SACNT_AC97EN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SACNT_AC97EN) >> BP_SSI_SACNT_AC97EN)
//! @brief Format value for bitfield SSI_SACNT_AC97EN.
#define BF_SSI_SACNT_AC97EN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SACNT_AC97EN) & BM_SSI_SACNT_AC97EN)
#ifndef __LANGUAGE_ASM__
//! @brief Set the AC97EN field to a new value.
#define BW_SSI_SACNT_AC97EN(x, v) (HW_SSI_SACNT_WR(x, (HW_SSI_SACNT_RD(x) & ~BM_SSI_SACNT_AC97EN) | BF_SSI_SACNT_AC97EN(v)))
#endif
//@}
/*! @name Register SSI_SACNT, field FV[1] (RW)
*
* Fixed/Variable Operation. This bit selects whether the SSI is in AC97 Fixed mode or AC97 Variable
* mode.
*
* Values:
* - FIXED = 0 - AC97 Fixed Mode.
* - VARIABLE = 1 - AC97 Variable Mode.
*/
//@{
#define BP_SSI_SACNT_FV (1) //!< Bit position for SSI_SACNT_FV.
#define BM_SSI_SACNT_FV (0x00000002) //!< Bit mask for SSI_SACNT_FV.
//! @brief Get value of SSI_SACNT_FV from a register value.
#define BG_SSI_SACNT_FV(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SACNT_FV) >> BP_SSI_SACNT_FV)
//! @brief Format value for bitfield SSI_SACNT_FV.
#define BF_SSI_SACNT_FV(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SACNT_FV) & BM_SSI_SACNT_FV)
#ifndef __LANGUAGE_ASM__
//! @brief Set the FV field to a new value.
#define BW_SSI_SACNT_FV(x, v) (HW_SSI_SACNT_WR(x, (HW_SSI_SACNT_RD(x) & ~BM_SSI_SACNT_FV) | BF_SSI_SACNT_FV(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SACNT_FV_V(v) BF_SSI_SACNT_FV(BV_SSI_SACNT_FV__##v)
#define BV_SSI_SACNT_FV__FIXED (0x0) //!< AC97 Fixed Mode.
#define BV_SSI_SACNT_FV__VARIABLE (0x1) //!< AC97 Variable Mode.
//@}
/*! @name Register SSI_SACNT, field TIF[2] (RW)
*
* Tag in FIFO. This bit controls the destination of the information received in AC97 tag slot (Slot
* #0).
*
* Values:
* - SATAG_REGISTER = 0 - Tag info stored in SATAG register.
* - RX_FIFO0 = 1 - Tag info stored in Rx FIFO 0.
*/
//@{
#define BP_SSI_SACNT_TIF (2) //!< Bit position for SSI_SACNT_TIF.
#define BM_SSI_SACNT_TIF (0x00000004) //!< Bit mask for SSI_SACNT_TIF.
//! @brief Get value of SSI_SACNT_TIF from a register value.
#define BG_SSI_SACNT_TIF(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SACNT_TIF) >> BP_SSI_SACNT_TIF)
//! @brief Format value for bitfield SSI_SACNT_TIF.
#define BF_SSI_SACNT_TIF(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SACNT_TIF) & BM_SSI_SACNT_TIF)
#ifndef __LANGUAGE_ASM__
//! @brief Set the TIF field to a new value.
#define BW_SSI_SACNT_TIF(x, v) (HW_SSI_SACNT_WR(x, (HW_SSI_SACNT_RD(x) & ~BM_SSI_SACNT_TIF) | BF_SSI_SACNT_TIF(v)))
#endif
//! @brief Macro to simplify usage of value macros.
#define BF_SSI_SACNT_TIF_V(v) BF_SSI_SACNT_TIF(BV_SSI_SACNT_TIF__##v)
#define BV_SSI_SACNT_TIF__SATAG_REGISTER (0x0) //!< Tag info stored in SATAG register.
#define BV_SSI_SACNT_TIF__RX_FIFO0 (0x1) //!< Tag info stored in Rx FIFO 0.
//@}
/*! @name Register SSI_SACNT, field RD[3] (RW)
*
* Read Command. This bit specifies whether the next frame will carry an AC97 Read Command or not.
* The programmer should take care that only one of the bits (WR or RD) is set at a time. When this
* bit is set, the corresponding tag bit (corresponding to Command Address slot of the next Tx
* frame) is automatically set. This bit is automatically cleared by the SSI after completing
* transmission of a frame.
*
* Values:
* - 0 - Next frame will not have a Read Command.
* - 1 - Next frame will have a Read Command.
*/
//@{
#define BP_SSI_SACNT_RD (3) //!< Bit position for SSI_SACNT_RD.
#define BM_SSI_SACNT_RD (0x00000008) //!< Bit mask for SSI_SACNT_RD.
//! @brief Get value of SSI_SACNT_RD from a register value.
#define BG_SSI_SACNT_RD(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SACNT_RD) >> BP_SSI_SACNT_RD)
//! @brief Format value for bitfield SSI_SACNT_RD.
#define BF_SSI_SACNT_RD(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SACNT_RD) & BM_SSI_SACNT_RD)
#ifndef __LANGUAGE_ASM__
//! @brief Set the RD field to a new value.
#define BW_SSI_SACNT_RD(x, v) (HW_SSI_SACNT_WR(x, (HW_SSI_SACNT_RD(x) & ~BM_SSI_SACNT_RD) | BF_SSI_SACNT_RD(v)))
#endif
//@}
/*! @name Register SSI_SACNT, field WR[4] (RW)
*
* Write Command. This bit specifies whether the next frame will carry an AC97 Write Command or not.
* The programmer should take care that only one of the bits (WR or RD) is set at a time. When this
* bit is set, the corresponding tag bits (corresponding to Command Address and Command Data slots
* of the next Tx frame) are automatically set. This bit is automatically cleared by the SSI after
* completing transmission of a frame.
*
* Values:
* - 0 - Next frame will not have a Write Command.
* - 1 - Next frame will have a Write Command.
*/
//@{
#define BP_SSI_SACNT_WR (4) //!< Bit position for SSI_SACNT_WR.
#define BM_SSI_SACNT_WR (0x00000010) //!< Bit mask for SSI_SACNT_WR.
//! @brief Get value of SSI_SACNT_WR from a register value.
#define BG_SSI_SACNT_WR(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SACNT_WR) >> BP_SSI_SACNT_WR)
//! @brief Format value for bitfield SSI_SACNT_WR.
#define BF_SSI_SACNT_WR(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SACNT_WR) & BM_SSI_SACNT_WR)
#ifndef __LANGUAGE_ASM__
//! @brief Set the WR field to a new value.
#define BW_SSI_SACNT_WR(x, v) (HW_SSI_SACNT_WR(x, (HW_SSI_SACNT_RD(x) & ~BM_SSI_SACNT_WR) | BF_SSI_SACNT_WR(v)))
#endif
//@}
/*! @name Register SSI_SACNT, field FRDIV[10:5] (RW)
*
* Frame Rate Divider. These bits control the frequency of AC97 data transmission/reception. They
* are programmed with the number of frames for which the SSI should be idle, after operating in one
* frame. Through these bits, AC97 frequency of operation, from 48 KHz (000000) to 1 KHz (101111)
* can be achieved. Sample Value: 001010 (10 Decimal) = SSI will operate once every 11 frames.
*/
//@{
#define BP_SSI_SACNT_FRDIV (5) //!< Bit position for SSI_SACNT_FRDIV.
#define BM_SSI_SACNT_FRDIV (0x000007e0) //!< Bit mask for SSI_SACNT_FRDIV.
//! @brief Get value of SSI_SACNT_FRDIV from a register value.
#define BG_SSI_SACNT_FRDIV(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SACNT_FRDIV) >> BP_SSI_SACNT_FRDIV)
//! @brief Format value for bitfield SSI_SACNT_FRDIV.
#define BF_SSI_SACNT_FRDIV(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SACNT_FRDIV) & BM_SSI_SACNT_FRDIV)
#ifndef __LANGUAGE_ASM__
//! @brief Set the FRDIV field to a new value.
#define BW_SSI_SACNT_FRDIV(x, v) (HW_SSI_SACNT_WR(x, (HW_SSI_SACNT_RD(x) & ~BM_SSI_SACNT_FRDIV) | BF_SSI_SACNT_FRDIV(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_SACADD - SSI AC97 Command Address Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_SACADD - SSI AC97 Command Address Register (RW)
*
* Reset value: 0x00000000
*/
typedef union _hw_ssi_sacadd
{
reg32_t U;
struct _hw_ssi_sacadd_bitfields
{
unsigned SACADD : 19; //!< [18:0] AC97 Command Address.
unsigned RESERVED0 : 13; //!< [31:19] Reserved
} B;
} hw_ssi_sacadd_t;
#endif
/*!
* @name Constants and macros for entire SSI_SACADD register
*/
//@{
#define HW_SSI_SACADD_ADDR(x) (REGS_SSI_BASE(x) + 0x3c)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_SACADD(x) (*(volatile hw_ssi_sacadd_t *) HW_SSI_SACADD_ADDR(x))
#define HW_SSI_SACADD_RD(x) (HW_SSI_SACADD(x).U)
#define HW_SSI_SACADD_WR(x, v) (HW_SSI_SACADD(x).U = (v))
#define HW_SSI_SACADD_SET(x, v) (HW_SSI_SACADD_WR(x, HW_SSI_SACADD_RD(x) | (v)))
#define HW_SSI_SACADD_CLR(x, v) (HW_SSI_SACADD_WR(x, HW_SSI_SACADD_RD(x) & ~(v)))
#define HW_SSI_SACADD_TOG(x, v) (HW_SSI_SACADD_WR(x, HW_SSI_SACADD_RD(x) ^ (v)))
#endif
//@}
/*
* constants & macros for individual SSI_SACADD bitfields
*/
/*! @name Register SSI_SACADD, field SACADD[18:0] (RW)
*
* AC97 Command Address. These bits store the Command Address Slot information (bit 19 of the slot
* is sent in accordance with the Read and Write Command bits in SSI_SACNT register). These bits can
* be updated by a direct write from the Core. They are also updated with the information received
* in the incoming Command Address Slot. If the contents of these bits change due to an update, the
* CMDAU bit in SISR is set.
*/
//@{
#define BP_SSI_SACADD_SACADD (0) //!< Bit position for SSI_SACADD_SACADD.
#define BM_SSI_SACADD_SACADD (0x0007ffff) //!< Bit mask for SSI_SACADD_SACADD.
//! @brief Get value of SSI_SACADD_SACADD from a register value.
#define BG_SSI_SACADD_SACADD(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SACADD_SACADD) >> BP_SSI_SACADD_SACADD)
//! @brief Format value for bitfield SSI_SACADD_SACADD.
#define BF_SSI_SACADD_SACADD(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SACADD_SACADD) & BM_SSI_SACADD_SACADD)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SACADD field to a new value.
#define BW_SSI_SACADD_SACADD(x, v) (HW_SSI_SACADD_WR(x, (HW_SSI_SACADD_RD(x) & ~BM_SSI_SACADD_SACADD) | BF_SSI_SACADD_SACADD(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_SACDAT - SSI AC97 Command Data Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_SACDAT - SSI AC97 Command Data Register (RW)
*
* Reset value: 0x00000000
*/
typedef union _hw_ssi_sacdat
{
reg32_t U;
struct _hw_ssi_sacdat_bitfields
{
unsigned SACDAT : 20; //!< [19:0] AC97 Command Data.
unsigned RESERVED0 : 12; //!< [31:20] Reserved
} B;
} hw_ssi_sacdat_t;
#endif
/*!
* @name Constants and macros for entire SSI_SACDAT register
*/
//@{
#define HW_SSI_SACDAT_ADDR(x) (REGS_SSI_BASE(x) + 0x40)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_SACDAT(x) (*(volatile hw_ssi_sacdat_t *) HW_SSI_SACDAT_ADDR(x))
#define HW_SSI_SACDAT_RD(x) (HW_SSI_SACDAT(x).U)
#define HW_SSI_SACDAT_WR(x, v) (HW_SSI_SACDAT(x).U = (v))
#define HW_SSI_SACDAT_SET(x, v) (HW_SSI_SACDAT_WR(x, HW_SSI_SACDAT_RD(x) | (v)))
#define HW_SSI_SACDAT_CLR(x, v) (HW_SSI_SACDAT_WR(x, HW_SSI_SACDAT_RD(x) & ~(v)))
#define HW_SSI_SACDAT_TOG(x, v) (HW_SSI_SACDAT_WR(x, HW_SSI_SACDAT_RD(x) ^ (v)))
#endif
//@}
/*
* constants & macros for individual SSI_SACDAT bitfields
*/
/*! @name Register SSI_SACDAT, field SACDAT[19:0] (RW)
*
* AC97 Command Data. The outgoing Command Data Slot carries the information contained in these
* bits. These bits can be updated by a direct write from the Core. They are also updated with the
* information received in the incoming Command Data Slot. If the contents of these bits change due
* to an update, the CMDDU bit in SISR is set. These bits are transmitted only during AC97 Write
* Command. During AC97 Read Command, 0x00000 is transmitted in time slot #2.
*/
//@{
#define BP_SSI_SACDAT_SACDAT (0) //!< Bit position for SSI_SACDAT_SACDAT.
#define BM_SSI_SACDAT_SACDAT (0x000fffff) //!< Bit mask for SSI_SACDAT_SACDAT.
//! @brief Get value of SSI_SACDAT_SACDAT from a register value.
#define BG_SSI_SACDAT_SACDAT(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SACDAT_SACDAT) >> BP_SSI_SACDAT_SACDAT)
//! @brief Format value for bitfield SSI_SACDAT_SACDAT.
#define BF_SSI_SACDAT_SACDAT(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SACDAT_SACDAT) & BM_SSI_SACDAT_SACDAT)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SACDAT field to a new value.
#define BW_SSI_SACDAT_SACDAT(x, v) (HW_SSI_SACDAT_WR(x, (HW_SSI_SACDAT_RD(x) & ~BM_SSI_SACDAT_SACDAT) | BF_SSI_SACDAT_SACDAT(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_SATAG - SSI AC97 Tag Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_SATAG - SSI AC97 Tag Register (RW)
*
* Reset value: 0x00000000
*/
typedef union _hw_ssi_satag
{
reg32_t U;
struct _hw_ssi_satag_bitfields
{
unsigned SATAG : 16; //!< [15:0] AC97 Tag Value.
unsigned RESERVED0 : 16; //!< [31:16] Reserved
} B;
} hw_ssi_satag_t;
#endif
/*!
* @name Constants and macros for entire SSI_SATAG register
*/
//@{
#define HW_SSI_SATAG_ADDR(x) (REGS_SSI_BASE(x) + 0x44)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_SATAG(x) (*(volatile hw_ssi_satag_t *) HW_SSI_SATAG_ADDR(x))
#define HW_SSI_SATAG_RD(x) (HW_SSI_SATAG(x).U)
#define HW_SSI_SATAG_WR(x, v) (HW_SSI_SATAG(x).U = (v))
#define HW_SSI_SATAG_SET(x, v) (HW_SSI_SATAG_WR(x, HW_SSI_SATAG_RD(x) | (v)))
#define HW_SSI_SATAG_CLR(x, v) (HW_SSI_SATAG_WR(x, HW_SSI_SATAG_RD(x) & ~(v)))
#define HW_SSI_SATAG_TOG(x, v) (HW_SSI_SATAG_WR(x, HW_SSI_SATAG_RD(x) ^ (v)))
#endif
//@}
/*
* constants & macros for individual SSI_SATAG bitfields
*/
/*! @name Register SSI_SATAG, field SATAG[15:0] (RW)
*
* AC97 Tag Value. Writing to this register (by the Core) sets the value of the Tx-Tag in AC97 fixed
* mode of operation. On a read, the Core gets the Rx-Tag Value received (in the last frame) from
* the Codec. If TIF bit in SSI_SACNT register is set, the TAG value is also stored in Rx-FIFO in
* addition to SATAG register. When the received Tag value changes, the RXT bit in SISR register is
* set. Bits SATAG[1:0] convey the Codec -ID. In current implementation only Primary Codecs are
* supported. Thus writing value 2'b00 to this field is mandatory.
*/
//@{
#define BP_SSI_SATAG_SATAG (0) //!< Bit position for SSI_SATAG_SATAG.
#define BM_SSI_SATAG_SATAG (0x0000ffff) //!< Bit mask for SSI_SATAG_SATAG.
//! @brief Get value of SSI_SATAG_SATAG from a register value.
#define BG_SSI_SATAG_SATAG(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SATAG_SATAG) >> BP_SSI_SATAG_SATAG)
//! @brief Format value for bitfield SSI_SATAG_SATAG.
#define BF_SSI_SATAG_SATAG(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SATAG_SATAG) & BM_SSI_SATAG_SATAG)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SATAG field to a new value.
#define BW_SSI_SATAG_SATAG(x, v) (HW_SSI_SATAG_WR(x, (HW_SSI_SATAG_RD(x) & ~BM_SSI_SATAG_SATAG) | BF_SSI_SATAG_SATAG(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_STMSK - SSI Transmit Time Slot Mask Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_STMSK - SSI Transmit Time Slot Mask Register (RW)
*
* Reset value: 0x00000000
*/
typedef union _hw_ssi_stmsk
{
reg32_t U;
struct _hw_ssi_stmsk_bitfields
{
unsigned STMSK : 32; //!< [31:0] Transmit Mask.
} B;
} hw_ssi_stmsk_t;
#endif
/*!
* @name Constants and macros for entire SSI_STMSK register
*/
//@{
#define HW_SSI_STMSK_ADDR(x) (REGS_SSI_BASE(x) + 0x48)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_STMSK(x) (*(volatile hw_ssi_stmsk_t *) HW_SSI_STMSK_ADDR(x))
#define HW_SSI_STMSK_RD(x) (HW_SSI_STMSK(x).U)
#define HW_SSI_STMSK_WR(x, v) (HW_SSI_STMSK(x).U = (v))
#define HW_SSI_STMSK_SET(x, v) (HW_SSI_STMSK_WR(x, HW_SSI_STMSK_RD(x) | (v)))
#define HW_SSI_STMSK_CLR(x, v) (HW_SSI_STMSK_WR(x, HW_SSI_STMSK_RD(x) & ~(v)))
#define HW_SSI_STMSK_TOG(x, v) (HW_SSI_STMSK_WR(x, HW_SSI_STMSK_RD(x) ^ (v)))
#endif
//@}
/*
* constants & macros for individual SSI_STMSK bitfields
*/
/*! @name Register SSI_STMSK, field STMSK[31:0] (RW)
*
* Transmit Mask. These bits indicate which slot has been masked in the current frame. The Core can
* write to this register to control the time slots in which the SSI transmits data. Each bit has
* info corresponding to the respective time slot in the frame. Transmit mask bits should not be
* used in I2S Slave mode of operation. SSI_STMSK register value must be set before enabling
* Transmission.
*
* Values:
* - 0 - Valid Time Slot.
* - 1 - Time Slot masked (no data transmitted in this time slot).
*/
//@{
#define BP_SSI_STMSK_STMSK (0) //!< Bit position for SSI_STMSK_STMSK.
#define BM_SSI_STMSK_STMSK (0xffffffff) //!< Bit mask for SSI_STMSK_STMSK.
//! @brief Get value of SSI_STMSK_STMSK from a register value.
#define BG_SSI_STMSK_STMSK(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_STMSK_STMSK) >> BP_SSI_STMSK_STMSK)
//! @brief Format value for bitfield SSI_STMSK_STMSK.
#define BF_SSI_STMSK_STMSK(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_STMSK_STMSK) & BM_SSI_STMSK_STMSK)
#ifndef __LANGUAGE_ASM__
//! @brief Set the STMSK field to a new value.
#define BW_SSI_STMSK_STMSK(x, v) (HW_SSI_STMSK_WR(x, (HW_SSI_STMSK_RD(x) & ~BM_SSI_STMSK_STMSK) | BF_SSI_STMSK_STMSK(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_SRMSK - SSI Receive Time Slot Mask Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_SRMSK - SSI Receive Time Slot Mask Register (RW)
*
* Reset value: 0x00000000
*/
typedef union _hw_ssi_srmsk
{
reg32_t U;
struct _hw_ssi_srmsk_bitfields
{
unsigned SRMSK : 32; //!< [31:0] Receive Mask.
} B;
} hw_ssi_srmsk_t;
#endif
/*!
* @name Constants and macros for entire SSI_SRMSK register
*/
//@{
#define HW_SSI_SRMSK_ADDR(x) (REGS_SSI_BASE(x) + 0x4c)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_SRMSK(x) (*(volatile hw_ssi_srmsk_t *) HW_SSI_SRMSK_ADDR(x))
#define HW_SSI_SRMSK_RD(x) (HW_SSI_SRMSK(x).U)
#define HW_SSI_SRMSK_WR(x, v) (HW_SSI_SRMSK(x).U = (v))
#define HW_SSI_SRMSK_SET(x, v) (HW_SSI_SRMSK_WR(x, HW_SSI_SRMSK_RD(x) | (v)))
#define HW_SSI_SRMSK_CLR(x, v) (HW_SSI_SRMSK_WR(x, HW_SSI_SRMSK_RD(x) & ~(v)))
#define HW_SSI_SRMSK_TOG(x, v) (HW_SSI_SRMSK_WR(x, HW_SSI_SRMSK_RD(x) ^ (v)))
#endif
//@}
/*
* constants & macros for individual SSI_SRMSK bitfields
*/
/*! @name Register SSI_SRMSK, field SRMSK[31:0] (RW)
*
* Receive Mask. These bits indicate which slot has been masked in the current frame. The Core can
* write to this register to control the time slots in which the SSI receives data. Each bit has
* info corresponding to the respective time slot in the frame. SSI_SRMSK register value must be set
* before enabling Receiver. Receive mask bits should not be used in I2S Slave mode of operation.
*
* Values:
* - 0 - Valid Time Slot.
* - 1 - Time Slot masked (no data received in this time slot).
*/
//@{
#define BP_SSI_SRMSK_SRMSK (0) //!< Bit position for SSI_SRMSK_SRMSK.
#define BM_SSI_SRMSK_SRMSK (0xffffffff) //!< Bit mask for SSI_SRMSK_SRMSK.
//! @brief Get value of SSI_SRMSK_SRMSK from a register value.
#define BG_SSI_SRMSK_SRMSK(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SRMSK_SRMSK) >> BP_SSI_SRMSK_SRMSK)
//! @brief Format value for bitfield SSI_SRMSK_SRMSK.
#define BF_SSI_SRMSK_SRMSK(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SRMSK_SRMSK) & BM_SSI_SRMSK_SRMSK)
#ifndef __LANGUAGE_ASM__
//! @brief Set the SRMSK field to a new value.
#define BW_SSI_SRMSK_SRMSK(x, v) (HW_SSI_SRMSK_WR(x, (HW_SSI_SRMSK_RD(x) & ~BM_SSI_SRMSK_SRMSK) | BF_SSI_SRMSK_SRMSK(v)))
#endif
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_SACCST - SSI AC97 Channel Status Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_SACCST - SSI AC97 Channel Status Register (RO)
*
* Reset value: 0x00000000
*/
typedef union _hw_ssi_saccst
{
reg32_t U;
struct _hw_ssi_saccst_bitfields
{
unsigned SACCST : 10; //!< [9:0] AC97 Channel Status.
unsigned RESERVED0 : 22; //!< [31:10] Reserved
} B;
} hw_ssi_saccst_t;
#endif
/*!
* @name Constants and macros for entire SSI_SACCST register
*/
//@{
#define HW_SSI_SACCST_ADDR(x) (REGS_SSI_BASE(x) + 0x50)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_SACCST(x) (*(volatile hw_ssi_saccst_t *) HW_SSI_SACCST_ADDR(x))
#define HW_SSI_SACCST_RD(x) (HW_SSI_SACCST(x).U)
#endif
//@}
/*
* constants & macros for individual SSI_SACCST bitfields
*/
/*! @name Register SSI_SACCST, field SACCST[9:0] (RO)
*
* AC97 Channel Status. These bits indicate which data slot has been enabled in AC97 variable mode
* operation. This register is updated in case the core enables/disables a channel through a write
* to SSI_SACCEN/SSI_SACCDIS register or the external codec enables a channel by sending a '1' in
* the corresponding SLOTREQ bit. Bit [0] corresponds to the first data slot in an AC97 frame (Slot
* #3) and Bit [9] corresponds to the tenth data slot (slot #12). The contents of this register only
* have relevance while the SSI is operating in AC97 variable mode. Writes to this register result
* in an error response on the block interface.
*
* Values:
* - 0 - Data channel disabled.
* - 1 - Data channel enabled.
*/
//@{
#define BP_SSI_SACCST_SACCST (0) //!< Bit position for SSI_SACCST_SACCST.
#define BM_SSI_SACCST_SACCST (0x000003ff) //!< Bit mask for SSI_SACCST_SACCST.
//! @brief Get value of SSI_SACCST_SACCST from a register value.
#define BG_SSI_SACCST_SACCST(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SACCST_SACCST) >> BP_SSI_SACCST_SACCST)
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_SACCEN - SSI AC97 Channel Enable Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_SACCEN - SSI AC97 Channel Enable Register (WO)
*
* Reset value: 0x00000000
*/
typedef union _hw_ssi_saccen
{
reg32_t U;
struct _hw_ssi_saccen_bitfields
{
unsigned SACCEN : 10; //!< [9:0] AC97 Channel Enable.
unsigned RESERVED0 : 22; //!< [31:10] Reserved
} B;
} hw_ssi_saccen_t;
#endif
/*!
* @name Constants and macros for entire SSI_SACCEN register
*/
//@{
#define HW_SSI_SACCEN_ADDR(x) (REGS_SSI_BASE(x) + 0x54)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_SACCEN(x) (*(volatile hw_ssi_saccen_t *) HW_SSI_SACCEN_ADDR(x))
#define HW_SSI_SACCEN_WR(x, v) (HW_SSI_SACCEN(x).U = (v))
#endif
//@}
/*
* constants & macros for individual SSI_SACCEN bitfields
*/
/*! @name Register SSI_SACCEN, field SACCEN[9:0] (WO)
*
* AC97 Channel Enable. The Core writes a '1' to these bits to enable an AC97 data channel. Writing
* a '0' has no effect. Bit [0] corresponds to the first data slot in an AC97 frame (Slot #3) and
* Bit [9] corresponds to the tenth data slot (slot #12). Writes to these bits only have effect in
* the AC97 Variable mode of operation. These bits are always read as '0' by the Core.
*
* Values:
* - 0 - Write Has no effect.
* - 1 - Write Enables the corresponding data channel.
*/
//@{
#define BP_SSI_SACCEN_SACCEN (0) //!< Bit position for SSI_SACCEN_SACCEN.
#define BM_SSI_SACCEN_SACCEN (0x000003ff) //!< Bit mask for SSI_SACCEN_SACCEN.
//! @brief Get value of SSI_SACCEN_SACCEN from a register value.
#define BG_SSI_SACCEN_SACCEN(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SACCEN_SACCEN) >> BP_SSI_SACCEN_SACCEN)
//! @brief Format value for bitfield SSI_SACCEN_SACCEN.
#define BF_SSI_SACCEN_SACCEN(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SACCEN_SACCEN) & BM_SSI_SACCEN_SACCEN)
//@}
//-------------------------------------------------------------------------------------------
// HW_SSI_SACCDIS - SSI AC97 Channel Disable Register
//-------------------------------------------------------------------------------------------
#ifndef __LANGUAGE_ASM__
/*!
* @brief HW_SSI_SACCDIS - SSI AC97 Channel Disable Register (WO)
*
* Reset value: 0x00000000
*/
typedef union _hw_ssi_saccdis
{
reg32_t U;
struct _hw_ssi_saccdis_bitfields
{
unsigned SACCDIS : 10; //!< [9:0] AC97 Channel Disable.
unsigned RESERVED0 : 22; //!< [31:10] Reserved
} B;
} hw_ssi_saccdis_t;
#endif
/*!
* @name Constants and macros for entire SSI_SACCDIS register
*/
//@{
#define HW_SSI_SACCDIS_ADDR(x) (REGS_SSI_BASE(x) + 0x58)
#ifndef __LANGUAGE_ASM__
#define HW_SSI_SACCDIS(x) (*(volatile hw_ssi_saccdis_t *) HW_SSI_SACCDIS_ADDR(x))
#define HW_SSI_SACCDIS_WR(x, v) (HW_SSI_SACCDIS(x).U = (v))
#endif
//@}
/*
* constants & macros for individual SSI_SACCDIS bitfields
*/
/*! @name Register SSI_SACCDIS, field SACCDIS[9:0] (WO)
*
* AC97 Channel Disable. The Core writes a '1' to these bits to disable an AC97 data channel.
* Writing a '0' has no effect. Bit [0] corresponds to the first data slot in an AC97 frame (Slot
* #3) and Bit [9] corresponds to the tenth data slot (slot #12). Writes to these bits only have
* effect in the AC97 Variable mode of operation. These bits are always read as '0' by the Core.
*
* Values:
* - 0 - Write Has no effect.
* - 1 - Write Disables the corresponding data channel.
*/
//@{
#define BP_SSI_SACCDIS_SACCDIS (0) //!< Bit position for SSI_SACCDIS_SACCDIS.
#define BM_SSI_SACCDIS_SACCDIS (0x000003ff) //!< Bit mask for SSI_SACCDIS_SACCDIS.
//! @brief Get value of SSI_SACCDIS_SACCDIS from a register value.
#define BG_SSI_SACCDIS_SACCDIS(r) ((__REG_VALUE_TYPE((r), reg32_t) & BM_SSI_SACCDIS_SACCDIS) >> BP_SSI_SACCDIS_SACCDIS)
//! @brief Format value for bitfield SSI_SACCDIS_SACCDIS.
#define BF_SSI_SACCDIS_SACCDIS(v) ((__REG_VALUE_TYPE((v), reg32_t) << BP_SSI_SACCDIS_SACCDIS) & BM_SSI_SACCDIS_SACCDIS)
//@}
//-------------------------------------------------------------------------------------------
// hw_ssi_t - module struct
//-------------------------------------------------------------------------------------------
/*!
* @brief All SSI module registers.
*/
#ifndef __LANGUAGE_ASM__
#pragma pack(1)
typedef struct _hw_ssi
{
volatile hw_ssi_stxn_t STXn[2]; //!< SSI Transmit Data Register n
volatile hw_ssi_srxn_t SRXn[2]; //!< SSI Receive Data Register n
volatile hw_ssi_scr_t SCR; //!< SSI Control Register
volatile hw_ssi_sisr_t SISR; //!< SSI Interrupt Status Register
volatile hw_ssi_sier_t SIER; //!< SSI Interrupt Enable Register
volatile hw_ssi_stcr_t STCR; //!< SSI Transmit Configuration Register
volatile hw_ssi_srcr_t SRCR; //!< SSI Receive Configuration Register
volatile hw_ssi_stccr_t STCCR; //!< SSI Transmit Clock Control Register
volatile hw_ssi_srccr_t SRCCR; //!< SSI Receive Clock Control Register
volatile hw_ssi_sfcsr_t SFCSR; //!< SSI FIFO Control/Status Register
reg32_t _reserved0[2];
volatile hw_ssi_sacnt_t SACNT; //!< SSI AC97 Control Register
volatile hw_ssi_sacadd_t SACADD; //!< SSI AC97 Command Address Register
volatile hw_ssi_sacdat_t SACDAT; //!< SSI AC97 Command Data Register
volatile hw_ssi_satag_t SATAG; //!< SSI AC97 Tag Register
volatile hw_ssi_stmsk_t STMSK; //!< SSI Transmit Time Slot Mask Register
volatile hw_ssi_srmsk_t SRMSK; //!< SSI Receive Time Slot Mask Register
volatile hw_ssi_saccst_t SACCST; //!< SSI AC97 Channel Status Register
volatile hw_ssi_saccen_t SACCEN; //!< SSI AC97 Channel Enable Register
volatile hw_ssi_saccdis_t SACCDIS; //!< SSI AC97 Channel Disable Register
} hw_ssi_t;
#pragma pack()
//! @brief Macro to access all SSI registers.
//! @param x SSI instance number.
//! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
//! use the '&' operator, like <code>&HW_SSI(0)</code>.
#define HW_SSI(x) (*(hw_ssi_t *) REGS_SSI_BASE(x))
#endif
#endif // __HW_SSI_REGISTERS_H__
// v18/121106/1.2.2
// EOF
|
970dc353e3d440c16a26ccca3d9a9bc0f4eff766
|
aa3befea459382dc5c01c925653d54f435b3fb0f
|
/drivers/lcd/pcf8574_lcd_backpack.c
|
011d888a5b72082933fc0a7d2a43599603c5989b
|
[
"MIT-open-group",
"BSD-3-Clause",
"HPND-sell-variant",
"BSD-4-Clause-UC",
"LicenseRef-scancode-warranty-disclaimer",
"MIT-0",
"LicenseRef-scancode-bsd-atmel",
"LicenseRef-scancode-gary-s-brown",
"LicenseRef-scancode-proprietary-license",
"SunPro",
"MIT",
"LicenseRef-scancode-public-domain-disclaimer",
"LicenseRef-scancode-other-permissive",
"HPND",
"ISC",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"GPL-1.0-or-later",
"CC-BY-2.0",
"CC-BY-4.0"
] |
permissive
|
apache/nuttx
|
14519a7bff4a87935d94fb8fb2b19edb501c7cec
|
606b6d9310fb25c7d92c6f95bf61737e3c79fa0f
|
refs/heads/master
| 2023-08-25T06:55:45.822534
| 2023-08-23T16:03:31
| 2023-08-24T21:25:47
| 228,103,273
| 407
| 241
|
Apache-2.0
| 2023-09-14T18:26:05
| 2019-12-14T23:27:55
|
C
|
UTF-8
|
C
| false
| false
| 45,012
|
c
|
pcf8574_lcd_backpack.c
|
/****************************************************************************
* drivers/lcd/pcf8574_lcd_backpack.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you 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.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <poll.h>
#include <string.h>
#include <errno.h>
#include <debug.h>
#include <nuttx/kmalloc.h>
#include <nuttx/mutex.h>
#include <nuttx/signal.h>
#include <nuttx/ascii.h>
#include <nuttx/fs/fs.h>
#include <nuttx/lcd/slcd_codec.h>
#include <nuttx/lcd/pcf8574_lcd_backpack.h>
#ifndef CONFIG_LIBC_SLCDCODEC
# error please also select Library Routines, Segment LCD CODEC
#endif
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* The PCF8574 is a 100 KHz device */
#define I2C_FREQ 100000
/* timing characteristics of the LCD interface */
#define DELAY_US_NYBBLE0 20
#define DELAY_US_NYBBLE1 10
#define DELAY_US_WRITE 40
#define DELAY_US_HOMECLEAR 2000
/* HD44780 commands */
#define CMD_CLEAR 0x01
#define CMD_HOME 0x02
#define CMD_CURSOR_ON_SOLID 0x0e
#define CMD_CURSOR_OFF 0x0c
#define CMD_CURSOR_ON_BLINK 0x0f
#define CMD_SET_CGADDR 0x40
#define CMD_SET_DDADDR 0x80
#define MAX_OPENCNT (255) /* Limit of uint8_t */
/****************************************************************************
* Private Types
****************************************************************************/
struct pcf8574_lcd_dev_s
{
FAR struct i2c_master_s *i2c; /* I2C interface */
struct pcf8574_lcd_backpack_config_s cfg; /* gpio configuration */
uint8_t bl_bit; /* current backlight bit */
uint8_t refs; /* Number of references */
uint8_t unlinked; /* We are unlinked, so teardown
* on last close */
mutex_t lock; /* mutex */
};
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/* Character driver methods */
static int pcf8574_lcd_open(FAR struct file *filep);
static int pcf8574_lcd_close(FAR struct file *filep);
static ssize_t pcf8574_lcd_read(FAR struct file *filep, FAR char *buffer,
size_t buflen);
static ssize_t pcf8574_lcd_write(FAR struct file *filep,
FAR const char *buffer, size_t buflen);
static off_t pcf8574_lcd_seek(FAR struct file *filep, off_t offset,
int whence);
static int pcf8574_lcd_ioctl(FAR struct file *filep, int cmd,
unsigned long arg);
static int pcf8574_lcd_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup);
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
static int pcf8574_lcd_unlink(FAR struct inode *inode);
#endif
/****************************************************************************
* Private Data
****************************************************************************/
static const struct file_operations g_pcf8574_lcd_fops =
{
pcf8574_lcd_open, /* open */
pcf8574_lcd_close, /* close */
pcf8574_lcd_read, /* read */
pcf8574_lcd_write, /* write */
pcf8574_lcd_seek, /* seek */
pcf8574_lcd_ioctl, /* ioctl */
NULL, /* mmap */
NULL, /* truncate */
pcf8574_lcd_poll /* poll */
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
, pcf8574_lcd_unlink /* unlink */
#endif
};
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: pca8574_write
*
* Description:
* primitive I2C write operation for the PCA8574, which is the IO expander
* device used on the board. The board essentially byte-bangs the
* parallel interface in nybble mode much as one might with a conventional
* GPIO based interface. The I2C interface simply sets the state of the
* 8 IO lines to control the 4 data, 3 control, and one for backlight,
* signals.
*
****************************************************************************/
static void pca8574_write(FAR struct pcf8574_lcd_dev_s *priv, uint8_t data)
{
struct i2c_config_s config;
int ret;
/* Set up the I2C configuration */
config.frequency = I2C_FREQ;
config.address = priv->cfg.addr;
config.addrlen = 7;
/* Write the value */
ret = i2c_write(priv->i2c, &config, &data, 1);
if (ret < 0)
{
lcdinfo("pca8574_write() failed: %d\n", ret);
return;
}
}
/****************************************************************************
* Name: pca8574_read
*
* Description:
* primitive I2C read operation for the PCA8574, which is the IO expander
* device used on the board. The PCF8574 is 'interesting' in that it
* doesn't really have a data direction register, but instead the outputs
* are current-limited when high, so by setting an IO line high, you are
* also making it an input. Consequently, before using this method, you'll
* need to perform a pca8574_write() setting the bits you are interested in
* reading to 1's, then call this method.
*
****************************************************************************/
static int pca8574_read(FAR struct pcf8574_lcd_dev_s *priv, uint8_t *data)
{
struct i2c_config_s config;
int ret;
/* Set up the I2C configuration */
config.frequency = I2C_FREQ;
config.address = priv->cfg.addr;
config.addrlen = 7;
/* Read the value */
ret = i2c_read(priv->i2c, &config, data, 1);
if (ret < 0)
{
lcdinfo("pca8574_read() failed: %d\n", ret);
}
return ret;
}
/****************************************************************************
* Name: lcd_backlight
*
* Description:
* turn on, or off, the LCD backlight
*
****************************************************************************/
static void lcd_backlight(FAR struct pcf8574_lcd_dev_s *priv, bool blon)
{
uint8_t data;
data = ((blon && priv->cfg.bl_active_high) ||
(!blon && !priv->cfg.bl_active_high)) ? (1 << priv->cfg.bl) : 0;
pca8574_write(priv, data);
priv->bl_bit = data;
}
/****************************************************************************
* Name: rc2addr
*
* Description:
* This converts a row/column pair to a screen memory address.
*
****************************************************************************/
static inline uint8_t rc2addr(FAR struct pcf8574_lcd_dev_s *priv,
uint8_t row, uint8_t col)
{
if (row < 2)
{
/* 1 and 2 line displays are simple; line0 @ 0x00, line1 @ 0x40 */
return row * 0x40 + col;
}
else
{
/* 4 line displays are interesting; third line really is a continuation
* of first line, and fourth line is a continuation of second.
*/
return (row - 2) * 0x40 + (col + priv->cfg.cols);
}
}
/****************************************************************************
* Name: addr2rc
*
* Description:
* This converts a screen memory address to a row/column pair.
*
****************************************************************************/
static inline void addr2rc(FAR struct pcf8574_lcd_dev_s *priv, uint8_t addr,
FAR uint8_t *row, FAR uint8_t *col)
{
*row = addr / 0x40;
*col = addr % 0x40;
if (*col >= priv->cfg.cols)
{
/* 4 line displays have third and fourth lines really as continuation
* of the first and second.
*/
*row += 2;
*col -= priv->cfg.cols;
}
}
/****************************************************************************
* Name: prepare_nybble
*
* Description:
* This is a bit tedious, but scramble the bits of the nybble into position
* as per this board's particular wiring. Most boards are either on the
* top four bits, or bottom four, so a shift would do typically in those
* cases, but this gives us ultimate flexibility.
*
****************************************************************************/
uint8_t prepare_nybble(FAR struct pcf8574_lcd_dev_s *priv, uint8_t nybble)
{
uint8_t lcddata = 0;
if (nybble & 0x08)
{
lcddata |= (1 << priv->cfg.d7);
}
if (nybble & 0x04)
{
lcddata |= (1 << priv->cfg.d6);
}
if (nybble & 0x02)
{
lcddata |= (1 << priv->cfg.d5);
}
if (nybble & 0x01)
{
lcddata |= (1 << priv->cfg.d4);
}
return lcddata;
}
/****************************************************************************
* Name: unprepare_nybble
*
* Description:
* This is the opposite of prepare_nybble(), and is used to unscramble bits
* when reading data from the display, as per board wiring.
*
****************************************************************************/
uint8_t unprepare_nybble(FAR struct pcf8574_lcd_dev_s *priv, uint8_t lcddata)
{
uint8_t data = 0;
if (lcddata & (1 << priv->cfg.d7))
{
data |= 0x08;
}
if (lcddata & (1 << priv->cfg.d6))
{
data |= 0x04;
}
if (lcddata & (1 << priv->cfg.d5))
{
data |= 0x02;
}
if (lcddata & (1 << priv->cfg.d4))
{
data |= 0x01;
}
return data;
}
/****************************************************************************
* Name: latch_nybble
*
* Description:
* Latch a nybble on the LCD bus. This is done for each of two halves of a
* write operation in 4-bit mode. The 'rs' param is false for command
* transfers, and true for data transfers.
*
****************************************************************************/
static void latch_nybble(FAR struct pcf8574_lcd_dev_s *priv, uint8_t nybble,
bool rs)
{
uint8_t lcddata;
uint8_t en_bit;
uint8_t rs_bit;
en_bit = 1 << priv->cfg.en;
rs_bit = rs ? (1 << priv->cfg.rs) : 0;
/* Put the nybble, preserving backlight, reset R/~W and maybe RS */
lcddata = prepare_nybble(priv, nybble) | priv->bl_bit | rs_bit;
pca8574_write(priv, lcddata);
/* Now set EN */
lcddata |= en_bit;
pca8574_write(priv, lcddata);
up_udelay(DELAY_US_NYBBLE0); /* setup */
/* Latch on EN falling edge */
lcddata &= ~en_bit;
pca8574_write(priv, lcddata);
up_udelay(DELAY_US_NYBBLE1); /* hold */
}
/****************************************************************************
* Name: load_nybble
*
* Description:
* Load a nybble from the LCD bus. This is done for each of two halves of a
* read operation in 4-bit mode. The 'rs' param is false for command
* transfers (the only one is to read status and the address register), and
* true for data transfers.
*
****************************************************************************/
static uint8_t load_nybble(FAR struct pcf8574_lcd_dev_s *priv, bool rs)
{
uint8_t lcddata;
uint8_t en_bit;
uint8_t rs_bit;
uint8_t rw_bit;
uint8_t data;
en_bit = 1 << priv->cfg.en;
rs_bit = rs ? (1 << priv->cfg.rs) : 0;
rw_bit = 1 << priv->cfg.rw;
/* Put highs on the data lines, preserve, set R/~W and maybe RS */
lcddata = prepare_nybble(priv, 0x0f) | priv->bl_bit | rw_bit | rs_bit;
pca8574_write(priv, lcddata);
/* Now set EN */
lcddata |= en_bit;
pca8574_write(priv, lcddata);
up_udelay(DELAY_US_NYBBLE0); /* setup */
/* Now read the data */
pca8574_read(priv, &data);
data = unprepare_nybble(priv, data);
/* Transaction completed on EN falling edge */
lcddata &= ~en_bit;
pca8574_write(priv, lcddata);
up_udelay(DELAY_US_NYBBLE1); /* hold */
return data;
}
/****************************************************************************
* Name: lcd_putcmd
*
* Description:
* Write a command to the LCD. Most of the time this is done in nybble
* mode in two phases, but in special cases (like initialization) we do not
* do two phases.
*
****************************************************************************/
static void lcd_putcmd(FAR struct pcf8574_lcd_dev_s *priv, uint8_t data)
{
latch_nybble(priv, data >> 4, false);
latch_nybble(priv, data, false);
up_udelay(DELAY_US_WRITE);
}
/****************************************************************************
* Name: lcd_putdata
*
* Description:
* Write a byte to the LCD. This is used both for screen data and for
* character generator data, depending on a previous command that selected
* which ever is the destination.
*
****************************************************************************/
static inline void lcd_putdata(FAR struct pcf8574_lcd_dev_s *priv,
uint8_t data)
{
latch_nybble(priv, data >> 4, true);
latch_nybble(priv, data, true);
up_udelay(DELAY_US_WRITE);
}
/****************************************************************************
* Name: lcd_getdata
*
* Description:
* Read a data byte from the LCD.
*
****************************************************************************/
static inline uint8_t lcd_getdata(FAR struct pcf8574_lcd_dev_s *priv)
{
uint8_t data;
data = (load_nybble(priv, true) << 4) | load_nybble(priv, true);
return data;
}
/****************************************************************************
* Name: lcd_getcmd
*
* Description:
* Read a command byte from the LCD. There really is only one such read:
* get 'busy' status, and current address value.
*
****************************************************************************/
static inline uint8_t lcd_getcmd(FAR struct pcf8574_lcd_dev_s *priv)
{
uint8_t data;
data = (load_nybble(priv, false) << 4) | load_nybble(priv, false);
return data;
}
/****************************************************************************
* Name: lcd_read_busy_addr
*
* Description:
* Read the busy flag, and, optionally, the current value of the address
* register (data or character generator dependent on a previous command).
*
****************************************************************************/
static bool lcd_read_busy_addr(FAR struct pcf8574_lcd_dev_s *priv,
FAR uint8_t *addr)
{
uint8_t data = lcd_getcmd(priv);
if (NULL != addr)
{
*addr = data & 0x7f;
}
return (data & 0x80) ? true : false;
}
/****************************************************************************
* Name: lcd_init
*
* Description:
* perform the initialization sequence to get the LCD into a known state.
*
****************************************************************************/
static void lcd_init(FAR struct pcf8574_lcd_dev_s *priv)
{
/* Wait for more than 15 ms after Vcc for the LCD to stabilize */
nxsig_usleep(50000);
/* Perform the init sequence. This sequence of commands is constructed so
* that it will get the device into nybble mode irrespective of what state
* the device is currently in (could be 8 bit, 4 bit nyb 0, 4 bit nyb 1).
* By sending the 'set 8-bit mode' three times, we will definitely end up
* in 8 bit mode, and then we can reliably transition to 4 bit mode for
* the remainder of operations.
*/
/* Send Command 0x30, set 8-bit mode, and wait > 4.1 ms */
latch_nybble(priv, 0x30 >> 4, false);
nxsig_usleep(5000);
/* Send Command 0x30, set 8-bit mode, and wait > 100 us */
latch_nybble(priv, 0x30 >> 4, false);
nxsig_usleep(5000);
/* Send Command 0x30, set 8-bit mode */
latch_nybble(priv, 0x30 >> 4, false);
nxsig_usleep(200);
/* now Function set: Set interface to be 4 bits long (only 1 cycle write
* for the first time).
*/
latch_nybble(priv, 0x20 >> 4, false);
nxsig_usleep(5000);
/* Function set: DL=0;Interface is 4 bits, N=1 (2 Lines), F=0 (5x8 dots
* font)
*/
lcd_putcmd(priv, 0x28);
/* Display Off: D=0 (Display off), C=0 (Cursor Off), B=0 (Blinking Off) */
lcd_putcmd(priv, 0x08);
/* Display Clear */
lcd_putcmd(priv, CMD_CLEAR);
up_udelay(DELAY_US_HOMECLEAR); /* clear needs extra time */
/* Entry Mode Set: I/D=1 (Increment), S=0 (No shift) */
lcd_putcmd(priv, 0x06);
/* Display On, Cursor Off */
lcd_putcmd(priv, 0x0c);
}
/****************************************************************************
* Name: lcd_create_char
*
* Description:
* This creates a custom character pattern. There can be 8 5x8 patterns.
* The bitmap proceeds top to bottom, msb-lsb, and is right justified (i.e.
* only bits 4-0 are used). By convention, you are meant to always leave
* the last line (byte) zero so that the cursor can use this line, but this
* is not strictly required.
*
* Input Parameters:
* priv - device instance
* idxchar - which character is being imaged; 0 - 7
* chardata - the character image bitmap; must be 8 bytes always
*
****************************************************************************/
static void lcd_create_char(FAR struct pcf8574_lcd_dev_s *priv,
uint8_t idxchar, FAR const uint8_t *chardata)
{
int nidx;
uint8_t addr;
lcd_read_busy_addr(priv, &addr);
lcd_putcmd(priv, CMD_SET_CGADDR | (idxchar << 3)); /* set CGRAM address */
for (nidx = 0; nidx < 8; ++nidx)
{
lcd_putdata(priv, chardata[nidx]);
}
lcd_putcmd(priv, CMD_SET_DDADDR | addr); /* restore DDRAM address */
}
/****************************************************************************
* Name: lcd_set_curpos
*
* Description:
* This sets the cursor position based on row, column addressing.
*
* Input Parameters:
* priv - device instance
* row - row position
* col - column position
*
****************************************************************************/
static void lcd_set_curpos(FAR struct pcf8574_lcd_dev_s *priv,
uint8_t row, uint8_t col)
{
uint8_t addr;
addr = rc2addr(priv, row, col);
lcd_putcmd(priv, CMD_SET_DDADDR | addr); /* set DDRAM address */
}
/****************************************************************************
* Name: lcd_get_curpos
*
* Description:
* This gets the cursor position based on row, column addressing.
*
* Input Parameters:
* priv - device instance
* row - row position
* col - column position
*
****************************************************************************/
static void lcd_get_curpos(FAR struct pcf8574_lcd_dev_s *priv,
FAR uint8_t *row, FAR uint8_t *col)
{
uint8_t addr;
lcd_read_busy_addr(priv, &addr);
addr2rc(priv, addr, row, col);
}
/****************************************************************************
* Name: lcd_scroll_up
*
* Description:
* Scroll the display up, and clear the new (last) line.
*
****************************************************************************/
static void lcd_scroll_up(FAR struct pcf8574_lcd_dev_s *priv)
{
FAR uint8_t *data;
int nrow;
int ncol;
data = (FAR uint8_t *)kmm_malloc(priv->cfg.cols);
if (NULL == data)
{
lcdinfo("Failed to allocate buffer in lcd_scroll_up()\n");
return;
}
for (nrow = 1; nrow < priv->cfg.rows; ++nrow)
{
lcd_set_curpos(priv, nrow, 0);
for (ncol = 0; ncol < priv->cfg.cols; ++ncol)
{
data[ncol] = lcd_getdata(priv);
}
lcd_set_curpos(priv, nrow - 1, 0);
for (ncol = 0; ncol < priv->cfg.cols; ++ncol)
{
lcd_putdata(priv, data[ncol]);
}
}
lcd_set_curpos(priv, priv->cfg.rows - 1, 0);
for (ncol = 0; ncol < priv->cfg.cols; ++ncol)
{
lcd_putdata(priv, ' ');
}
lcd_set_curpos(priv, priv->cfg.rows - 1, 0);
kmm_free(data);
}
/****************************************************************************
* Name: lcd_codec_action
*
* Description:
* Perform an 'action' as per the Segment LCD codec.
*
* Input Parameters:
* priv - device instance
* code - SLCD code action code
* count - count param for those actions that take it
*
****************************************************************************/
static void lcd_codec_action(FAR struct pcf8574_lcd_dev_s *priv,
enum slcdcode_e code, uint8_t count)
{
switch (code)
{
/* Erasure */
case SLCDCODE_BACKDEL: /* Backspace (backward delete) N characters */
{
if (count <= 0) /* silly case */
{
break;
}
else
{
uint8_t row;
uint8_t col;
lcd_get_curpos(priv, &row, &col);
if (count > col) /* saturate to preceding columns available */
{
count = col;
}
lcd_set_curpos(priv, row, col - count);
}
/* ... and conscientiously fall through to next case ... */
}
case SLCDCODE_FWDDEL: /* Delete (forward delete) N characters, moving text */
{
if (count <= 0) /* silly case */
{
break;
}
else
{
uint8_t row;
uint8_t col;
uint8_t start;
uint8_t end;
uint8_t nidx;
uint8_t data;
lcd_get_curpos(priv, &row, &col);
start = col + count;
if (start >= priv->cfg.cols) /* silly case of nothing left */
{
break;
}
end = start + count;
if (end > priv->cfg.cols) /* saturate */
{
end = priv->cfg.cols;
}
for (nidx = col; nidx < end; ++start, ++nidx) /* much like memmove */
{
lcd_set_curpos(priv, row, start);
data = lcd_getdata(priv);
lcd_set_curpos(priv, row, nidx);
lcd_putdata(priv, data);
}
for (; nidx < priv->cfg.cols; ++nidx) /* much like memset */
{
lcd_putdata(priv, ' ');
}
lcd_set_curpos(priv, row, col);
}
}
break;
case SLCDCODE_ERASE: /* Erase N characters from the cursor position */
if (count > 0)
{
uint8_t row;
uint8_t col;
uint8_t end;
uint8_t nidx;
lcd_get_curpos(priv, &row, &col);
end = col + count;
if (end > priv->cfg.cols)
{
end = priv->cfg.cols;
}
for (nidx = col; nidx < end; ++nidx)
{
lcd_putdata(priv, ' ');
}
lcd_set_curpos(priv, row, col);
}
break;
case SLCDCODE_CLEAR: /* Home the cursor and erase the entire display */
{
lcd_putcmd(priv, CMD_CLEAR);
up_udelay(DELAY_US_HOMECLEAR); /* clear needs extra time */
}
break;
case SLCDCODE_ERASEEOL: /* Erase from the cursor position to the end of
* line */
{
uint8_t row;
uint8_t col;
uint8_t nidx;
lcd_get_curpos(priv, &row, &col);
for (nidx = col; nidx < priv->cfg.cols; ++nidx)
{
lcd_putdata(priv, ' ');
}
lcd_set_curpos(priv, row, col);
}
break;
/* Cursor movement */
case SLCDCODE_LEFT: /* Cursor left by N characters */
{
uint8_t row;
uint8_t col;
lcd_get_curpos(priv, &row, &col);
if (count > col)
{
col = 0;
}
else
{
col -= count;
}
lcd_set_curpos(priv, row, col);
}
break;
case SLCDCODE_RIGHT: /* Cursor right by N characters */
{
uint8_t row;
uint8_t col;
lcd_get_curpos(priv, &row, &col);
col += count;
if (col >= priv->cfg.cols)
{
col = priv->cfg.cols - 1;
}
lcd_set_curpos(priv, row, col);
}
break;
case SLCDCODE_UP: /* Cursor up by N lines */
{
uint8_t row;
uint8_t col;
lcd_get_curpos(priv, &row, &col);
if (count > row)
{
row = 0;
}
else
{
row -= count;
}
lcd_set_curpos(priv, row, col);
}
break;
case SLCDCODE_DOWN: /* Cursor down by N lines */
{
uint8_t row;
uint8_t col;
lcd_get_curpos(priv, &row, &col);
row += count;
if (row >= priv->cfg.rows)
{
row = priv->cfg.rows - 1;
}
lcd_set_curpos(priv, row, col);
}
break;
case SLCDCODE_HOME: /* Cursor home */
{
uint8_t row;
uint8_t col;
lcd_get_curpos(priv, &row, &col);
lcd_set_curpos(priv, row, 0);
}
break;
case SLCDCODE_END: /* Cursor end */
{
uint8_t row;
uint8_t col;
lcd_get_curpos(priv, &row, &col);
lcd_set_curpos(priv, row, priv->cfg.cols - 1);
}
break;
case SLCDCODE_PAGEUP: /* Cursor up by N pages */
case SLCDCODE_PAGEDOWN: /* Cursor down by N pages */
break; /* Not supportable on this SLCD */
/* Blinking */
case SLCDCODE_BLINKSTART: /* Start blinking with current cursor position */
lcd_putcmd(priv, CMD_CURSOR_ON_BLINK);
break;
case SLCDCODE_BLINKEND: /* End blinking after the current cursor
* position */
case SLCDCODE_BLINKOFF: /* Turn blinking off */
lcd_putcmd(priv, CMD_CURSOR_OFF);
break; /* Not implemented */
/* These are actually unreportable errors */
default:
case SLCDCODE_NORMAL: /* Not a special keycode */
break;
}
}
/****************************************************************************
* Name: lcd_fpos_to_curpos
*
* Description:
* Convert a file logical offset to a screen cursor pos (row,col). This
* discounts 'synthesized' line feeds at the end of screen lines.
*
****************************************************************************/
static void lcd_fpos_to_curpos(FAR struct pcf8574_lcd_dev_s *priv,
off_t fpos, FAR uint8_t *row,
FAR uint8_t *col, FAR bool *onlf)
{
int virtcols;
virtcols = (priv->cfg.cols + 1);
/* Determine if this is a 'virtual' position (on the synthetic LF) */
*onlf = (priv->cfg.cols == fpos % virtcols);
/* Adjust off any preceding synthetic LF's to get linear position */
fpos -= fpos / virtcols;
/* Compute row/col from linear position */
*row = fpos / priv->cfg.cols;
*col = fpos % priv->cfg.cols;
}
/****************************************************************************
* Name: lcd_curpos_to_fpos
*
* Description:
* Convert a screen cursor pos (row,col) to a file logical offset. This
* includes 'synthesized' line feeds at the end of screen lines.
*
****************************************************************************/
static void lcd_curpos_to_fpos(FAR struct pcf8574_lcd_dev_s *priv,
uint8_t row, uint8_t col, FAR off_t *fpos)
{
/* the logical file position is the linear position plus any synthetic LF */
*fpos = (row * priv->cfg.cols) + col + row;
}
/****************************************************************************
* Name: pcf8574_lcd_open
*
* Description:
* requisite device 'open' method; we don't do anything special
*
****************************************************************************/
static int pcf8574_lcd_open(FAR struct file *filep)
{
FAR struct inode *inode = filep->f_inode;
FAR struct pcf8574_lcd_dev_s *priv =
(FAR struct pcf8574_lcd_dev_s *)inode->i_private;
/* Increment the reference count */
nxmutex_lock(&priv->lock);
if (priv->refs == MAX_OPENCNT)
{
nxmutex_unlock(&priv->lock);
return -EMFILE;
}
else
{
priv->refs++;
}
nxmutex_unlock(&priv->lock);
return OK;
}
/****************************************************************************
* Name: pcf8574_lcd_close
*
* Description:
* requisite device 'close' method; we don't do anything special
*
****************************************************************************/
static int pcf8574_lcd_close(FAR struct file *filep)
{
FAR struct inode *inode = filep->f_inode;
FAR struct pcf8574_lcd_dev_s *priv =
(FAR struct pcf8574_lcd_dev_s *)inode->i_private;
int ret;
/* Decrement the reference count */
nxmutex_lock(&priv->lock);
if (priv->refs == 0)
{
ret = -EIO;
}
else
{
priv->refs--;
/* If we had previously unlinked, but there were open references at
* the time, we need to do the final teardown now.
*/
if (priv->refs == 0 && priv->unlinked)
{
/* We have no real teardown at present */
}
ret = OK;
}
nxmutex_unlock(&priv->lock);
return ret;
}
/****************************************************************************
* Name: pcf8574_lcd_read
*
* Description:
* This simply reads as much of the display memory as possible. This is
* generally not very interesting, but we do it in a way that allows us to
* 'cat' the LCD contents via the shell.
*
****************************************************************************/
static ssize_t pcf8574_lcd_read(FAR struct file *filep, FAR char *buffer,
size_t buflen)
{
FAR struct inode *inode = filep->f_inode;
FAR struct pcf8574_lcd_dev_s *priv =
(FAR struct pcf8574_lcd_dev_s *)inode->i_private;
int nidx;
uint8_t addr;
uint8_t row;
uint8_t col;
bool onlf;
nxmutex_lock(&priv->lock);
/* Get current cursor position so we can restore it */
lcd_read_busy_addr(priv, &addr);
/* Convert file position to row/col address and position DDADDR there */
lcd_fpos_to_curpos(priv, filep->f_pos, &row, &col, &onlf);
lcd_set_curpos(priv, row, col);
/* Read as much of the display as possible */
nidx = 0;
while (nidx < buflen && row < priv->cfg.rows)
{
/* Synthesize end-of-line LF and advance to start of next row */
if (onlf)
{
/* Synthesize LF for all but last row */
if (row < priv->cfg.rows - 1)
{
buffer[nidx] = '\x0a';
onlf = false;
++filep->f_pos;
++nidx;
}
++row;
col = 0;
continue;
}
/* If we are at start of line we will need to update DDRAM address */
if (0 == col)
{
lcd_set_curpos(priv, row, 0);
}
buffer[nidx] = lcd_getdata(priv);
++filep->f_pos;
++nidx;
++col;
/* If we are now at the end of a line, we setup for the synthetic LF */
if (priv->cfg.cols == col)
{
onlf = true;
}
}
lcd_putcmd(priv, CMD_SET_DDADDR | addr); /* Restore DDRAM address */
nxmutex_unlock(&priv->lock);
return nidx;
}
/****************************************************************************
* Name: pcf8574_lcd_write
*
* Description:
* Output a sequence of characters to the device.
*
****************************************************************************/
static ssize_t pcf8574_lcd_write(FAR struct file *filep,
FAR const char *buffer, size_t buflen)
{
FAR struct inode *inode = filep->f_inode;
FAR struct pcf8574_lcd_dev_s *priv =
(FAR struct pcf8574_lcd_dev_s *)inode->i_private;
struct lib_meminstream_s instream;
uint8_t row;
uint8_t col;
struct slcdstate_s state;
enum slcdret_e result;
uint8_t ch;
uint8_t count;
nxmutex_lock(&priv->lock);
/* Initialize the stream for use with the SLCD CODEC */
lib_meminstream(&instream, buffer, buflen);
/* Get the current cursor position now; we'll keep track of it as we go */
lcd_get_curpos(priv, &row, &col);
/* Now decode and process every byte in the input buffer */
memset(&state, 0, sizeof(struct slcdstate_s));
while ((result = slcd_decode(&instream.public,
&state, &ch, &count)) != SLCDRET_EOF)
{
if (result == SLCDRET_CHAR) /* A normal character was returned */
{
/* Check for ASCII control characters */
if (ch == ASCII_TAB)
{
lcd_putcmd(priv, CMD_CURSOR_ON_BLINK);
}
else if (ch == ASCII_VT)
{
/* Turn the backlight on */
lcd_backlight(priv, true);
}
else if (ch == ASCII_FF)
{
/* Turn the backlight off */
lcd_backlight(priv, false);
}
else if (ch == ASCII_CR)
{
/* Perform a Home */
lcd_putcmd(priv, CMD_HOME);
up_udelay(DELAY_US_HOMECLEAR); /* home needs extra time */
row = 0;
col = 0;
}
else if (ch == ASCII_SO)
{
lcd_putcmd(priv, CMD_CURSOR_OFF);
}
else if (ch == ASCII_SI)
{
/* Perform the re-initialize */
lcd_init(priv);
row = 0;
col = 0;
}
else if (ch == ASCII_LF)
{
/* unixian line term; go to start of next line */
row += 1;
if (row >= priv->cfg.rows)
{
lcd_scroll_up(priv);
row = priv->cfg.rows - 1;
}
col = 0;
lcd_set_curpos(priv, row, col);
}
else if (ch == ASCII_BS)
{
/* Perform the backward deletion */
lcd_codec_action(priv, SLCDCODE_BACKDEL, 1);
lcd_get_curpos(priv, &row, &col);
}
else if (ch == ASCII_DEL)
{
/* Perform the forward deletion */
lcd_codec_action(priv, SLCDCODE_FWDDEL, 1);
lcd_get_curpos(priv, &row, &col);
}
else
{
/* All others are fair game. See if we need to wrap line. */
if (col >= priv->cfg.cols)
{
row += 1;
if (row >= priv->cfg.rows)
{
lcd_scroll_up(priv);
row = priv->cfg.rows - 1;
}
col = 0;
lcd_set_curpos(priv, row, col);
}
lcd_putdata(priv, ch);
++col;
}
}
/* A special SLCD action was returned */
else /* (result == SLCDRET_SPEC) */
{
lcd_codec_action(priv, (enum slcdcode_e)ch, count);
/* we can't know what happened, so it's easier just to re-inquire
* as to where we are.
*/
lcd_get_curpos(priv, &row, &col);
}
}
/* Wherever we wound up, update our logical file pos to reflect it */
lcd_curpos_to_fpos(priv, row, col, &filep->f_pos);
nxmutex_unlock(&priv->lock);
return buflen;
}
/****************************************************************************
* Name: pcf8574_lcd_seek
*
* Description:
* Seek the logical file pointer to the specified position. This is
* probably not very interesting except possibly for (SEEK_SET, 0) to
* rewind the pointer for a subsequent read().
* The file pointer is logical, and includes synthesized LF chars at the
* end of the display lines.
*
****************************************************************************/
static off_t pcf8574_lcd_seek(FAR struct file *filep, off_t offset,
int whence)
{
FAR struct inode *inode = filep->f_inode;
FAR struct pcf8574_lcd_dev_s *priv =
(FAR struct pcf8574_lcd_dev_s *)inode->i_private;
off_t pos;
int maxpos;
nxmutex_lock(&priv->lock);
maxpos = priv->cfg.rows * priv->cfg.cols + (priv->cfg.rows - 1);
pos = filep->f_pos;
switch (whence)
{
case SEEK_CUR:
pos += offset;
if (pos > maxpos)
{
pos = maxpos;
}
else if (pos < 0)
{
pos = 0;
}
filep->f_pos = pos;
break;
case SEEK_SET:
pos = offset;
if (pos > maxpos)
{
pos = maxpos;
}
else if (pos < 0)
{
pos = 0;
}
filep->f_pos = pos;
break;
case SEEK_END:
pos = maxpos + offset;
if (pos > maxpos)
{
pos = maxpos;
}
else if (pos < 0)
{
pos = 0;
}
filep->f_pos = pos;
break;
default:
/* Return EINVAL if the whence argument is invalid */
pos = (off_t) - EINVAL;
break;
}
nxmutex_unlock(&priv->lock);
return pos;
}
/****************************************************************************
* Name: pcf8574_lcd_ioctl
*
* Description:
* Perform device operations that are outside the standard I/O model.
*
****************************************************************************/
static int pcf8574_lcd_ioctl(FAR struct file *filep, int cmd,
unsigned long arg)
{
switch (cmd)
{
case SLCDIOC_GETATTRIBUTES: /* SLCDIOC_GETATTRIBUTES: Get the
* attributes of the SLCD */
{
FAR struct inode *inode = filep->f_inode;
FAR struct pcf8574_lcd_dev_s *priv =
(FAR struct pcf8574_lcd_dev_s *)inode->i_private;
FAR struct slcd_attributes_s *attr =
(FAR struct slcd_attributes_s *)((uintptr_t) arg);
lcdinfo("SLCDIOC_GETATTRIBUTES:\n");
if (!attr)
{
return -EINVAL;
}
attr->nrows = priv->cfg.rows;
attr->ncolumns = priv->cfg.cols;
attr->nbars = 0;
attr->maxcontrast = 0;
attr->maxbrightness = 1; /* 'brightness' for us is the backlight */
}
break;
case SLCDIOC_CURPOS: /* SLCDIOC_CURPOS: Get the SLCD cursor position */
{
FAR struct inode *inode = filep->f_inode;
FAR struct pcf8574_lcd_dev_s *priv =
(FAR struct pcf8574_lcd_dev_s *)inode->i_private;
FAR struct slcd_curpos_s *attr =
(FAR struct slcd_curpos_s *)((uintptr_t) arg);
uint8_t row;
uint8_t col;
nxmutex_lock(&priv->lock);
lcd_get_curpos(priv, &row, &col);
attr->row = row;
attr->column = col;
nxmutex_unlock(&priv->lock);
}
break;
case SLCDIOC_GETBRIGHTNESS: /* Get the current brightness setting */
{
FAR struct inode *inode = filep->f_inode;
FAR struct pcf8574_lcd_dev_s *priv =
(FAR struct pcf8574_lcd_dev_s *)inode->i_private;
bool bon;
bon = (priv->bl_bit && priv->cfg.bl_active_high) ||
(!priv->bl_bit && !priv->cfg.bl_active_high);
*(FAR int *)((uintptr_t) arg) = bon ? 1 : 0;
}
break;
case SLCDIOC_SETBRIGHTNESS: /* Set the brightness to a new value */
{
FAR struct inode *inode = filep->f_inode;
FAR struct pcf8574_lcd_dev_s *priv =
(FAR struct pcf8574_lcd_dev_s *)inode->i_private;
nxmutex_lock(&priv->lock);
lcd_backlight(priv, arg ? true : false);
nxmutex_unlock(&priv->lock);
}
break;
case SLCDIOC_CREATECHAR: /* Create a custom character pattern */
{
FAR struct inode *inode = filep->f_inode;
FAR struct pcf8574_lcd_dev_s *priv =
(FAR struct pcf8574_lcd_dev_s *)inode->i_private;
FAR struct slcd_createchar_s *attr =
(FAR struct slcd_createchar_s *)((uintptr_t) arg);
nxmutex_lock(&priv->lock);
lcd_create_char(priv, attr->idx, attr->bmp);
nxmutex_unlock(&priv->lock);
}
break;
case SLCDIOC_SETBAR: /* SLCDIOC_SETBAR: Set bars on a bar display */
case SLCDIOC_GETCONTRAST: /* SLCDIOC_GETCONTRAST: Get the current
* contrast setting */
case SLCDIOC_SETCONTRAST: /* SLCDIOC_SETCONTRAST: Set the contrast to a
* new value */
default:
return -ENOTTY;
}
return OK;
}
/****************************************************************************
* Name: pcf8574_lcd_poll
****************************************************************************/
static int pcf8574_lcd_poll(FAR struct file *filep, FAR struct pollfd *fds,
bool setup)
{
if (setup)
{
/* Data is always available to be read */
poll_notify(&fds, 1, POLLIN | POLLOUT);
}
return OK;
}
/****************************************************************************
* Name: pcf8574_lcd_unlink
****************************************************************************/
#ifndef CONFIG_DISABLE_PSEUDOFS_OPERATIONS
static int pcf8574_lcd_unlink(FAR struct inode *inode)
{
FAR struct pcf8574_lcd_dev_s *priv =
(FAR struct pcf8574_lcd_dev_s *)inode->i_private;
int ret = OK;
nxmutex_lock(&priv->lock);
priv->unlinked = true;
/* If there are no open references to the driver then tear it down now */
if (priv->refs == 0)
{
/* We have no real teardown at present */
ret = OK;
}
nxmutex_unlock(&priv->lock);
return ret;
}
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: pcf8574_lcd_backpack_register
*
* Description:
* Register a character driver that is an I2C LCD 'backpack' for the
* ever-popular HD44780 based 16x2 LCD via pcf8574 I2C IO expander.
*
****************************************************************************/
int pcf8574_lcd_backpack_register(FAR const char *devpath,
FAR struct i2c_master_s *i2c,
FAR struct pcf8574_lcd_backpack_config_s
*cfg)
{
FAR struct pcf8574_lcd_dev_s *priv;
int ret;
/* Sanity check on geometry */
if (cfg->rows < 1 || cfg->rows > 4)
{
lcdinfo("Display rows must be 1-4\n");
return -EINVAL;
}
if ((cfg->cols < 1 || cfg->cols > 64) ||
(cfg->rows == 4 && cfg->cols > 32))
{
lcdinfo("Display cols must be 1-64, and may not be part of a 4x40 "
"configuration\n");
return -EINVAL;
}
/* Initialize the device structure */
priv = (FAR struct pcf8574_lcd_dev_s *)
kmm_malloc(sizeof(struct pcf8574_lcd_dev_s));
if (!priv)
{
lcdinfo("Failed to allocate instance\n");
return -ENOMEM;
}
priv->i2c = i2c;
priv->cfg = *cfg;
priv->bl_bit = priv->cfg.bl_active_high ? 0 : (1 << priv->cfg.bl);
priv->refs = 0;
priv->unlinked = false;
nxmutex_init(&priv->lock);
/* Initialize */
lcd_init(priv);
/* If SLCD is console enable the backlight from start */
#ifdef CONFIG_SLCD_CONSOLE
lcd_backlight(priv, true);
#endif
/* Register the character driver */
ret = register_driver(devpath, &g_pcf8574_lcd_fops, 0666, priv);
if (ret < 0)
{
lcdinfo("Failed to register driver: %d\n", ret);
nxmutex_destroy(&priv->lock);
kmm_free(priv);
}
lcdinfo("pcf8574_lcd_backpack driver loaded successfully!\n");
return ret;
}
|
3090eed9d36a0707ebd4c52bddcd746f0a37b0a4
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/bouffalo_lab/libraries/bl_mcu_sdk/drivers/lhal/include/bflb_sec_trng.h
|
a710703018d50571678a920502f513a609756542
|
[
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 1,077
|
h
|
bflb_sec_trng.h
|
#ifndef _BFLB_SEC_TRNG_H
#define _BFLB_SEC_TRNG_H
#include "bflb_core.h"
/** @addtogroup LHAL
* @{
*/
/** @addtogroup TRNG
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Read trng data.
*
* @param [in] dev device handle
* @param [in] data pointer to trng data
* @return A negated errno value on failure.
*/
int bflb_trng_read(struct bflb_device_s *dev, uint8_t data[32]);
/**
* @brief Read trng data with custom length.
*
* @param [in] data pointer to trng data
* @param [in] len length to read
* @return A negated errno value on failure.
*/
int bflb_trng_readlen(uint8_t *data, uint32_t len);
/**
* @brief Get trng data.
*
* @return trng data with word
*/
long random(void);
/**
* @brief Enable trng in group0.
*
* @param [in] dev device handle
*/
void bflb_group0_request_trng_access(struct bflb_device_s *dev);
/**
* @brief Disable trng in group0.
*
* @param [in] dev device handle
*/
void bflb_group0_release_trng_access(struct bflb_device_s *dev);
#ifdef __cplusplus
}
#endif
/**
* @}
*/
/**
* @}
*/
#endif
|
966a5a6d108e0c7be0f9297d3f39f20e43ef66b1
|
10a8580aa44d33b7458429023c00de8c01ceda98
|
/axiom/nr_custom_events.h
|
c26291e20ada46163c5ea313acde2d3e99bdc424
|
[
"BSD-4-Clause-UC",
"Apache-2.0"
] |
permissive
|
newrelic/newrelic-php-agent
|
87ad20e0a5abf0d2855e7d27a25c36454ae4389a
|
dfb359f0dbb53e4cbc5106b52c8f3807c7fc8d42
|
refs/heads/main
| 2023-08-15T10:28:24.372352
| 2023-08-14T17:29:31
| 2023-08-14T17:29:31
| 302,112,572
| 116
| 67
|
Apache-2.0
| 2023-09-13T18:33:47
| 2020-10-07T17:35:01
|
C
|
UTF-8
|
C
| false
| false
| 1,159
|
h
|
nr_custom_events.h
|
/*
* Copyright 2020 New Relic Corporation. All rights reserved.
* SPDX-License-Identifier: Apache-2.0
*/
/*
* Custom events allow the user to add non-transaction events.
*/
#ifndef NR_CUSTOM_EVENTS_HDR
#define NR_CUSTOM_EVENTS_HDR
#include "nr_analytics_events.h"
#include "util_random.h"
#include "util_time.h"
/*
* Purpose : Add a new custom event to an event pool.
*
* Params : 1. The custom events being added to.
* 2. A string which will be set as the "type" field in the event.
* 3. A hash of key/value pairs. The value of each should
* be a string, numeric, bool, or null.
* 4. The current time. This is passed as a parameter for easier
* unit testing.
* 5. A random number generator to be used if sampling is required.
*/
extern void nr_custom_events_add_event(nr_analytics_events_t* custom_events,
const char* type,
const nrobj_t* params,
nrtime_t now,
nr_random_t* rnd);
#endif /* NR_CUSTOM_EVENTS_HDR */
|
ddf0ade1bfaa064a53fb134d29532353653308ee
|
0cc343d927d5db6693006018986715c43acab961
|
/examples/shared_boxes/stack_hp/test_node_tracker.c
|
324059756e6b2f347940739046a56fbd886ef61d
|
[
"MIT"
] |
permissive
|
verifast/verifast
|
ec0101fc4a69bd33c5f66be4444169c4e060ead8
|
d152da790c7ebf72ce616533a6c83082629adbdb
|
refs/heads/master
| 2023-08-25T00:13:51.464802
| 2023-08-13T10:00:00
| 2023-08-13T10:00:00
| 14,519,163
| 325
| 64
|
NOASSERTION
| 2023-08-10T21:16:08
| 2013-11-19T08:57:02
|
OCaml
|
UTF-8
|
C
| false
| false
| 1,587
|
c
|
test_node_tracker.c
|
//@ #include "cperm_ex.gh"
struct node {
void *data;
struct node *next;
//@ int trackerId;
};
/*@
predicate node(struct node *node; struct node *next, void *data, int trackerId) =
malloc_block_node(node) &*&
node != 0 &*&
node->next |-> next &*&
node->data |-> data &*&
node->trackerId |-> trackerId;
predicate node_helper(struct node *node; pair<pair<struct node *, void*> , int> out) =
node(node, ?next, ?data, ?trackerId) &*&
out == pair(pair(next, data), trackerId);
lemma void node_helper_store_trackerId(struct node *node, int trackerId)
requires node_helper(node, ?p);
ensures node_helper(node, pair(fst(p), trackerId));
{
open node_helper(node, p);
open node(node, _, _, _);
node->trackerId = trackerId;
close node(node, _, _, _);
close node_helper(node, _);
}
lemma void create_node_helper_tracker(struct node* node)
requires node(node, ?next, ?data, _);
ensures object_tracker(node_helper, node, 0, pair(next, data));
{
close node_helper(node, _);
produce_lemma_function_pointer_chunk(node_helper_store_trackerId)
: object_set_trackerId<struct node*, pair<struct node*, void*> >(node_helper)(arg1, arg2) { call(); }
{
create_object_tracker(node_helper, node);
}
}
lemma void test(struct node* node)
requires node(node, _, _, _);
ensures node(node, _, _, _);
{
create_node_helper_tracker(node);
destroy_object_tracker(node_helper, node);
open node_helper(node, _);
}
@*/
|
d65073bff4813a627577e1a18713ee818dcfb3df
|
33377c4d113cf9ea1338077af6bd645f3c5796b3
|
/extensions/android/ringlibsdl/project/jni/SDL2_mixer/dynamic_ogg.h
|
1f0bda4e4e38529b3df3c3d2a89883923655a412
|
[
"LicenseRef-scancode-free-unknown",
"MIT",
"Zlib",
"GPL-1.0-or-later"
] |
permissive
|
ring-lang/ring
|
56f55111f751b0274d4f588871f806a8c2734dea
|
2081d2efb41c9dacd49b7a6944b9ca332638ba64
|
refs/heads/master
| 2023-09-04T16:54:44.309452
| 2023-09-03T10:28:57
| 2023-09-03T10:28:57
| 54,633,811
| 1,360
| 555
|
MIT
| 2023-08-03T01:48:24
| 2016-03-24T10:29:27
|
C
|
UTF-8
|
C
| false
| false
| 1,986
|
h
|
dynamic_ogg.h
|
/*
SDL_mixer: An audio mixer library based on the SDL library
Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
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. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#ifdef OGG_MUSIC
#if defined(OGG_HEADER)
#include OGG_HEADER
#elif defined(OGG_USE_TREMOR)
#include <tremor/ivorbisfile.h>
#else
#include <vorbis/vorbisfile.h>
#endif
typedef struct {
int loaded;
void *handle;
int (*ov_clear)(OggVorbis_File *vf);
vorbis_info *(*ov_info)(OggVorbis_File *vf,int link);
int (*ov_open_callbacks)(void *datasource, OggVorbis_File *vf, const char *initial, long ibytes, ov_callbacks callbacks);
ogg_int64_t (*ov_pcm_total)(OggVorbis_File *vf,int i);
#ifdef OGG_USE_TREMOR
long (*ov_read)(OggVorbis_File *vf,char *buffer,int length, int *bitstream);
#else
long (*ov_read)(OggVorbis_File *vf,char *buffer,int length, int bigendianp,int word,int sgned,int *bitstream);
#endif
#ifdef OGG_USE_TREMOR
int (*ov_time_seek)(OggVorbis_File *vf,ogg_int64_t pos);
#else
int (*ov_time_seek)(OggVorbis_File *vf,double pos);
#endif
} vorbis_loader;
extern vorbis_loader vorbis;
#endif /* OGG_MUSIC */
extern int Mix_InitOgg();
extern void Mix_QuitOgg();
|
29f5fb3e218765237f794cfce31f94e73d493631
|
99bdb3251fecee538e0630f15f6574054dfc1468
|
/bsp/gd32/arm/libraries/GD32F30x_Firmware_Library/GD32F30x_usbfs_library/device/class/dfu/Include/dfu_mal.h
|
e0af991ca4d6d2b41fce6e62bb50d55523169116
|
[
"Apache-2.0",
"Zlib",
"LicenseRef-scancode-proprietary-license",
"MIT",
"BSD-3-Clause",
"X11",
"BSD-4-Clause-UC",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
RT-Thread/rt-thread
|
03a7c52c2aeb1b06a544143b0e803d72f47d1ece
|
3602f891211904a27dcbd51e5ba72fefce7326b2
|
refs/heads/master
| 2023-09-01T04:10:20.295801
| 2023-08-31T16:20:55
| 2023-08-31T16:20:55
| 7,408,108
| 9,599
| 5,805
|
Apache-2.0
| 2023-09-14T13:37:26
| 2013-01-02T14:49:21
|
C
|
UTF-8
|
C
| false
| false
| 3,390
|
h
|
dfu_mal.h
|
/*!
\file dfu_mal.h
\brief USB DFU device media access layer header file
\version 2020-08-01, V3.0.0, firmware for GD32F30x
*/
/*
Copyright (c) 2020, GigaDevice Semiconductor Inc.
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. Neither the name of the copyright holder 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 __DFU_MAL_H
#define __DFU_MAL_H
#include "usbd_conf.h"
typedef struct _dfu_mal_prop
{
const uint8_t* pstr_desc;
uint8_t (*mal_init) (void);
uint8_t (*mal_deinit) (void);
uint8_t (*mal_erase) (uint32_t addr);
uint8_t (*mal_write) (uint8_t *buf, uint32_t addr, uint32_t len);
uint8_t* (*mal_read) (uint8_t *buf, uint32_t addr, uint32_t len);
uint8_t (*mal_checkaddr) (uint32_t addr);
const uint32_t erase_timeout;
const uint32_t write_timeout;
} dfu_mal_prop;
typedef enum
{
MAL_OK = 0,
MAL_FAIL
} MAL_Status;
#define _1st_BYTE(x) (uint8_t)((x) & 0xFF) /*!< addressing cycle 1st byte */
#define _2nd_BYTE(x) (uint8_t)(((x) & 0xFF00) >> 8) /*!< addressing cycle 2nd byte */
#define _3rd_BYTE(x) (uint8_t)(((x) & 0xFF0000) >> 16) /*!< addressing cycle 3rd byte */
#define SET_POLLING_TIMEOUT(x) buffer[0] = _1st_BYTE(x);\
buffer[1] = _2nd_BYTE(x);\
buffer[2] = _3rd_BYTE(x);
/* function declarations */
/* initialize the memory media on the GD32 */
uint8_t dfu_mal_init(void);
/* deinitialize the memory media on the GD32 */
uint8_t dfu_mal_deinit(void);
/* erase a memory sector */
uint8_t dfu_mal_erase(uint32_t addr);
/* write data to sectors of memory */
uint8_t dfu_mal_write(uint8_t *buf, uint32_t addr, uint32_t len);
/* read data from sectors of memory */
uint8_t* dfu_mal_read(uint8_t *buf, uint32_t addr, uint32_t len);
/* get the status of a given memory and store in buffer */
uint8_t dfu_mal_getstatus(uint32_t addr, uint8_t cmd, uint8_t *buffer);
#endif /* __DFU_MAL_H */
|
98d0fd2692b978a5f41d965d677c57090bdd085d
|
b61818b74d0f10c0580ddec16d085aa5e9171fb2
|
/src/pipe/modules/cnn/ingest.c
|
37bf4e43d89726b85e0e01398c8ab07be53802a8
|
[
"LGPL-2.0-only",
"BSD-2-Clause"
] |
permissive
|
hanatos/vkdt
|
8d52444b40d3e0478bbaf0100b66e21f8bf05561
|
04ef97d5a7e091661b66dbee1fb71994bfbb6ffb
|
refs/heads/master
| 2023-08-03T16:12:49.335070
| 2023-08-01T13:25:47
| 2023-08-01T13:26:13
| 196,389,968
| 249
| 28
|
BSD-2-Clause
| 2023-09-08T19:09:54
| 2019-07-11T12:27:14
|
C
|
UTF-8
|
C
| false
| false
| 3,318
|
c
|
ingest.c
|
// ingest the files from gmic:
// gmic ./gmic_denoise_cnn.gmz k[3] unserialize repeat '$!' 'l[$>]' o '{b}'.pfm endl done
//
#include "core/half.h"
#include "core/lut.h"
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <assert.h>
static inline float
tolittle(float f)
{
uint32_t i = *(uint32_t *)&f;
i = (i>>24) | ((i>>8) & 0xff00) | ((i<<8)&0xff0000) | (i<<24);
return *(float *)&i;
}
int main(int argc, char *argv[])
{
const char *fn[] = {
"BLUR.pfm",
"C1_0.pfm",
"C2_0.pfm",
"C3_0.pfm",
"C4_0.pfm",
"C5_0.pfm",
"C6_0.pfm",
"C7_0.pfm",
"C8_0.pfm",
"C9_0.pfm",
"C10_0.pfm",
"C11_0.pfm",
"C12_0.pfm",
"C13_0.pfm",
"C14_0.pfm",
"C15_0.pfm",
"C16.pfm",
};
const int num = 17;
const int maxwd = 145; // max width on input
const int maxht = num * 16; // allocate a bit too much
int nic = 3, noc = 6; // number of input and output channels
uint16_t *buf = calloc(sizeof(uint16_t), 4*maxwd*maxht);
uint16_t *output = buf;
for(int fi=0;fi<num;fi++)
{
FILE *f = fopen(fn[fi], "rb");
int wd, ht;
fscanf(f, "Pf\n%d %d\n%*[^\n]", &wd, &ht);
assert(wd <= maxwd);
float *input = calloc(sizeof(float), wd*ht);
fgetc(f);
fread(input, sizeof(float), wd*ht, f);
fclose(f);
if(fi == 0 || fi == num-1)
{ // BLUR or C16
// compress 76x3 pixels to 76x1 (collapse outputs so we get matrix columns)
// or 145x3 -> 145x1
assert(ht == 3);
for(int i=0;i<wd;i++)
for(int j=0;j<3;j++)
output[4*i+j] = float_to_half(tolittle(input[wd*(ht-1-j) + i]));
if(fi == 0) noc = 6; // blurred + appended
else noc = 3; // last conv layer with rgb output
output += maxwd * 4; // both have only 3 output channels that consume weights
}
else
{ // these are mostly 145x16, i.e. 16*9+1 (3x3 kernel + bias)
// re-swizzle into 145x4
// the first time around it's 55x16
const int str = 9; // 3x3 conv
// const float filter[] = {0.1, 0.5, 0.1};
noc = ht;
assert(noc == 16);
assert(nic*str + 1 == wd); // width of input texture includes bias
for(int k=0;k<str;k++) // convolution kernel position
for(int i=0;i<nic;i++) // input channel
for(int j=0;j<noc;j++) // output channel
{
// const int ii = k%3, jj=k/3;
const int oy = j/4, or = j - 4*oy;
output[maxwd*4*oy + 4*str*i + 4*k + or]
// = float_to_half(filter[jj]*filter[ii]);
= float_to_half(
tolittle(input[wd*(ht-1-j) + str*i + k]));
}
for(int j=0;j<(noc+3)/4;j++) // bias at end of each line
for(int c=0;c<4;c++)
if(4*j+c < noc)
output[4*(maxwd*j + wd - 1) + c] = float_to_half(
tolittle(input[wd*(ht-1-4*j-c)+wd-1]));
output += maxwd * ((noc+3)/4)*4;
}
nic = noc;
free(input);
}
dt_lut_header_t header = (dt_lut_header_t) {
.magic = dt_lut_header_magic,
.version = dt_lut_header_version,
.channels = 4,
.datatype = dt_lut_header_f16,
.wd = maxwd,
.ht = maxht,
};
FILE *f = fopen("cnn.lut", "wb");
fwrite(&header, sizeof(header), 1, f);
fwrite(buf, sizeof(uint16_t)*4, maxwd*maxht, f);
fclose(f);
exit(0);
}
|
93c38396cd3c47eeac4dbaef82c185d85f01fbfd
|
4ddf82eeb31d46fb67802a4375390eb42a8f23b8
|
/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.h
|
02d34fc42f052b232352c2ddd325c4a20c385b37
|
[
"MIT"
] |
permissive
|
pulkin/micropython
|
1437a507b9e90c8824e80c3553e6209d89e64565
|
c274c947c611f510fd2b1c4ef6cbd9f4283794fc
|
refs/heads/master
| 2023-03-08T02:35:28.208819
| 2022-04-19T12:38:47
| 2022-04-19T12:38:47
| 167,732,676
| 103
| 36
|
MIT
| 2023-02-25T03:02:36
| 2019-01-26T19:57:59
|
C
|
UTF-8
|
C
| false
| false
| 272
|
h
|
mpconfigboard.h
|
#define MICROPY_HW_BOARD_NAME "i.MX RT1010 EVK"
#define MICROPY_HW_MCU_NAME "MIMXRT1011DAE5A"
#define BOARD_FLASH_SIZE (16 * 1024 * 1024)
#define MICROPY_HW_LED_PINMUX IOMUXC_GPIO_11_GPIOMUX_IO11
#define MICROPY_HW_LED_PORT GPIO1
#define MICROPY_HW_LED_PIN 11
|
762a191f3ffb404f9bb4c033d7bc4adcb3273c19
|
ea8fc70c7dbf49059431fa45a940742736c68fb8
|
/ext/http/client/header.c
|
42c197409ca2f95201e7d3518e5e57e156080281
|
[
"BSD-3-Clause"
] |
permissive
|
dreamsxin/cphalcon7
|
1bd2194a251657b48857326927db69fef617ab91
|
1b8c6b04b4ca237a5ead87d4752df0d2e85c7a9d
|
refs/heads/master
| 2023-03-08T04:53:08.829432
| 2022-07-07T07:48:59
| 2022-07-07T07:48:59
| 47,245,335
| 298
| 73
| null | 2021-06-22T11:53:25
| 2015-12-02T07:44:43
|
C
|
UTF-8
|
C
| false
| false
| 14,233
|
c
|
header.c
|
/*
+------------------------------------------------------------------------+
| Phalcon Framework |
+------------------------------------------------------------------------+
| Copyright (c) 2011-2013 Phalcon Team (http://www.phalconphp.com) |
+------------------------------------------------------------------------+
| This source file is subject to the New BSD License that is bundled |
| with this package in the file docs/LICENSE.txt. |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send an email |
| to license@phalconphp.com so we can send you a copy immediately. |
+------------------------------------------------------------------------+
| Authors: Andres Gutierrez <andres@phalconphp.com> |
| Eduar Carvajal <eduar@phalconphp.com> |
| ZhuZongXin <dreamsxin@qq.com> |
+------------------------------------------------------------------------+
*/
#include "http/client/header.h"
#include <ext/spl/spl_iterators.h>
#include "kernel/main.h"
#include "kernel/memory.h"
#include "kernel/operators.h"
#include "kernel/object.h"
#include "kernel/array.h"
#include "kernel/concat.h"
#include "kernel/fcall.h"
#include "kernel/exception.h"
#include "kernel/file.h"
#include "kernel/hash.h"
#include "kernel/string.h"
/**
* Phalcon\Http\Client\Header
*/
zend_class_entry *phalcon_http_client_header_ce;
PHP_METHOD(Phalcon_Http_Client_Header, __construct);
PHP_METHOD(Phalcon_Http_Client_Header, set);
PHP_METHOD(Phalcon_Http_Client_Header, setStatusCode);
PHP_METHOD(Phalcon_Http_Client_Header, setMultiple);
PHP_METHOD(Phalcon_Http_Client_Header, addMultiple);
PHP_METHOD(Phalcon_Http_Client_Header, get);
PHP_METHOD(Phalcon_Http_Client_Header, getStatusCode);
PHP_METHOD(Phalcon_Http_Client_Header, getAll);
PHP_METHOD(Phalcon_Http_Client_Header, remove);
PHP_METHOD(Phalcon_Http_Client_Header, parse);
PHP_METHOD(Phalcon_Http_Client_Header, build);
PHP_METHOD(Phalcon_Http_Client_Header, count);
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_http_client_header_set, 0, 0, 2)
ZEND_ARG_INFO(0, name)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_http_client_header_setstatuscode, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_http_client_header_setmultiple, 0, 0, 1)
ZEND_ARG_INFO(0, values)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_http_client_header_addmultiple, 0, 0, 1)
ZEND_ARG_INFO(0, values)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_http_client_header_get, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_http_client_header_remove, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_http_client_header_parse, 0, 0, 1)
ZEND_ARG_INFO(0, content)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(arginfo_phalcon_http_client_header_build, 0, 0, 0)
ZEND_ARG_INFO(0, flags)
ZEND_END_ARG_INFO()
static const zend_function_entry phalcon_http_client_header_method_entry[] = {
PHP_ME(Phalcon_Http_Client_Header, __construct, arginfo_empty, ZEND_ACC_PUBLIC|ZEND_ACC_CTOR)
PHP_ME(Phalcon_Http_Client_Header, set, arginfo_phalcon_http_client_header_set, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Http_Client_Header, setStatusCode, arginfo_phalcon_http_client_header_setstatuscode, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Http_Client_Header, setMultiple, arginfo_phalcon_http_client_header_setmultiple, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Http_Client_Header, addMultiple, arginfo_phalcon_http_client_header_addmultiple, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Http_Client_Header, get, arginfo_phalcon_http_client_header_get, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Http_Client_Header, getStatusCode, arginfo_empty, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Http_Client_Header, getAll, arginfo_empty, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Http_Client_Header, remove, arginfo_phalcon_http_client_header_remove, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Http_Client_Header, parse, arginfo_phalcon_http_client_header_parse, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Http_Client_Header, build, arginfo_phalcon_http_client_header_build, ZEND_ACC_PUBLIC)
PHP_ME(Phalcon_Http_Client_Header, count, arginfo_empty, ZEND_ACC_PUBLIC)
PHP_FE_END
};
/**
* Phalcon\Http\Client\Header initializer
*/
PHALCON_INIT_CLASS(Phalcon_Http_Client_Header){
PHALCON_REGISTER_CLASS(Phalcon\\Http\\Client, Header, http_client_header, phalcon_http_client_header_method_entry, 0);
zend_declare_property_null(phalcon_http_client_header_ce, SL("_messages"), ZEND_ACC_PROTECTED|ZEND_ACC_STATIC);
zend_declare_property_null(phalcon_http_client_header_ce, SL("_fields"), ZEND_ACC_PROTECTED);
zend_declare_property_long(phalcon_http_client_header_ce, SL("_version"), 1, ZEND_ACC_PROTECTED);
zend_declare_property_long(phalcon_http_client_header_ce, SL("_status_code"), 0, ZEND_ACC_PROTECTED);
zend_declare_property_null(phalcon_http_client_header_ce, SL("_status_message"), ZEND_ACC_PROTECTED);
zend_declare_property_null(phalcon_http_client_header_ce, SL("_status"), ZEND_ACC_PROTECTED);
zend_declare_class_constant_long(phalcon_http_client_header_ce, SL("BUILD_STATUS"), PHALCON_HTTP_CLIENT_HEADER_BUILD_STATUS);
zend_declare_class_constant_long(phalcon_http_client_header_ce, SL("BUILD_FIELDS"), PHALCON_HTTP_CLIENT_HEADER_BUILD_FIELDS);
zend_class_implements(phalcon_http_client_header_ce, 1, zend_ce_countable);
return SUCCESS;
}
/**
* Phalcon\Http\Client\Header constructor
*/
PHP_METHOD(Phalcon_Http_Client_Header, __construct){
zval messages = {};
array_init(&messages);
phalcon_array_update_long_string(&messages, 100, SL("Continue"), 0);
phalcon_array_update_long_string(&messages, 101, SL("Switching Protocols"), 0);
phalcon_array_update_long_string(&messages, 200, SL("OK"), 0);
phalcon_array_update_long_string(&messages, 201, SL("Created"), 0);
phalcon_array_update_long_string(&messages, 202, SL("Accepted"), 0);
phalcon_array_update_long_string(&messages, 203, SL("Non-Authoritative Information"), 0);
phalcon_array_update_long_string(&messages, 204, SL("No Content"), 0);
phalcon_array_update_long_string(&messages, 205, SL("Reset Content"), 0);
phalcon_array_update_long_string(&messages, 206, SL("Partial Content"), 0);
phalcon_array_update_long_string(&messages, 300, SL("Multiple Choices"), 0);
phalcon_array_update_long_string(&messages, 301, SL("Moved Permanently"), 0);
phalcon_array_update_long_string(&messages, 302, SL("Found"), 0);
phalcon_array_update_long_string(&messages, 303, SL("See Other"), 0);
phalcon_array_update_long_string(&messages, 304, SL("Not Modified"), 0);
phalcon_array_update_long_string(&messages, 305, SL("Use Proxy"), 0);
phalcon_array_update_long_string(&messages, 306, SL("(Unused)"), 0);
phalcon_array_update_long_string(&messages, 307, SL("Temporary Redirect"), 0);
phalcon_array_update_long_string(&messages, 400, SL("Bad Request"), 0);
phalcon_array_update_long_string(&messages, 401, SL("Unauthorized"), 0);
phalcon_array_update_long_string(&messages, 402, SL("Payment Required"), 0);
phalcon_array_update_long_string(&messages, 403, SL("Forbidden"), 0);
phalcon_array_update_long_string(&messages, 404, SL("Not Found"), 0);
phalcon_array_update_long_string(&messages, 405, SL("Method Not Allowed"), 0);
phalcon_array_update_long_string(&messages, 406, SL("Not Acceptable"), 0);
phalcon_array_update_long_string(&messages, 407, SL("Proxy Authentication Required"), 0);
phalcon_array_update_long_string(&messages, 408, SL("Request Timeout"), 0);
phalcon_array_update_long_string(&messages, 409, SL("Conflict"), 0);
phalcon_array_update_long_string(&messages, 410, SL("Gone"), 0);
phalcon_array_update_long_string(&messages, 411, SL("Length Required"), 0);
phalcon_array_update_long_string(&messages, 412, SL("Precondition Failed"), 0);
phalcon_array_update_long_string(&messages, 413, SL("Request Entity Too Large"), 0);
phalcon_array_update_long_string(&messages, 414, SL("Request-URI Too Long"), 0);
phalcon_array_update_long_string(&messages, 415, SL("Unsupported Media Type"), 0);
phalcon_array_update_long_string(&messages, 416, SL("Requested Range Not Satisfiable"), 0);
phalcon_array_update_long_string(&messages, 417, SL("Expectation Failed"), 0);
phalcon_array_update_long_string(&messages, 500, SL("Internal Server Error"), 0);
phalcon_array_update_long_string(&messages, 501, SL("Not Implemented"), 0);
phalcon_array_update_long_string(&messages, 502, SL("Bad Gateway"), 0);
phalcon_array_update_long_string(&messages, 503, SL("Service Unavailable"), 0);
phalcon_array_update_long_string(&messages, 504, SL("Gateway Timeout"), 0);
phalcon_array_update_long_string(&messages, 505, SL("HTTP Version Not Supported"), 0);
phalcon_array_update_long_string(&messages, 506, SL("Bandwidth Limit Exceeded"), 0);
phalcon_update_static_property_ce(phalcon_http_client_header_ce, SL("_messages"), &messages);
phalcon_update_property_empty_array(getThis(), SL("_fields"));
zval_ptr_dtor(&messages);
}
PHP_METHOD(Phalcon_Http_Client_Header, set){
zval *name, *value;
phalcon_fetch_params(0, 2, 0, &name, &value);
phalcon_update_property_array(getThis(), SL("_fields"), name, value);
}
PHP_METHOD(Phalcon_Http_Client_Header, setStatusCode){
zval *value;
phalcon_fetch_params(0, 1, 0, &value);
phalcon_update_property(getThis(), SL("_status_code"), value);
}
PHP_METHOD(Phalcon_Http_Client_Header, setMultiple){
zval *values;
phalcon_fetch_params(0, 1, 0, &values);
phalcon_update_property(getThis(), SL("_fields"), values);
}
PHP_METHOD(Phalcon_Http_Client_Header, addMultiple){
zval *values, fields = {};
phalcon_fetch_params(0, 1, 0, &values);
phalcon_read_property(&fields, getThis(), SL("_fields"), PH_NOISY|PH_READONLY);
phalcon_array_merge_recursive_n(&fields, values);
phalcon_update_property(getThis(), SL("_fields"), &fields);
}
PHP_METHOD(Phalcon_Http_Client_Header, get){
zval *name;
phalcon_fetch_params(0, 1, 0, &name);
phalcon_read_property_array(return_value, getThis(), SL("_fields"), name, PH_COPY);
}
PHP_METHOD(Phalcon_Http_Client_Header, getStatusCode){
RETURN_MEMBER(getThis(), "_status_code");
}
PHP_METHOD(Phalcon_Http_Client_Header, getAll){
RETURN_MEMBER(getThis(), "_fields");
}
PHP_METHOD(Phalcon_Http_Client_Header, remove){
zval *name;
phalcon_fetch_params(0, 1, 0, &name);
phalcon_unset_property_array(getThis(), SL("_fields"), name);
}
PHP_METHOD(Phalcon_Http_Client_Header, parse){
zval *content, content_parts = {}, *header;
phalcon_fetch_params(0, 1, 0, &content);
if (PHALCON_IS_EMPTY(content)) {
RETURN_FALSE;
}
if (Z_TYPE_P(content) == IS_STRING) {
phalcon_fast_explode_str(&content_parts, SL("\r\n"), content);
} else if (Z_TYPE_P(content) == IS_ARRAY) {
ZVAL_COPY(&content_parts, content);
} else {
RETURN_FALSE;
}
ZEND_HASH_FOREACH_VAL(Z_ARRVAL(content_parts), header) {
zval header_parts = {}, val1 = {}, val2 = {}, trimmed = {};
if (Z_TYPE_P(header) == IS_STRING) {
if (phalcon_memnstr_str(header , SL(":"))) {
phalcon_fast_explode_str(&header_parts, SL(":"), header);
} else {
if (phalcon_start_with_str(header , SL("HTTP/"))) {
phalcon_fast_explode_str(&header_parts, SL(" "), header);
if (Z_TYPE(header_parts) == IS_ARRAY && phalcon_array_isset_fetch_long(&val1, &header_parts, 1, PH_READONLY)
&& phalcon_array_isset_fetch_long(&val2, &header_parts, 2, PH_READONLY)) {
phalcon_update_property(getThis(), SL("_status_code"), &val1);
phalcon_update_property(getThis(), SL("_status_message"), &val2);
}
zval_ptr_dtor(&header_parts);
}
continue;
}
} else {
ZVAL_COPY(&header_parts, header);
}
if (Z_TYPE(header_parts) == IS_ARRAY && phalcon_array_isset_fetch_long(&val1, &header_parts, 0, PH_READONLY)
&& phalcon_array_isset_fetch_long(&val2, &header_parts, 1, PH_READONLY)) {
ZVAL_STR(&trimmed, phalcon_trim(&val2, NULL, PHALCON_TRIM_BOTH));
PHALCON_CALL_METHOD(NULL, getThis(), "set", &val1, &trimmed);
zval_ptr_dtor(&trimmed);
}
zval_ptr_dtor(&header_parts);
} ZEND_HASH_FOREACH_END();
zval_ptr_dtor(&content_parts);
}
PHP_METHOD(Phalcon_Http_Client_Header, build)
{
zval *flags = NULL, messages = {}, status_code = {}, lines = {}, message = {}, version = {}, fields = {}, *value, join_filed = {};
zend_string *str_key;
zend_ulong idx;
int f = 0;
phalcon_fetch_params(0, 0, 1, &flags);
if (flags) {
f = phalcon_get_intval(flags);
}
phalcon_read_static_property_ce(&messages, phalcon_http_client_header_ce, SL("_messages"), PH_READONLY);
phalcon_read_property(&status_code, getThis(), SL("_status_code"), PH_NOISY|PH_READONLY);
array_init(&lines);
if ((f & PHALCON_HTTP_CLIENT_HEADER_BUILD_STATUS) && phalcon_array_isset_fetch(&message, &messages, &status_code, PH_READONLY)) {
zval line = {};
phalcon_read_property(&version, getThis(), SL("_version "), PH_NOISY|PH_READONLY);
PHALCON_CONCAT_SVS(&line, "HTTP/", &version, " ");
PHALCON_SCONCAT_VSV(&line, &status_code, " ", &message);
phalcon_merge_append(&lines, &line);
zval_ptr_dtor(&line);
}
phalcon_read_property(&fields, getThis(), SL("_fields"), PH_NOISY|PH_READONLY);
ZEND_HASH_FOREACH_KEY_VAL(Z_ARRVAL(fields), idx, str_key, value) {
zval filed = {}, tmp = {};
if (str_key) {
ZVAL_STR(&filed, str_key);
} else {
ZVAL_LONG(&filed, idx);
}
PHALCON_CONCAT_VSV(&tmp, &filed, ": ", value);
phalcon_merge_append(&lines, &tmp);
zval_ptr_dtor(&tmp);
} ZEND_HASH_FOREACH_END();
if (f & PHALCON_HTTP_CLIENT_HEADER_BUILD_FIELDS) {
phalcon_fast_join_str(&join_filed, SL("\r\n"), &lines);
zval_ptr_dtor(&lines);
RETURN_ZVAL(&join_filed, 0, 0);
}
RETURN_ZVAL(&lines, 0, 0);
}
PHP_METHOD(Phalcon_Http_Client_Header, count){
zval fields = {};
phalcon_read_property(&fields, getThis(), SL("_fields"), PH_NOISY|PH_READONLY);
phalcon_fast_count(return_value, &fields);
}
|
801b87ad8953e1ddb389e5d2d34c08cc42b6fae3
|
9f03fa3dda35ad0eabd05187639604057e50b3e0
|
/source/opencv2/opencv_core.h
|
67871a120b9f1205f9868fda980bb3fde9fddcac
|
[
"Apache-2.0"
] |
permissive
|
php-opencv/php-opencv
|
09f699d5d05e797147598f12f93443670dfa5df5
|
72364b0c18a66c122a206431e2328559897f2c43
|
refs/heads/master
| 2023-06-23T01:18:05.308751
| 2023-03-31T15:36:16
| 2023-03-31T15:36:16
| 133,700,311
| 314
| 49
|
Apache-2.0
| 2023-06-16T21:33:34
| 2018-05-16T17:16:52
|
C++
|
UTF-8
|
C
| false
| false
| 4,420
|
h
|
opencv_core.h
|
/*
+----------------------------------------------------------------------+
| PHP-OpenCV |
+----------------------------------------------------------------------+
| This source file is subject to version 2.0 of the Apache license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.apache.org/licenses/LICENSE-2.0.html |
| If you did not receive a copy of the Apache2.0 license and are unable|
| to obtain it through the world-wide-web, please send a note to |
| hihozhou@gmail.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: HaiHao Zhou <hihozhou@gmail.com> |
+----------------------------------------------------------------------+
*/
#ifndef PHP_OPENCV_CORE_H
#define PHP_OPENCV_CORE_H
#include "../../php_opencv.h"
extern void opencv_core_init(int module_number);
extern zend_class_entry *opencv_formatter_ce;
PHP_FUNCTION(opencv_add_weighted);
ZEND_BEGIN_ARG_INFO_EX(opencv_add_weighted_arginfo, 0, 0, 7)
ZEND_ARG_INFO(0, src1)
ZEND_ARG_INFO(0, alpha)
ZEND_ARG_INFO(0, src2)
ZEND_ARG_INFO(0, beta)
ZEND_ARG_INFO(0, gamma)
ZEND_ARG_INFO(1, dst)
ZEND_ARG_INFO(0, dtype)
ZEND_END_ARG_INFO()
PHP_FUNCTION(opencv_split);
ZEND_BEGIN_ARG_INFO_EX(opencv_merge_arginfo, 0, 0, 2)
ZEND_ARG_INFO(0, channels)
ZEND_ARG_INFO(1, dst)
ZEND_END_ARG_INFO()
PHP_FUNCTION(opencv_merge);
PHP_FUNCTION(opencv_get_optimal_dft_size);
PHP_FUNCTION(opencv_copy_make_border);
ZEND_BEGIN_ARG_INFO_EX(opencv_copy_make_border_arginfo, 0, 0, 8)
ZEND_ARG_INFO(0, src)
ZEND_ARG_INFO(1, dst)
ZEND_ARG_INFO(0, top)
ZEND_ARG_INFO(0, bottom)
ZEND_ARG_INFO(0, left)
ZEND_ARG_INFO(0, right)
ZEND_ARG_INFO(0, borderType)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(opencv_dft_arginfo, 0, 0, 4)
ZEND_ARG_INFO(0, src)
ZEND_ARG_INFO(1, dst)
ZEND_ARG_INFO(0, flags)
ZEND_ARG_INFO(0, nonzeroRows)
ZEND_END_ARG_INFO()
PHP_FUNCTION(opencv_dft);
ZEND_BEGIN_ARG_INFO_EX(opencv_magnitude_arginfo, 0, 0, 3)
ZEND_ARG_INFO(0, x)
ZEND_ARG_INFO(0, y)
ZEND_ARG_INFO(1, magnitude)
ZEND_END_ARG_INFO()
PHP_FUNCTION(opencv_magnitude);
ZEND_BEGIN_ARG_INFO_EX(opencv_add_arginfo, 0, 0, 5)
ZEND_ARG_INFO(0, src1)
ZEND_ARG_INFO(0, src2)
ZEND_ARG_INFO(1, dst)
ZEND_ARG_INFO(0, mask)
ZEND_ARG_INFO(0, dtype)
ZEND_END_ARG_INFO()
PHP_FUNCTION(opencv_add);
ZEND_BEGIN_ARG_INFO_EX(opencv_log_arginfo, 0, 0, 2)
ZEND_ARG_INFO(0, src)
ZEND_ARG_INFO(1, dst)
ZEND_END_ARG_INFO()
PHP_FUNCTION(opencv_log);
ZEND_BEGIN_ARG_INFO_EX(opencv_normalize_arginfo, 0, 0, 6)
ZEND_ARG_INFO(0, src)
ZEND_ARG_INFO(1, dst)
ZEND_ARG_INFO(0, alpha)
ZEND_ARG_INFO(0, beta)
ZEND_ARG_INFO(0, norm_type)
ZEND_ARG_INFO(0, dtype)
ZEND_END_ARG_INFO()
PHP_FUNCTION(opencv_normalize);
ZEND_BEGIN_ARG_INFO_EX(opencv_norm_arginfo, 0, 0, 2)
ZEND_ARG_INFO(0, src)
ZEND_ARG_INFO(0, norm_type)
ZEND_END_ARG_INFO()
PHP_FUNCTION(opencv_norm);
ZEND_BEGIN_ARG_INFO_EX(opencv_absdiff_arginfo, 0, 0, 3)
ZEND_ARG_INFO(0, src1)
ZEND_ARG_INFO(0, src2)
ZEND_ARG_INFO(1, dst)
ZEND_END_ARG_INFO()
PHP_FUNCTION(opencv_absdiff);
ZEND_BEGIN_ARG_INFO_EX(opencv_lut_arginfo, 0, 0, 3)
ZEND_ARG_INFO(0, src)
ZEND_ARG_INFO(0, lut)
ZEND_ARG_INFO(1, dst)
ZEND_END_ARG_INFO()
PHP_FUNCTION(opencv_lut);
ZEND_BEGIN_ARG_INFO_EX(opencv_mean_std_dev_arginfo, 0, 0, 3)
ZEND_ARG_INFO(0, src)
ZEND_ARG_INFO(1, mean)
ZEND_ARG_INFO(1, sdv)
ZEND_END_ARG_INFO()
PHP_FUNCTION(opencv_mean_std_dev);
#endif //OPENCV_CORE_H
|
c8865ccae8160638ff66f2dafd91e31e0e90c0fe
|
a11e4bdd6157b22067288d860507fa20abea033d
|
/src/modules/mixer/bin/main.c
|
e3cf48447d6bfc429bfe5faf934ea0bae8f9432b
|
[
"BSD-2-Clause"
] |
permissive
|
JeffHoogland/moksha
|
85a0f39dc97daa61d35e64a511013d21552db288
|
c56013644d8cd8e32101bb38a8d1e4ebd9d47f37
|
refs/heads/master
| 2023-08-24T05:39:13.415948
| 2023-08-22T19:49:32
| 2023-08-22T19:49:32
| 34,704,822
| 179
| 51
|
NOASSERTION
| 2023-09-06T14:41:31
| 2015-04-28T02:59:19
|
C
|
UTF-8
|
C
| false
| false
| 683
|
c
|
main.c
|
#include "../lib/common.h"
#include "../lib/epulse.h"
#include "main_window.h"
#define DEFAULT_HEIGHT 600
#define DEFAULT_WIDTH 800
EAPI int
elm_main(int argc EINA_UNUSED, char *argv[] EINA_UNUSED)
{
Evas_Object *win;
EINA_SAFETY_ON_FALSE_RETURN_VAL(epulse_common_init("epulse"), EXIT_FAILURE);
EINA_SAFETY_ON_FALSE_RETURN_VAL(epulse_init() > 0, EXIT_FAILURE);
win = main_window_add();
evas_object_resize(win, DEFAULT_WIDTH, DEFAULT_HEIGHT);
evas_object_show(win);
elm_run();
epulse_common_shutdown();
epulse_shutdown();
return 0;
}
/*
* Create the default main() that will work with both quicklaunch or
* regular applications.
*/
ELM_MAIN()
|
c509831f1bf490934b919d784885866e7797c911
|
d6819033d5c0d68ec0522c872c057c00da6b2789
|
/kernel/src/devices/kbd.c
|
2cf475e81ab7227581263ee31cb1fc774624edfc
|
[
"MIT"
] |
permissive
|
29jm/SnowflakeOS
|
d9b0c2a12f03c0b1e5a5f61477f802d2f653be94
|
fe51e646a78bf4ccee45e5e563cd3a25d76f7690
|
refs/heads/master
| 2023-07-11T02:26:32.590836
| 2023-06-28T00:00:58
| 2023-07-07T13:57:08
| 38,449,214
| 356
| 26
|
MIT
| 2023-06-28T00:08:44
| 2015-07-02T18:18:01
|
C
|
UTF-8
|
C
| false
| false
| 8,901
|
c
|
kbd.c
|
#include <kernel/kbd.h>
#include <kernel/ps2.h>
#include <kernel/irq.h>
#include <kernel/sys.h>
#include <stdio.h>
#include <ctype.h>
// Contains keycode mappings for one-byte scancodes
// A zero means the index isn't a valid scancode
uint32_t simple_sc_to_kc[] = {
0, KBD_F9, 0, KBD_F5,
KBD_F4, KBD_F1, KBD_F2, KBD_F12,
0, KBD_F10, KBD_F8, KBD_F6,
KBD_F4, KBD_TAB, KBD_BACKTICK, 0,
0, KBD_LEFT_ALT, KBD_LEFT_SHIFT, 0,
KBD_LEFT_CONTROL, KBD_Q, KBD_1, 0,
0, 0, KBD_Z, KBD_S,
KBD_A, KBD_W, KBD_2, 0,
0, KBD_C, KBD_X, KBD_D,
KBD_E, KBD_4, KBD_3, 0,
0, KBD_SPACE, KBD_V, KBD_F,
KBD_T, KBD_R, KBD_5, 0,
0, KBD_N, KBD_B, KBD_H,
KBD_G, KBD_Y, KBD_6, 0,
0, 0, KBD_M, KBD_J,
KBD_U, KBD_7, KBD_8, 0,
0, KBD_COMMA, KBD_K, KBD_I,
KBD_O, KBD_0, KBD_9, 0,
0, KBD_PERIOD, KBD_SLASH, KBD_L,
KBD_SEMICOLON, KBD_P, KBD_MINUS, 0,
0, 0, KBD_TICK, 0,
KBD_LEFT_SQUARE, KBD_EQUAL, 0, 0,
KBD_CAPSLOCK, KBD_RIGHT_SHIFT, KBD_ENTER, KBD_RIGHT_SQUARE,
0, KBD_BACKSLASH, 0, 0,
0, 0, 0, 0,
0, 0, KBD_BACKSPACE, 0,
0, KBD_KP_1, 0, KBD_KP_4,
KBD_KP_7, 0, 0, 0,
KBD_KP_0, KBD_KP_PERIOD, KBD_KP_2, KBD_KP_5,
KBD_KP_6, KBD_KP_8, KBD_ESCAPE, KBD_NUMLOCK,
KBD_F11, KBD_KP_PLUS, KBD_KP_3, KBD_KP_MINUS,
KBD_KP_MUL, KBD_KP_9, KBD_SCROLLLOCK, 0,
0, 0, 0, KBD_F7
};
// Maps relevant scancodes to their printable ASCII counterparts
char kc_to_char[] = {
' ',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'\t', ' ', ',', '.', '\x08', '\'', '`', '/', '\\', ';',
'+', '-', '=', '[', ']', '\x0A', '\x1B',
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'.', '+', '-', '*',
'/', '\x0A'
};
static uint32_t device;
static kbd_context_t context;
static bool key_states[256] = { false };
static kbd_event_t next_event;
static kbd_callback_t callback;
void init_kbd(uint32_t dev) {
device = dev;
context = (kbd_context_t) {
.state = KBD_NORMAL,
.alt = false,
.alt_gr = false,
.shift = false,
.super = false,
.control = false
};
irq_register_handler(IRQ1, kbd_handler);
// Get the current scancode set
ps2_write_device(device, KBD_SSC_CMD);
ps2_expect_ack();
ps2_write_device(device, KBD_SSC_GET);
ps2_expect_ack();
uint8_t scancode_set = ps2_read(PS2_DATA);
if (scancode_set != KBD_SSC_2) {
printke("wrong scancode set (%d), TODO", scancode_set);
}
// Start receiving IRQ1s
ps2_write_device(device, PS2_DEV_ENABLE_SCAN);
ps2_expect_ack();
}
void kbd_handler(registers_t* regs) {
UNUSED(regs);
uint8_t sc = ps2_read(PS2_DATA);
if (!kbd_process_byte(&context, sc, &next_event)) {
return; // We're in the middle of a scancode
}
// We've received a full scancode
key_states[next_event.keycode] = next_event.pressed;
switch (next_event.keycode) {
case KBD_LEFT_ALT:
context.alt = next_event.pressed;
break;
case KBD_RIGHT_ALT:
context.alt_gr = next_event.pressed;
break;
case KBD_LEFT_CONTROL:
case KBD_RIGHT_CONTROL:
context.control = next_event.pressed;
break;
case KBD_LEFT_SHIFT:
case KBD_RIGHT_SHIFT:
context.shift = next_event.pressed;
break;
case KBD_SUPER:
context.super = next_event.pressed;
break;
}
next_event.repr = kbd_keycode_to_char(next_event.keycode, context.shift);
if (callback) {
callback(next_event);
}
}
/* Interprets the received byte according to the current keyboard state and
* previously received bytes.
* Returns whether a full scancode was just received, in which case `event` is
* filled with the corresponding key event.
* Note: expects `event` not to be modified between calls.
*/
bool kbd_process_byte(kbd_context_t* ctx, uint8_t sc, kbd_event_t* event) {
if (sc == PS2_DEV_ACK) {
return false;
}
ctx->scancode[ctx->current++] = sc;
switch (ctx->state) {
case KBD_NORMAL:
event->pressed = true;
if (sc == 0xF0) {
ctx->state = KBD_RELEASE_SHORT;
} else if (sc == 0xE0 || sc == 0xE1) {
ctx->state = KBD_CONTINUE;
} else {
ctx->current = 0;
event->keycode = simple_sc_to_kc[sc];
}
break;
case KBD_RELEASE_SHORT:
ctx->state = KBD_NORMAL;
ctx->current = 0;
event->keycode = simple_sc_to_kc[sc];
event->pressed = false;
break;
case KBD_CONTINUE:
if (sc == 0xF0 && (ctx->current-1) == 1) {
event->pressed = false;
break;
}
if (kbd_is_valid_scancode(ctx->scancode, ctx->current,
&event->keycode)) {
ctx->state = KBD_NORMAL;
ctx->current = 0;
}
break;
}
return ctx->state == KBD_NORMAL;
}
/* Returns whether `bytes` is a valid, complete multibyte scancode.
* If it is, the corresponding key code is placed in `keycode`.
* Note: hopefully this type of scancode is a "prefix code", otherwise this
* is pure hell.
*/
bool kbd_is_valid_scancode(uint8_t* bytes, uint32_t len, uint32_t* keycode) {
if (len < 2) {
return false;
}
// Discard the 0xE0 prefix
bytes = &bytes[1];
len -= 1;
// The 0xF0 prefix indicates a release event, discard it
if (bytes[0] == 0xF0) {
bytes = &bytes[1];
len -= 1;
}
if (len == 1) {
switch (bytes[0]) {
case 0x75: *keycode = KBD_UP; return true;
case 0x72: *keycode = KBD_DOWN; return true;
case 0x6B: *keycode = KBD_LEFT; return true;
case 0x74: *keycode = KBD_RIGHT; return true;
case 0x4A: *keycode = KBD_KP_SLASH; return true;
case 0x5A: *keycode = KBD_KP_ENTER; return true;
case 0x69: *keycode = KBD_END; return true;
case 0x6C: *keycode = KBD_HOME; return true;
case 0x70: *keycode = KBD_INSERT; return true;
case 0x71: *keycode = KBD_DELETE; return true;
case 0x7D: *keycode = KBD_PAGE_UP; return true;
case 0x7A: *keycode = KBD_PAGE_DOWN; return true;
case 0x11: *keycode = KBD_RIGHT_ALT; return true;
case 0x2F: *keycode = KBD_MENU; return true;
case 0x1F: *keycode = KBD_SUPER; return true;
}
}
if (len == 3) {
if (bytes[0] == 0x12 && bytes[1] == 0xE0 && bytes[2] == 0x7C) {
*keycode = KBD_PRINT_SCREEN;
return true;
}
}
if (len == 4) {
if (bytes[0] == 0x7C && bytes[1] == 0xE0
&& bytes[2] == 0xF0 && bytes[3] == 0x12) {
*keycode = KBD_PRINT_SCREEN;
return true;
}
}
// Just assume the bytes are good, there's only one option here
// It also means we'll never overflow our `bytes` buffer in the calling
// function
if (len == 7) {
*keycode = KBD_PAUSE;
return true;
}
return false;
}
bool kbd_is_key_pressed(uint32_t keycode) {
return key_states[keycode];
}
/* Returns the shifted version of printable character `c` if applicable, and
* `c` otherwise.
*/
char kbd_make_shift(char c) {
if (c >= 'a' && c <= 'z') {
return toupper(c);
}
switch (c) {
case '`': return '~';
case '1': return '!';
case '2': return '@';
case '3': return '#';
case '4': return '$';
case '5': return '%';
case '6': return '^';
case '7': return '&';
case '8': return '*';
case '9': return '(';
case '0': return ')';
case '-': return '_';
case '=': return '+';
case '[': return '{';
case ']': return '}';
case ';': return ':';
case '\'': return '"';
case ',': return '<';
case '.': return '>';
case '/': return '?';
case '\\': return '|';
}
return c;
}
/* Returns the character that corresponds to the given keycode+modifiers combo.
* TODO: handle all relevant modifiers.
*/
char kbd_keycode_to_char(uint32_t keycode, bool shift) {
if (keycode >= KBD_KP_ENTER) {
return '\0';
}
char c = kc_to_char[keycode];
if (shift) {
c = kbd_make_shift(c);
}
return c;
}
/* Sets the function to call when a keyboard event is received.
*/
void kbd_set_callback(kbd_callback_t handler) {
if (callback) {
printke("overwriting callback");
}
callback = handler;
}
|
2bf941bf3d9e42351831fd6d78d1de733ea55ed1
|
5eff7a36d9a9917dce9111f0c3074375fe6f7656
|
/app/xmag/CutPaste.c
|
36a4a13b31240755f64c6e0f8bdc001c426977fb
|
[
"LicenseRef-scancode-xfree86-1.0",
"MIT-open-group"
] |
permissive
|
openbsd/xenocara
|
cb392d02ebba06f6ff7d826fd8a89aa3b8401779
|
a012b5de33ea0b977095d77316a521195b26cc6b
|
refs/heads/master
| 2023-08-25T12:16:58.862008
| 2023-08-12T16:16:25
| 2023-08-12T16:16:25
| 66,967,384
| 177
| 66
| null | 2023-07-22T18:12:37
| 2016-08-30T18:36:01
|
C
|
UTF-8
|
C
| false
| false
| 3,780
|
c
|
CutPaste.c
|
/*
Copyright 1989, 1998 The Open Group
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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 OPEN GROUP 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 of The Open Group shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from The Open Group.
*/
/*
* Author: Davor Matic, MIT X Consortium
*/
#include <X11/IntrinsicP.h>
#include <X11/Xmu/StdSel.h>
#include <X11/Xmu/Atoms.h>
#include <X11/Xatom.h>
#include "ScaleP.h" /* This file should be part of the Scale widget */
#include "Scale.h"
#include "CutPaste.h"
#include <stdio.h>
/*ARGSUSED*/
static Boolean
ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
XtPointer *value, unsigned long *length, int *format)
{
Boolean success;
if (*target == XA_PIXMAP || *target == XA_BITMAP) {
ScaleWidget sw = (ScaleWidget) w;
Pixmap *pixmap = (Pixmap *) XtMalloc(sizeof(Pixmap));
*pixmap = XCreatePixmap(XtDisplay(w), XtWindow(w),
sw->scale.image->width,
sw->scale.image->height,
sw->scale.image->depth);
XPutImage(XtDisplay(w), *pixmap, sw->scale.gc, sw->scale.image,
0, 0, 0, 0, sw->scale.image->width, sw->scale.image->height);
*type = XA_PIXMAP;
*value = (XtPointer) pixmap;
*length = 1;
*format = 32;
success = True;
} else {
/* Xt will always respond to selection requests for the TIMESTAMP
target, so we can pass a bogus time to XmuConvertStandardSelection.
In addition to the targets provided by XmuConvertStandardSelection,
Xt converts MULTIPLE, and we convert PIXMAP and BITMAP.
*/
success = XmuConvertStandardSelection(w, (Time)0, selection, target,
type, (XPointer *)value, length,
format);
if (success && *target == XA_TARGETS(XtDisplay(w))) {
Atom* tmp;
tmp = (Atom *) XtRealloc(*value, (*length + 3) * sizeof(Atom));
tmp[(*length)++] = XInternAtom(XtDisplay(w), "MULTIPLE", False);
tmp[(*length)++] = XA_PIXMAP;
tmp[(*length)++] = XA_BITMAP;
*value = (XtPointer) tmp;
}
}
return success;
}
void
SWGrabSelection(Widget w, Time time)
{
(void) XtOwnSelection(w, XA_PRIMARY, time, ConvertSelection, NULL, NULL);
}
/*ARGSUSED*/
static void
SelectionCallback(Widget w, XtPointer client_data, Atom *selection,
Atom *type, XtPointer value, unsigned long *length,
int *format)
{
if (*type == XA_PIXMAP) {
Pixmap *pixmap;
XImage *image;
Window root;
int x, y;
unsigned int width, height, border_width, depth;
pixmap = (Pixmap *) value;
XGetGeometry(XtDisplay(w), *pixmap, &root, &x, &y,
&width, &height, &border_width, &depth);
image = XGetImage(XtDisplay(w), *pixmap, 0, 0, width, height,
AllPlanes, ZPixmap);
SWAutoscale(w, NULL, NULL, NULL);
SWSetImage(w, image);
XtFree(value);
XDestroyImage(image);
}
}
void
SWRequestSelection(Widget w, Time time)
{
XtGetSelectionValue(w, XA_PRIMARY, XA_PIXMAP, SelectionCallback, NULL,
time);
}
|
4a802c661c0e41c99a9703e6689680e0855ee9e3
|
7c857119fe1505b1d80d6e62969661c06dc1a2f4
|
/FileSystems/GrubFS/grub/grub-core/lib/minilzo/lzoconf.h
|
155b47d57a85b11aa7a23be3de0913dc4047f1ed
|
[
"BSD-2-Clause",
"GPL-3.0-only"
] |
permissive
|
CloverHackyColor/CloverBootloader
|
7042ca7dd6b513d22be591a295e49071ae1482ee
|
2711170df4f60b2ae5aa20add3e00f35cf57b7e5
|
refs/heads/master
| 2023-08-30T22:14:34.590134
| 2023-08-27T19:14:02
| 2023-08-27T19:14:02
| 205,810,121
| 4,734
| 770
|
BSD-2-Clause
| 2023-09-03T12:41:33
| 2019-09-02T08:22:14
|
C
|
UTF-8
|
C
| false
| false
| 15,668
|
h
|
lzoconf.h
|
/* lzoconf.h -- configuration of the LZO data compression library
This file is part of the LZO real-time data compression library.
Copyright (C) 2011 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
The LZO library 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.
The LZO library 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 the LZO library; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Markus F.X.J. Oberhumer
<markus@oberhumer.com>
http://www.oberhumer.com/opensource/lzo/
*/
#ifndef __LZOCONF_H_INCLUDED
#define __LZOCONF_H_INCLUDED 1
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/BaseMemoryLib.h>
#define LZO_VERSION 0x2050
#define LZO_VERSION_STRING "2.05"
#define LZO_VERSION_DATE "Apr 23 2011"
#define CHAR_BIT 8
#define UCHAR_MAX 0xFF
#define USHRT_MAX 0xFFFF
#define ULONG_MAX 0xFFFFFFFF
#if defined(MDE_CPU_IA32) || defined(MDE_CPU_ARM)
#define UINT_MAX 0xFFFFFFFF
#else
#define UINT_MAX 0xFFFFFFFFFFFFFFFF
#endif
/* internal Autoconf configuration file - only used when building LZO */
#if defined(LZO_HAVE_CONFIG_H)
# include <config.h>
#endif
/***********************************************************************
// LZO requires a conforming <limits.h>
************************************************************************/
#if !defined(CHAR_BIT) || (CHAR_BIT != 8)
# error "invalid CHAR_BIT"
#endif
#if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
# error "check your compiler installation"
#endif
#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
# error "your limits.h macros are broken"
#endif
/* get OS and architecture defines */
#ifndef __LZODEFS_H_INCLUDED
#include "lzodefs.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************************
// some core defines
************************************************************************/
#if !defined(LZO_UINT32_C)
# if (UINT_MAX < LZO_0xffffffffL)
# define LZO_UINT32_C(c) c ## UL
# else
# define LZO_UINT32_C(c) ((c) + 0U)
# endif
#endif
/* memory checkers */
#if !defined(__LZO_CHECKER)
# if defined(__BOUNDS_CHECKING_ON)
# define __LZO_CHECKER 1
# elif defined(__CHECKER__)
# define __LZO_CHECKER 1
# elif defined(__INSURE__)
# define __LZO_CHECKER 1
# elif defined(__PURIFY__)
# define __LZO_CHECKER 1
# endif
#endif
/***********************************************************************
// integral and pointer types
************************************************************************/
/* lzo_uint should match size_t */
#if !defined(LZO_UINT_MAX)
# if defined(LZO_ABI_LLP64) /* WIN64 */
# if defined(LZO_OS_WIN64)
typedef unsigned __int64 lzo_uint;
typedef __int64 lzo_int;
# else
typedef unsigned long long size_t;
typedef unsigned long long lzo_uint;
typedef long long lzo_int;
# endif
# define LZO_UINT_MAX 0xffffffffffffffffull
# define LZO_INT_MAX 9223372036854775807LL
# define LZO_INT_MIN (-1LL - LZO_INT_MAX)
# elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */
typedef unsigned int size_t;
typedef unsigned int lzo_uint;
typedef int lzo_int;
# define LZO_UINT_MAX UINT_MAX
# define LZO_INT_MAX INT_MAX
# define LZO_INT_MIN INT_MIN
# elif (ULONG_MAX >= LZO_0xffffffffL)
typedef unsigned long size_t;
typedef unsigned long lzo_uint;
typedef long lzo_int;
# define LZO_UINT_MAX ULONG_MAX
# define LZO_INT_MAX LONG_MAX
# define LZO_INT_MIN LONG_MIN
# else
# error "lzo_uint"
# endif
#endif
/* Integral types with 32 bits or more. */
#if !defined(LZO_UINT32_MAX)
# if (UINT_MAX >= LZO_0xffffffffL)
typedef unsigned int lzo_uint32;
typedef int lzo_int32;
# define LZO_UINT32_MAX UINT_MAX
# define LZO_INT32_MAX INT_MAX
# define LZO_INT32_MIN INT_MIN
# elif (ULONG_MAX >= LZO_0xffffffffL)
typedef unsigned long lzo_uint32;
typedef long lzo_int32;
# define LZO_UINT32_MAX ULONG_MAX
# define LZO_INT32_MAX LONG_MAX
# define LZO_INT32_MIN LONG_MIN
# else
# error "lzo_uint32"
# endif
#endif
/* Integral types with exactly 64 bits. */
#if !defined(LZO_UINT64_MAX)
# if (LZO_UINT_MAX >= LZO_0xffffffffL)
# if ((((LZO_UINT_MAX) >> 31) >> 31) == 3)
# define lzo_uint64 lzo_uint
# define lzo_int64 lzo_int
# define LZO_UINT64_MAX LZO_UINT_MAX
# define LZO_INT64_MAX LZO_INT_MAX
# define LZO_INT64_MIN LZO_INT_MIN
# endif
# elif (ULONG_MAX >= LZO_0xffffffffL)
# if ((((ULONG_MAX) >> 31) >> 31) == 3)
typedef unsigned long lzo_uint64;
typedef long lzo_int64;
# define LZO_UINT64_MAX ULONG_MAX
# define LZO_INT64_MAX LONG_MAX
# define LZO_INT64_MIN LONG_MIN
# endif
# endif
#endif
/* The larger type of lzo_uint and lzo_uint32. */
#if (LZO_UINT_MAX >= LZO_UINT32_MAX)
# define lzo_xint lzo_uint
#else
# define lzo_xint lzo_uint32
#endif
/* Memory model that allows to access memory at offsets of lzo_uint. */
#if !defined(__LZO_MMODEL)
# if (LZO_UINT_MAX <= UINT_MAX)
# define __LZO_MMODEL /*empty*/
# elif defined(LZO_HAVE_MM_HUGE_PTR)
# define __LZO_MMODEL_HUGE 1
# define __LZO_MMODEL __huge
# else
# define __LZO_MMODEL /*empty*/
# endif
#endif
/* no typedef here because of const-pointer issues */
#define lzo_bytep unsigned char __LZO_MMODEL *
#define lzo_charp char __LZO_MMODEL *
#define lzo_voidp void __LZO_MMODEL *
#define lzo_shortp short __LZO_MMODEL *
#define lzo_ushortp unsigned short __LZO_MMODEL *
#define lzo_uint32p lzo_uint32 __LZO_MMODEL *
#define lzo_int32p lzo_int32 __LZO_MMODEL *
#if defined(LZO_UINT64_MAX)
#define lzo_uint64p lzo_uint64 __LZO_MMODEL *
#define lzo_int64p lzo_int64 __LZO_MMODEL *
#endif
#define lzo_uintp lzo_uint __LZO_MMODEL *
#define lzo_intp lzo_int __LZO_MMODEL *
#define lzo_xintp lzo_xint __LZO_MMODEL *
#define lzo_voidpp lzo_voidp __LZO_MMODEL *
#define lzo_bytepp lzo_bytep __LZO_MMODEL *
/* deprecated - use 'lzo_bytep' instead of 'lzo_byte *' */
#define lzo_byte unsigned char __LZO_MMODEL
typedef int lzo_bool;
/***********************************************************************
// function types
************************************************************************/
/* name mangling */
#if !defined(__LZO_EXTERN_C)
# ifdef __cplusplus
# define __LZO_EXTERN_C extern "C"
# else
# define __LZO_EXTERN_C extern
# endif
#endif
/* calling convention */
#if !defined(__LZO_CDECL)
# define __LZO_CDECL __lzo_cdecl
#endif
/* DLL export information */
#if !defined(__LZO_EXPORT1)
# define __LZO_EXPORT1 /*empty*/
#endif
#if !defined(__LZO_EXPORT2)
# define __LZO_EXPORT2 /*empty*/
#endif
/* __cdecl calling convention for public C and assembly functions */
#if !defined(LZO_PUBLIC)
# define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
#endif
#if !defined(LZO_EXTERN)
# define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
#endif
#if !defined(LZO_PRIVATE)
# define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL
#endif
/* function types */
typedef int
(__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len,
lzo_bytep dst, lzo_uintp dst_len,
lzo_voidp wrkmem );
typedef int
(__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len,
lzo_bytep dst, lzo_uintp dst_len,
lzo_voidp wrkmem );
typedef int
(__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len,
lzo_bytep dst, lzo_uintp dst_len,
lzo_voidp wrkmem );
typedef int
(__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len,
lzo_bytep dst, lzo_uintp dst_len,
lzo_voidp wrkmem,
const lzo_bytep dict, lzo_uint dict_len );
typedef int
(__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len,
lzo_bytep dst, lzo_uintp dst_len,
lzo_voidp wrkmem,
const lzo_bytep dict, lzo_uint dict_len );
/* Callback interface. Currently only the progress indicator ("nprogress")
* is used, but this may change in a future release. */
struct lzo_callback_t;
typedef struct lzo_callback_t lzo_callback_t;
#define lzo_callback_p lzo_callback_t __LZO_MMODEL *
/* malloc & free function types */
typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t)
(lzo_callback_p self, lzo_uint items, lzo_uint size);
typedef void (__LZO_CDECL *lzo_free_func_t)
(lzo_callback_p self, lzo_voidp ptr);
/* a progress indicator callback function */
typedef void (__LZO_CDECL *lzo_progress_func_t)
(lzo_callback_p, lzo_uint, lzo_uint, int);
struct lzo_callback_t
{
/* custom allocators (set to 0 to disable) */
lzo_alloc_func_t nalloc; /* [not used right now] */
lzo_free_func_t nfree; /* [not used right now] */
/* a progress indicator callback function (set to 0 to disable) */
lzo_progress_func_t nprogress;
/* NOTE: the first parameter "self" of the nalloc/nfree/nprogress
* callbacks points back to this struct, so you are free to store
* some extra info in the following variables. */
lzo_voidp user1;
lzo_xint user2;
lzo_xint user3;
};
/***********************************************************************
// error codes and prototypes
************************************************************************/
/* Error codes for the compression/decompression functions. Negative
* values are errors, positive values will be used for special but
* normal events.
*/
#define LZO_E_OK 0
#define LZO_E_ERROR (-1)
#define LZO_E_OUT_OF_MEMORY (-2) /* [lzo_alloc_func_t failure] */
#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */
#define LZO_E_INPUT_OVERRUN (-4)
#define LZO_E_OUTPUT_OVERRUN (-5)
#define LZO_E_LOOKBEHIND_OVERRUN (-6)
#define LZO_E_EOF_NOT_FOUND (-7)
#define LZO_E_INPUT_NOT_CONSUMED (-8)
#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */
#define LZO_E_INVALID_ARGUMENT (-10)
#ifndef lzo_sizeof_dict_t
# define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep))
#endif
/* lzo_init() should be the first function you call.
* Check the return code !
*
* lzo_init() is a macro to allow checking that the library and the
* compiler's view of various types are consistent.
*/
#define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
(int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
(int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
(int)sizeof(lzo_callback_t))
LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int);
/* version functions (useful for shared libraries) */
LZO_EXTERN(unsigned) lzo_version(void);
LZO_EXTERN(const char *) lzo_version_string(void);
LZO_EXTERN(const char *) lzo_version_date(void);
LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
/* string functions */
LZO_EXTERN(int)
lzo_memcmp(const lzo_voidp a, const lzo_voidp b, lzo_uint len);
LZO_EXTERN(lzo_voidp)
lzo_memcpy(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
LZO_EXTERN(lzo_voidp)
lzo_memmove(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
LZO_EXTERN(lzo_voidp)
lzo_memset(lzo_voidp buf, int c, lzo_uint len);
/* checksum functions */
LZO_EXTERN(lzo_uint32)
lzo_adler32(lzo_uint32 c, const lzo_bytep buf, lzo_uint len);
LZO_EXTERN(lzo_uint32)
lzo_crc32(lzo_uint32 c, const lzo_bytep buf, lzo_uint len);
LZO_EXTERN(const lzo_uint32p)
lzo_get_crc32_table(void);
/* misc. */
LZO_EXTERN(int) _lzo_config_check(void);
typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
typedef union { void *vp; lzo_bytep bp; lzo_uint u; lzo_uint32 u32; unsigned long l; } lzo_align_t;
/* align a char pointer on a boundary that is a multiple of 'size' */
LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp p, lzo_uint size);
#define LZO_PTR_ALIGN_UP(p,size) \
((p) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(p),(lzo_uint)(size)))
/***********************************************************************
// deprecated macros - only for backward compatibility with LZO v1.xx
************************************************************************/
#if defined(LZO_CFG_COMPAT)
#define __LZOCONF_H 1
#if defined(LZO_ARCH_I086)
# define __LZO_i386 1
#elif defined(LZO_ARCH_I386)
# define __LZO_i386 1
#endif
#if defined(LZO_OS_DOS16)
# define __LZO_DOS 1
# define __LZO_DOS16 1
#elif defined(LZO_OS_DOS32)
# define __LZO_DOS 1
#elif defined(LZO_OS_WIN16)
# define __LZO_WIN 1
# define __LZO_WIN16 1
#elif defined(LZO_OS_WIN32)
# define __LZO_WIN 1
#endif
#define __LZO_CMODEL /*empty*/
#define __LZO_DMODEL /*empty*/
#define __LZO_ENTRY __LZO_CDECL
#define LZO_EXTERN_CDECL LZO_EXTERN
#define LZO_ALIGN LZO_PTR_ALIGN_UP
#define lzo_compress_asm_t lzo_compress_t
#define lzo_decompress_asm_t lzo_decompress_t
#endif /* LZO_CFG_COMPAT */
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* already included */
/* vim:set ts=4 et: */
|
3d2afbb19b6228876299be93a1620eed3ef5b768
|
c72be999abf8848a7d09264ba9ee7bae30f4524a
|
/xme/xme/prim/tdmaScheduler.h
|
ef5a4b7d9520c54fb7cc8c9809fce75a2d9f5ef4
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
ipa-rmb/autopnp
|
8399be67c1a3de61e01619dc8677c52728ffd836
|
f25517a093c772a1481bcff3e9da055d4c627954
|
refs/heads/indigo_dev
| 2022-05-05T01:57:05.858437
| 2022-04-29T07:31:42
| 2022-04-29T07:31:42
| 3,398,225
| 144
| 101
| null | 2019-07-08T06:11:13
| 2012-02-09T15:30:28
|
C
|
UTF-8
|
C
| false
| false
| 11,636
|
h
|
tdmaScheduler.h
|
/*
* Copyright (c) 2011-2013, fortiss GmbH.
* Licensed under the Apache License, Version 2.0.
*
* Use, modification and distribution are subject to the terms specified
* in the accompanying license file LICENSE.txt located at the root directory
* of this software distribution. A copy is available at
* http://chromosome.fortiss.org/.
*
* This file is part of CHROMOSOME.
*
* $Id: tdmaScheduler.h 3445 2013-05-22 15:22:58Z ruiz $
*/
/**
* \file
* Time Division Multiple Access (TDMA) scheduler
*/
#ifndef XME_PRIM_TDMASCHEDULER_H
#define XME_PRIM_TDMASCHEDULER_H
/* How to use the TDMA scheduler:
* - design a slot assignment, set the number of TDMA slots and assign slot times to them
* - rename all calls from xme_hal_sched_addTask to xme_hal_sched_addTask_tdma
* (this registers the task in the TDMA scheduler. Make sure to also change the calls in
* lower chromosome layers, otherwise tasks defined in lower layers are ignored by the TDMA
* scheduler - the TDMA scheduler can only handle tasks, which are created by using a
* function with the _tdma suffix. If a task is created with a non-TDMA function, this
* task might disturb the TDMA schedule cycle and steal CPU time for TDMA tasks.
*
* original non-TDMA call if using the TDMA-scheduler, call this function instead:
* xme_hal_sched_addTask xme_hal_sched_addTask_tdma
* xme_hal_sched_removeTask xme_hal_sched_removeTask_tdma
* xme_core_resourceManager_scheduleTask xme_core_resourceManager_scheduleTask_tdma
* xme_core_resourceManager_killTask xme_core_resourceManager_killTask_tdma
*/
/******************************************************************************/
/*** Includes ***/
/******************************************************************************/
#include "xme/core/component.h"
#include "xme/core/resourceManager.h"
#include "xme/hal/include/sched.h"
#include "xme/hal/include/sync.h"
#include "xme/hal/include/time.h"
#include "xme/defines.h"
/******************************************************************************/
/*** Type definitions ***/
/******************************************************************************/
/**
* \struct xme_tdma_runtimeConfig_t
*
* \brief Sruct with runtime data for the tdma scheduler.
*/
typedef struct
{
bool stop_task_flag; ///< set to true to stop the TDMA control task
xme_hal_sched_taskHandle_t tdma_control_task_handle; ///< the task handle of the TDMA control task
xme_hal_time_timeInterval_t total_scheduler_run_length; ///< the sum of all scheduler slots
xme_hal_sync_criticalSectionHandle_t tdma_control_task_start_mutex; ///< a semaphore to delay the start of the TDMA control task
// xme_hal_sync_criticalSectionHandle_t xme_tdma_config_struct_mutex; ///< a semaphore to protect the config structs from simultaneous access
}
xme_tdma_runtimeConfig_t;
/**
* \struct xme_comp_tdma_configStruct_t
*
* \brief Config struct for the TDMA component.
*/
XME_COMPONENT_CONFIG_STRUCT
(
xme_prim_tdma,
uint8_t num_of_slots; ///< total number of timeslots for the tdma scheduler.
uint8_t tdma_priority; ///< the priority at which the tdma_control_task is executed. Recommended value: highest priority in the system.
xme_hal_time_timeInterval_t slot_length_array[XME_PRIM_TDMA_MAX_SLOT_COUNT]; ///< the length for each TDMA slot.
xme_tdma_runtimeConfig_t* runtime_config; ///< a pointer to the runtime information of the TDMA scheduler, the TDMA scheduler takes care of it, users should initialize it to NULL.
);
/******************************************************************************/
/*** Prototypes ***/
/******************************************************************************/
XME_EXTERN_C_BEGIN
/**
* \brief Schedules a task for execution and registers it in the TDMA scheduler.
*
* \note On some platforms, a task's callback function might be run from
* a different execution context (e.g., a different thread), so
* synchronization mechanisms might be required if the task shares
* data with other tasks or the main program.
*
* \param startTime If non-zero, specifies the time in nanoseconds from now
* when the task should be executed. A value of zero will cause the
* task to be started as soon as possible. A value of
* xme_HAL_SCHED_TASK_INITIALLY_SUSPENDED will cause the task to stay
* suspended until it is resumed using
* xme_hal_sched_setTaskExecutionState().
* \param period If non-zero, specifies the period in nanoseconds of the
* task. Otherwise, the task is a one-shot task and will be
* automatically removed after execution.
* \param priority Task priority (only meaningful for priority-based
* scheduler implementations). Higher values mean a higher priority.
* \param callback Callback function implementing the task to be executed.
* Note that on some platforms, this callback function might be run
* from a different execution context (e.g., a different thread),
* so synchronization mechanisms might be required if the task
* shares data with other tasks or the main program.
* \param slot TDMA slot in which the scheduled task will be executed.
* \param userData User-defined data to be passed to the callback function.
* \return the task handle.
*/
xme_hal_sched_taskHandle_t
xme_hal_sched_addTask_tdma
(
xme_hal_time_timeInterval_t startTime,
xme_hal_time_timeInterval_t period,
uint8_t priority,
xme_hal_sched_taskCallback_t callback,
uint8_t slot,
void* userData
);
/**
* \brief Removes a task from the schedule and from the TDMA scheduler
*
* \details If the task is currently being executed, it is removed at the next
* possible point in time after finishing execution. If this function
* is called from the execution context of the respective task, the
* task is automatically removed after it returns control to the
* runtime system. If this function is called from a different
* execution context, the function will only return after the task has
* been successfully removed. This means that it is guaranteed that
* the task will not use any shared resources after this function
* returned. This function will also remove the task if it is
* currently suspended, so resuming the task is not required
* beforehand if it might be suspended.
*
* \note If the respective task executes an infinite loop, a call to this
* function from a different execution context than that of the
* respective task will never return!
*
* \param taskHandle Handle of the task to remove.
* \retval XME_CORE_STATUS_SUCCESS if the task has been removed from schedule.
* \retval XME_CORE_STATUS_INVALID_HANDLE if the given task handle was
* invalid.
*/
xme_status_t
xme_hal_sched_removeTask_tdma(xme_hal_sched_taskHandle_t taskHandle);
/**
* \brief Tries to schedule the task according to the given parameters.
* If a new task with the given parameters is not feasible, the
* function will fail. Also adds the task to the TDMA scheduler
*
* \param startTime If non-zero, specifies the time in nanoseconds from
* now when the task should be executed. A value of zero will cause
* the task to be started as soon as possible. A value of
* XME_HAL_SCHED_TASK_INITIALLY_SUSPENDED will cause the task to stay
* suspended until it is resumed using
* xme_hal_sched_setTaskExecutionState().
* \param period If non-zero, specifies the period in nanoseconds of
* the task. Otherwise, the task is a one-shot task and will be
* automatically removed after execution.
* \param priority Task priority (only meaningful for priority-based
* scheduler implementations). Higher values mean a higher priority.
* \param callback Callback function implementing the task to be executed.
* Note that on some platforms, this callback function might be run
* from a different execution context (e.g., a different thread),
* so synchronization mechanisms might be required if the task
* shares data with other tasks or the main program.
* \param slot TDMA slot in which the scheduled task will be executed.
* \param userData User-defined data to be passed to the callback function.
*
* \return Returns a task handle on success. If the a task according to the
* given parameters is not feasible, the function fails and returns
* XME_CORE_RESOURCEMANAGER_TASK_INFEASIBLE.
*/
xme_core_resourceManager_taskHandle_t
xme_core_resourceManager_scheduleTask_tdma
(
xme_hal_time_timeInterval_t startTime,
xme_hal_time_timeInterval_t period,
uint8_t priority,
xme_hal_sched_taskCallback_t callback,
uint8_t slot,
void* userData
);
/**
* \brief Removes the given task from the schedule. However, if the task is
* currently running, it will not be stopped. In case of a one-shot
* task, this function can be used to prevent starting of the task
* before it has been started. In case of a periodic task, this
* function will prevent subsequent invocations of the task.
* The task is also removed from the TDMA schedule
*
* \param taskHandle Handle of the task to remove.
*
* \return Returns one of the following status codes:
* - XME_STATUS_SUCCESS if the task has been successfully
* removed.
* - XME_STATUS_INVALID_PARAMETER if the given task handle
* is invalid.
*/
xme_status_t
xme_core_resourceManager_killTask_tdma
(
xme_core_resourceManager_taskHandle_t taskHandle
);
/**
* \brief Activates the TDMA scheduler component.
*
* \details Please note, that there should only be one TDMA scheduler component on each node.
* Activating the TDMA component will start the TDMA control task and activate
* the TDMA scheduler's slot based scheduling algorithm.
* \param config the configuration parameters.
* \return Returns one of the following status codes:
* - XME_STATUS_SUCCESS if the component has been successfully
* activated.
* - XME_STATUS_INTERNAL_ERROR if the component cannot be activated.
*/
xme_status_t
xme_prim_tdma_activate ( xme_prim_tdma_configStruct_t* config );
/**
* \brief Deactivates the TDMA scheduler component.
* \param config the configuration parameters.
*/
void
xme_prim_tdma_deactivate ( xme_prim_tdma_configStruct_t* config );
/**
* \brief Creates the TDMA scheduler component.
*
* \details Please note, that there should only be one TDMA scheduler component on each node.
* Creating the TDMA component will initialize its data structures.
* \param config the configuration parameters.
* \return Returns one of the following status codes:
* - XME_STATUS_SUCCESS if the component has been successfully
* created.
* - XME_STATUS_INTERNAL_ERROR if the component cannot be created.
*/
xme_status_t
xme_prim_tdma_create ( xme_prim_tdma_configStruct_t* config );
/**
* \brief Destroys the TDMA scheduler component.
* \param config the configuration parameters.
*/
void
xme_prim_tdma_destroy ( xme_prim_tdma_configStruct_t* config );
XME_EXTERN_C_END
#endif /* XME_PRIM_TDMASCHEDULER_H */
|
9c3beb4a544d8ef90f905c1294dacd1ce1cfa3d6
|
fbdc48c28e54fb33ae4842ef95ff63893902c99a
|
/src/omv/imlib/selective_search.c
|
8bacbf7b2464d77fd878bfbc00b120ce0fa142ee
|
[
"MIT"
] |
permissive
|
openmv/openmv
|
44d4b79fc8693950a2e330e5e0fd95b5c36e230f
|
8a90e070a88b7fc14c87a00351b9c4a213278419
|
refs/heads/master
| 2023-08-30T20:59:57.227603
| 2023-08-23T16:50:55
| 2023-08-23T16:50:55
| 14,360,940
| 2,150
| 1,226
|
MIT
| 2023-09-14T07:18:15
| 2013-11-13T10:23:44
|
C
|
UTF-8
|
C
| false
| false
| 14,419
|
c
|
selective_search.c
|
/*
* This file is part of the OpenMV project.
*
* Copyright (c) 2013-2021 Ibrahim Abdelkader <iabdalkader@openmv.io>
* Copyright (c) 2013-2021 Kwabena W. Agyeman <kwagyeman@openmv.io>
*
* This work is licensed under the MIT license, see the file LICENSE for details.
*
* Selective search.
*/
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdint.h>
#include "imlib.h"
#include "fb_alloc.h"
#include "xalloc.h"
#ifdef IMLIB_ENABLE_SELECTIVE_SEARCH
#define THRESHOLD(size, c) (c / size)
typedef struct {
uint16_t y;
uint16_t h;
uint16_t x;
uint16_t w;
} region;
typedef struct {
uint16_t p;
uint16_t rank;
uint16_t size;
} uni_elt;
typedef struct {
int num;
uni_elt *elts;
} universe;
typedef struct {
float w;
uint16_t a;
uint16_t b;
} edge;
static inline int min(int a, int b) {
return (a < b) ? a : b;
}
static inline int max(int a, int b) {
return (a > b) ? a : b;
}
static inline float minf(float a, float b) {
return (a < b) ? a : b;
}
static inline float maxf(float a, float b) {
return (a > b) ? a : b;
}
extern uint32_t rng_randint(uint32_t min, uint32_t max);
static universe *universe_create(int elements) {
universe *uni = (universe *) fb_alloc(sizeof(universe), FB_ALLOC_NO_HINT);
uni->elts = (uni_elt *) fb_alloc(sizeof(uni_elt) * elements, FB_ALLOC_NO_HINT);
uni->num = elements;
for (int i = 0; i < elements; ++i) {
uni->elts[i].p = i;
uni->elts[i].rank = 0;
uni->elts[i].size = 1;
}
return uni;
}
static int universe_size(universe *uni, int x) {
return uni->elts[x].size;
}
static int universe_num_sets(universe *uni) {
return uni->num;
}
static int universe_find(universe *uni, int x) {
int y = x;
while (y != uni->elts[y].p) {
y = uni->elts[y].p;
}
// Path compression
uni->elts[x].p = y;
return y;
}
static void universe_join(universe *uni, int x, int y) {
if (uni->elts[x].rank > uni->elts[y].rank) {
uni->elts[y].p = x;
uni->elts[x].size += uni->elts[y].size;
} else {
uni->elts[x].p = y;
uni->elts[y].size += uni->elts[x].size;
if (uni->elts[x].rank == uni->elts[y].rank) {
uni->elts[y].rank++;
}
}
uni->num--;
}
static int universe_get_id(universe *this, int x) {
return this->elts[x].rank;
}
static void universe_set_id(universe *this, int x, int id) {
this->elts[x].rank = id;
}
static inline float color_similarity(float *hist1, float *hist2) {
float sim = 0;
for (int i = 0; i < 75; ++i) {
sim += minf(hist1[i], hist2[i]);
}
return sim;
}
static inline float size_similarity(int a, int b, int size) {
return 1.0f - (a + b) / size;
}
static inline float fill_similarity(region *ra, region *rb, int a, int b, int size) {
int width = max(ra->w, rb->w) - min(ra->x, rb->x);
int height = max(ra->h, rb->h) - min(ra->y, rb->y);
return 1.0f - (width * height - a - b) / size;
}
static inline float square(float x) {
return x * x;
};
static inline float diff(image_t *img, int x1, int y1, int x2, int y2) {
uint16_t p1 = IMAGE_GET_RGB565_PIXEL(img, x1, y1);
uint16_t p2 = IMAGE_GET_RGB565_PIXEL(img, x2, y2);
uint8_t r1 = COLOR_RGB565_TO_R8(p1);
uint8_t r2 = COLOR_RGB565_TO_R8(p2);
uint8_t g1 = COLOR_RGB565_TO_G8(p1);
uint8_t g2 = COLOR_RGB565_TO_G8(p2);
uint8_t b1 = COLOR_RGB565_TO_B8(p1);
uint8_t b2 = COLOR_RGB565_TO_B8(p2);
// dissimilarity measure between pixels
return sqrtf((r1 - r2) * (r1 - r2) + (g1 - g2) * (g1 - g2) + (b1 - b2) * (b1 - b2));
}
int comp(const void *elem1, const void *elem2) {
edge *f = (edge *) elem1;
edge *s = (edge *) elem2;
if (f->w > s->w) {
return 1;
}
if (f->w < s->w) {
return -1;
}
return 0;
}
static void segment_graph(universe *u, int num_vertices, int num_edges, edge *edges, float c) {
qsort(edges, num_edges, sizeof(edge), comp);
float *threshold = fb_alloc(num_vertices * sizeof(float), FB_ALLOC_NO_HINT);
for (int i = 0; i < num_vertices; i++) {
threshold[i] = THRESHOLD(1, c);
}
for (int i = 0; i < num_edges; i++) {
edge *pedge = edges + i;
int a = universe_find(u, pedge->a);
int b = universe_find(u, pedge->b);
if (a != b) {
if ((pedge->w <= threshold[a]) && (pedge->w <= threshold[b])) {
universe_join(u, a, b);
a = universe_find(u, a);
threshold[a] = pedge->w + THRESHOLD(universe_size(u, a), c);
}
}
}
// Free thresholds.
fb_free();
}
static void image_scale(image_t *src, image_t *dst) {
int x_ratio = (int) ((src->w << 16) / dst->w) + 1;
int y_ratio = (int) ((src->h << 16) / dst->h) + 1;
for (int y = 0; y < dst->h; y++) {
int sy = (y * y_ratio) >> 16;
for (int x = 0; x < dst->w; x++) {
int sx = (x * x_ratio) >> 16;
((uint16_t *) dst->pixels)[y * dst->w + x] = ((uint16_t *) src->pixels)[sy * src->w + sx];
}
}
}
array_t *imlib_selective_search(image_t *src, float t, int min_size, float a1, float a2, float a3) {
int i, j;
int num = 0;
int width = 0, height = 0;
image_t *img = NULL;
fb_alloc_mark();
if ((src->w * src->h) <= (80 * 60)) {
img = src;
width = src->w;
height = src->h;
} else {
// Down scale image
width = src->w / 4;
height = src->h / 4;
img = fb_alloc(sizeof(image_t), FB_ALLOC_NO_HINT);
img->w = width;
img->h = height;
img->pixels = fb_alloc(width * height * 2, FB_ALLOC_NO_HINT);
image_scale(src, img);
}
// Region proposals array
array_t *proposals;
array_alloc(&proposals, xfree);
universe *u = universe_create(width * height);
edge *edges = (edge *) fb_alloc(width * height * sizeof(edge) * 4, FB_ALLOC_NO_HINT);
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
if (x < width - 1) {
edges[num].a = y * width + x;
edges[num].b = y * width + (x + 1);
edges[num].w = diff(img, x, y, x + 1, y);
num++;
}
if (y < height - 1) {
edges[num].a = y * width + x;
edges[num].b = (y + 1) * width + x;
edges[num].w = diff(img, x, y, x, y + 1);
num++;
}
if ((x < width - 1) && (y < height - 1)) {
edges[num].a = y * width + x;
edges[num].b = (y + 1) * width + (x + 1);
edges[num].w = diff(img, x, y, x + 1, y + 1);
num++;
}
if ((x < width - 1) && (y > 0)) {
edges[num].a = y * width + x;
edges[num].b = (y - 1) * width + (x + 1);
edges[num].w = diff(img, x, y, x + 1, y - 1);
num++;
}
}
}
segment_graph(u, width * height, num, edges, t);
for (i = 0; i < num; i++) {
int a = universe_find(u, edges[i].a);
int b = universe_find(u, edges[i].b);
if ((a != b) && ((universe_size(u, a) < min_size) || (universe_size(u, b) < min_size))) {
universe_join(u, a, b);
}
}
// Free graph edges
fb_free();
int num_ccs = universe_num_sets(u);
region *regions = (region *) fb_alloc(num_ccs * sizeof(region), FB_ALLOC_NO_HINT);
for (i = 0; i < num_ccs; i++) {
regions[i].x = width;
regions[i].w = 0;
regions[i].y = height;
regions[i].h = 0;
}
int next_component = 0;
int *counts = (int *) fb_alloc0(num_ccs * sizeof(int), FB_ALLOC_NO_HINT);
int *components = (int *) fb_alloc(num_ccs * sizeof(int), FB_ALLOC_NO_HINT);
float *histogram = (float *) fb_alloc0(num_ccs * sizeof(float) * 75, FB_ALLOC_NO_HINT);
// Calc histograms
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
int component_id = -1;
int comp = universe_find(u, y * width + x);
for (i = 0; i < next_component; i++) {
if (components[i] == comp) {
component_id = i;
break;
}
}
if (i == next_component) {
components[next_component] = comp;
component_id = next_component;
++next_component;
}
universe_set_id(u, y * width + x, component_id);
region *r = regions + component_id;
r->y = min(r->y, y);
r->h = max(r->h, y);
r->x = min(r->x, x);
r->w = max(r->w, x);
uint16_t p = IMAGE_GET_RGB565_PIXEL(img, x, y);
int r_bin = min(COLOR_RGB565_TO_R8(p), 240) / 10;
int g_bin = min(COLOR_RGB565_TO_G8(p), 240) / 10;
int b_bin = min(COLOR_RGB565_TO_B8(p), 240) / 10;
histogram[75 * component_id + 0 + r_bin]++;
histogram[75 * component_id + 25 + g_bin]++;
histogram[75 * component_id + 50 + b_bin]++;
counts[component_id]++;
}
}
// Normalize histograms
for (i = 0; i < num_ccs; i++) {
float max_val = 0;
for (j = 0; j < 75; j++) {
max_val = max(max_val, histogram[75 * i + j]);
}
for (j = 0; j < 75; j++) {
histogram[75 * i + j] /= max_val;
}
}
uint8_t *adjacency = (uint8_t *) fb_alloc0(num_ccs * num_ccs * sizeof(uint8_t), FB_ALLOC_NO_HINT);
for (int y = 0; y < height - 1; ++y) {
for (int x = 0; x < width - 1; ++x) {
int component1 = universe_get_id(u, y * width + x);
int component2 = universe_get_id(u, y * width + x + 1);
int component3 = universe_get_id(u, y * width + x + width);
if (component1 != component2) {
adjacency[component1 * num_ccs + component2] = 1;
adjacency[component2 * num_ccs + component1] = 1;
}
if (component1 != component3) {
adjacency[component1 * num_ccs + component3] = 1;
adjacency[component3 * num_ccs + component1] = 1;
}
}
}
int size = height * width;
float *similarity_table = (float *) fb_alloc(num_ccs * num_ccs * sizeof(float), FB_ALLOC_NO_HINT);
for (i = 0; i < num_ccs; ++i) {
for (j = i + 1; j < num_ccs; ++j) {
float color_sim = a1 * color_similarity(histogram + 75 * i, histogram + 75 * j);
float size_sim = a2 * size_similarity(counts[i], counts[j], size);
float fill_sim = a3 * fill_similarity(regions + i, regions + j, counts[i], counts[j], size);
float similarity = color_sim + size_sim + fill_sim;
similarity_table[i * num_ccs + j] = similarity;
similarity_table[j * num_ccs + i] = similarity;
}
}
int remaining = num_ccs;
while (remaining > 1) {
int best_i = -1;
int best_j = -1;
float best_similarity = 0;
for (i = 0; i < num_ccs; i++) {
for (j = i + 1; j < num_ccs; j++) {
if (adjacency[i * num_ccs + j] == 0) {
continue;
}
float similarity = similarity_table[i * num_ccs + j];
if (similarity > best_similarity) {
best_similarity = similarity;
best_i = i;
best_j = j;
}
}
}
if (best_i == -1) {
printf("failed to build tree\n");
break;
}
// update regions, histograms, counts, adjacency, similarity
regions[best_i].x = min(regions[best_i].x, regions[best_j].x);
regions[best_i].y = min(regions[best_i].y, regions[best_j].y);
regions[best_i].w = max(regions[best_i].w, regions[best_j].w);
regions[best_i].h = max(regions[best_i].h, regions[best_j].h);
bool add = true;
for (i = 0; i < array_length(proposals); i++) {
rectangle_t *r = array_at(proposals, i);
if (regions[best_i].x == r->x && regions[best_i].y == r->y &&
regions[best_i].w == r->w && regions[best_i].h == r->h) {
add = false;
break;
}
}
if (add) {
array_push_back(proposals, rectangle_alloc(regions[best_i].x,
regions[best_i].y, regions[best_i].w, regions[best_i].h));
}
for (i = 0; i < 75; i++) {
histogram[75 * best_i + i] = (counts[best_i] * histogram[75 * best_i + i]
+ counts[best_j] * histogram[75 * best_j + i]) / (counts[best_i] + counts[best_j]);
}
counts[best_i] += counts[best_j];
for (i = 0; i < num_ccs; i++) {
adjacency[best_i * num_ccs + i] |= adjacency[best_j * num_ccs + i];
adjacency[i * num_ccs + best_i] |= adjacency[i * num_ccs + best_j];
adjacency[best_j * num_ccs + i] = adjacency[i * num_ccs + best_j] = 0;
}
adjacency[best_i * num_ccs + best_i] = 0;
for (i = 0; i < num_ccs; i++) {
if (adjacency[best_i * num_ccs + i] == 0) {
continue;
}
float color_sim = a1 * color_similarity(histogram + 75 * i, histogram + 75 * best_i);
float size_sim = a2 * size_similarity(counts[i], counts[best_i], size);
float fill_sim = a3 * fill_similarity(regions + i, regions + best_i, counts[i], counts[best_i], size);
float similarity = color_sim + size_sim + fill_sim;
similarity_table[i * num_ccs + best_i] = similarity;
similarity_table[best_i * num_ccs + i] = similarity;
}
--remaining;
}
for (int i = 0; i < array_length(proposals); i++) {
rectangle_t *r = array_at(proposals, i);
r->w = r->w - r->x;
r->h = r->h - r->y;
if ((src->w * src->h) > (80 * 60)) {
r->x *= 4;
r->y *= 4;
r->w *= 4;
r->h *= 4;
}
}
fb_alloc_free_till_mark();
return proposals;
}
#endif //IMLIB_ENABLE_SELECTIVE_SEARCH
|
d740e03ea82c95601ee91be1c56cd6ded4102e34
|
1db673907c7946c2ea857cc9aa8b6f7f4060e36a
|
/Chapter/08_Device/CPU/TSS.h
|
440e9c0524b1c8f0831d64ac29d0422a37c88c9f
|
[
"BSD-3-Clause"
] |
permissive
|
pdpdds/SkyOS
|
a973cd9f1b4e541ae4ac26d19df29aa3f4110db3
|
db2ce044c581fc2dfe068723fb0be2336c7f18d9
|
refs/heads/master
| 2023-07-21T15:24:46.457637
| 2023-07-17T16:32:04
| 2023-07-17T16:32:04
| 97,029,119
| 160
| 49
| null | 2023-04-30T15:33:47
| 2017-07-12T16:23:01
|
C
|
UTF-8
|
C
| false
| false
| 749
|
h
|
TSS.h
|
#pragma once
#include "stdint.h"
#ifdef _MSC_VER
#pragma pack (push, 1)
#endif
struct tss_entry {
uint32_t prevTss;
uint32_t esp0;
uint32_t ss0;
uint32_t esp1;
uint32_t ss1;
uint32_t esp2;
uint32_t ss2;
uint32_t cr3;
uint32_t eip;
uint32_t eflags;
uint32_t eax;
uint32_t ecx;
uint32_t edx;
uint32_t ebx;
uint32_t esp;
uint32_t ebp;
uint32_t esi;
uint32_t edi;
uint32_t es;
uint32_t cs;
uint32_t ss;
uint32_t ds;
uint32_t fs;
uint32_t gs;
uint32_t ldt;
uint16_t trap;
uint16_t iomap;
};
#ifdef _MSC_VER
#pragma pack (pop, 1)
#endif
extern void SetTSSStack(uint16_t kernelSS, uint16_t kernelESP);
extern void InstallTSS (uint32_t sel, uint16_t kernelSS, uint16_t kernelESP);
|
b91bb6bec4c6864111f6d47565f3f76e236cbca5
|
676acab8ff535019faff7da3afb8eecc3fa127f5
|
/src/lib/mavlink/v2.0/common/mavlink_msg_high_latency2.h
|
d753e0a5cfe42d51f8d14e0ad28114d70ef4c0e7
|
[
"Apache-2.0"
] |
permissive
|
Firmament-Autopilot/FMT-Firmware
|
f8c324577245bd7e91af436954b4ce9421acbb41
|
0212fe89820376bfbedaded519552f6b011a7b8a
|
refs/heads/master
| 2023-09-01T11:37:46.194145
| 2023-08-29T06:33:10
| 2023-08-29T06:33:10
| 402,557,689
| 351
| 143
|
Apache-2.0
| 2023-09-12T05:28:39
| 2021-09-02T20:42:56
|
C
|
UTF-8
|
C
| false
| false
| 43,599
|
h
|
mavlink_msg_high_latency2.h
|
#pragma once
// MESSAGE HIGH_LATENCY2 PACKING
#define MAVLINK_MSG_ID_HIGH_LATENCY2 235
typedef struct __mavlink_high_latency2_t {
uint32_t timestamp; /*< [ms] Timestamp (milliseconds since boot or Unix epoch)*/
int32_t latitude; /*< [degE7] Latitude*/
int32_t longitude; /*< [degE7] Longitude*/
uint16_t custom_mode; /*< A bitfield for use for autopilot-specific flags (2 byte version).*/
int16_t altitude; /*< [m] Altitude above mean sea level*/
int16_t target_altitude; /*< [m] Altitude setpoint*/
uint16_t target_distance; /*< [dam] Distance to target waypoint or position*/
uint16_t wp_num; /*< Current waypoint number*/
uint16_t failure_flags; /*< Bitmap of failure flags.*/
uint8_t type; /*< Type of the MAV (quadrotor, helicopter, etc.)*/
uint8_t autopilot; /*< Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.*/
uint8_t heading; /*< [deg/2] Heading*/
uint8_t target_heading; /*< [deg/2] Heading setpoint*/
uint8_t throttle; /*< [%] Throttle*/
uint8_t airspeed; /*< [m/s*5] Airspeed*/
uint8_t airspeed_sp; /*< [m/s*5] Airspeed setpoint*/
uint8_t groundspeed; /*< [m/s*5] Groundspeed*/
uint8_t windspeed; /*< [m/s*5] Windspeed*/
uint8_t wind_heading; /*< [deg/2] Wind heading*/
uint8_t eph; /*< [dm] Maximum error horizontal position since last message*/
uint8_t epv; /*< [dm] Maximum error vertical position since last message*/
int8_t temperature_air; /*< [degC] Air temperature from airspeed sensor*/
int8_t climb_rate; /*< [dm/s] Maximum climb rate magnitude since last message*/
int8_t battery; /*< [%] Battery level (-1 if field not provided).*/
int8_t custom0; /*< Field for custom payload.*/
int8_t custom1; /*< Field for custom payload.*/
int8_t custom2; /*< Field for custom payload.*/
} mavlink_high_latency2_t;
#define MAVLINK_MSG_ID_HIGH_LATENCY2_LEN 42
#define MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN 42
#define MAVLINK_MSG_ID_235_LEN 42
#define MAVLINK_MSG_ID_235_MIN_LEN 42
#define MAVLINK_MSG_ID_HIGH_LATENCY2_CRC 179
#define MAVLINK_MSG_ID_235_CRC 179
#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_HIGH_LATENCY2 \
{ \
235, \
"HIGH_LATENCY2", \
27, \
{ \
{ "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_high_latency2_t, timestamp) }, \
{ "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_high_latency2_t, type) }, \
{ "autopilot", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_high_latency2_t, autopilot) }, \
{ "custom_mode", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_high_latency2_t, custom_mode) }, \
{ "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_high_latency2_t, latitude) }, \
{ "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_high_latency2_t, longitude) }, \
{ "altitude", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_high_latency2_t, altitude) }, \
{ "target_altitude", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_high_latency2_t, target_altitude) }, \
{ "heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_high_latency2_t, heading) }, \
{ "target_heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_high_latency2_t, target_heading) }, \
{ "target_distance", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_high_latency2_t, target_distance) }, \
{ "throttle", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_high_latency2_t, throttle) }, \
{ "airspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_high_latency2_t, airspeed) }, \
{ "airspeed_sp", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_high_latency2_t, airspeed_sp) }, \
{ "groundspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_high_latency2_t, groundspeed) }, \
{ "windspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_high_latency2_t, windspeed) }, \
{ "wind_heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_high_latency2_t, wind_heading) }, \
{ "eph", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_high_latency2_t, eph) }, \
{ "epv", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_high_latency2_t, epv) }, \
{ "temperature_air", NULL, MAVLINK_TYPE_INT8_T, 0, 36, offsetof(mavlink_high_latency2_t, temperature_air) }, \
{ "climb_rate", NULL, MAVLINK_TYPE_INT8_T, 0, 37, offsetof(mavlink_high_latency2_t, climb_rate) }, \
{ "battery", NULL, MAVLINK_TYPE_INT8_T, 0, 38, offsetof(mavlink_high_latency2_t, battery) }, \
{ "wp_num", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_high_latency2_t, wp_num) }, \
{ "failure_flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_high_latency2_t, failure_flags) }, \
{ "custom0", NULL, MAVLINK_TYPE_INT8_T, 0, 39, offsetof(mavlink_high_latency2_t, custom0) }, \
{ "custom1", NULL, MAVLINK_TYPE_INT8_T, 0, 40, offsetof(mavlink_high_latency2_t, custom1) }, \
{ "custom2", NULL, MAVLINK_TYPE_INT8_T, 0, 41, offsetof(mavlink_high_latency2_t, custom2) }, \
} \
}
#else
#define MAVLINK_MESSAGE_INFO_HIGH_LATENCY2 \
{ \
"HIGH_LATENCY2", \
27, \
{ \
{ "timestamp", NULL, MAVLINK_TYPE_UINT32_T, 0, 0, offsetof(mavlink_high_latency2_t, timestamp) }, \
{ "type", NULL, MAVLINK_TYPE_UINT8_T, 0, 24, offsetof(mavlink_high_latency2_t, type) }, \
{ "autopilot", NULL, MAVLINK_TYPE_UINT8_T, 0, 25, offsetof(mavlink_high_latency2_t, autopilot) }, \
{ "custom_mode", NULL, MAVLINK_TYPE_UINT16_T, 0, 12, offsetof(mavlink_high_latency2_t, custom_mode) }, \
{ "latitude", NULL, MAVLINK_TYPE_INT32_T, 0, 4, offsetof(mavlink_high_latency2_t, latitude) }, \
{ "longitude", NULL, MAVLINK_TYPE_INT32_T, 0, 8, offsetof(mavlink_high_latency2_t, longitude) }, \
{ "altitude", NULL, MAVLINK_TYPE_INT16_T, 0, 14, offsetof(mavlink_high_latency2_t, altitude) }, \
{ "target_altitude", NULL, MAVLINK_TYPE_INT16_T, 0, 16, offsetof(mavlink_high_latency2_t, target_altitude) }, \
{ "heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 26, offsetof(mavlink_high_latency2_t, heading) }, \
{ "target_heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 27, offsetof(mavlink_high_latency2_t, target_heading) }, \
{ "target_distance", NULL, MAVLINK_TYPE_UINT16_T, 0, 18, offsetof(mavlink_high_latency2_t, target_distance) }, \
{ "throttle", NULL, MAVLINK_TYPE_UINT8_T, 0, 28, offsetof(mavlink_high_latency2_t, throttle) }, \
{ "airspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 29, offsetof(mavlink_high_latency2_t, airspeed) }, \
{ "airspeed_sp", NULL, MAVLINK_TYPE_UINT8_T, 0, 30, offsetof(mavlink_high_latency2_t, airspeed_sp) }, \
{ "groundspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 31, offsetof(mavlink_high_latency2_t, groundspeed) }, \
{ "windspeed", NULL, MAVLINK_TYPE_UINT8_T, 0, 32, offsetof(mavlink_high_latency2_t, windspeed) }, \
{ "wind_heading", NULL, MAVLINK_TYPE_UINT8_T, 0, 33, offsetof(mavlink_high_latency2_t, wind_heading) }, \
{ "eph", NULL, MAVLINK_TYPE_UINT8_T, 0, 34, offsetof(mavlink_high_latency2_t, eph) }, \
{ "epv", NULL, MAVLINK_TYPE_UINT8_T, 0, 35, offsetof(mavlink_high_latency2_t, epv) }, \
{ "temperature_air", NULL, MAVLINK_TYPE_INT8_T, 0, 36, offsetof(mavlink_high_latency2_t, temperature_air) }, \
{ "climb_rate", NULL, MAVLINK_TYPE_INT8_T, 0, 37, offsetof(mavlink_high_latency2_t, climb_rate) }, \
{ "battery", NULL, MAVLINK_TYPE_INT8_T, 0, 38, offsetof(mavlink_high_latency2_t, battery) }, \
{ "wp_num", NULL, MAVLINK_TYPE_UINT16_T, 0, 20, offsetof(mavlink_high_latency2_t, wp_num) }, \
{ "failure_flags", NULL, MAVLINK_TYPE_UINT16_T, 0, 22, offsetof(mavlink_high_latency2_t, failure_flags) }, \
{ "custom0", NULL, MAVLINK_TYPE_INT8_T, 0, 39, offsetof(mavlink_high_latency2_t, custom0) }, \
{ "custom1", NULL, MAVLINK_TYPE_INT8_T, 0, 40, offsetof(mavlink_high_latency2_t, custom1) }, \
{ "custom2", NULL, MAVLINK_TYPE_INT8_T, 0, 41, offsetof(mavlink_high_latency2_t, custom2) }, \
} \
}
#endif
/**
* @brief Pack a high_latency2 message
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
*
* @param timestamp [ms] Timestamp (milliseconds since boot or Unix epoch)
* @param type Type of the MAV (quadrotor, helicopter, etc.)
* @param autopilot Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.
* @param custom_mode A bitfield for use for autopilot-specific flags (2 byte version).
* @param latitude [degE7] Latitude
* @param longitude [degE7] Longitude
* @param altitude [m] Altitude above mean sea level
* @param target_altitude [m] Altitude setpoint
* @param heading [deg/2] Heading
* @param target_heading [deg/2] Heading setpoint
* @param target_distance [dam] Distance to target waypoint or position
* @param throttle [%] Throttle
* @param airspeed [m/s*5] Airspeed
* @param airspeed_sp [m/s*5] Airspeed setpoint
* @param groundspeed [m/s*5] Groundspeed
* @param windspeed [m/s*5] Windspeed
* @param wind_heading [deg/2] Wind heading
* @param eph [dm] Maximum error horizontal position since last message
* @param epv [dm] Maximum error vertical position since last message
* @param temperature_air [degC] Air temperature from airspeed sensor
* @param climb_rate [dm/s] Maximum climb rate magnitude since last message
* @param battery [%] Battery level (-1 if field not provided).
* @param wp_num Current waypoint number
* @param failure_flags Bitmap of failure flags.
* @param custom0 Field for custom payload.
* @param custom1 Field for custom payload.
* @param custom2 Field for custom payload.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_high_latency2_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
uint32_t timestamp, uint8_t type, uint8_t autopilot, uint16_t custom_mode, int32_t latitude, int32_t longitude, int16_t altitude, int16_t target_altitude, uint8_t heading, uint8_t target_heading, uint16_t target_distance, uint8_t throttle, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, uint8_t windspeed, uint8_t wind_heading, uint8_t eph, uint8_t epv, int8_t temperature_air, int8_t climb_rate, int8_t battery, uint16_t wp_num, uint16_t failure_flags, int8_t custom0, int8_t custom1, int8_t custom2)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIGH_LATENCY2_LEN];
_mav_put_uint32_t(buf, 0, timestamp);
_mav_put_int32_t(buf, 4, latitude);
_mav_put_int32_t(buf, 8, longitude);
_mav_put_uint16_t(buf, 12, custom_mode);
_mav_put_int16_t(buf, 14, altitude);
_mav_put_int16_t(buf, 16, target_altitude);
_mav_put_uint16_t(buf, 18, target_distance);
_mav_put_uint16_t(buf, 20, wp_num);
_mav_put_uint16_t(buf, 22, failure_flags);
_mav_put_uint8_t(buf, 24, type);
_mav_put_uint8_t(buf, 25, autopilot);
_mav_put_uint8_t(buf, 26, heading);
_mav_put_uint8_t(buf, 27, target_heading);
_mav_put_uint8_t(buf, 28, throttle);
_mav_put_uint8_t(buf, 29, airspeed);
_mav_put_uint8_t(buf, 30, airspeed_sp);
_mav_put_uint8_t(buf, 31, groundspeed);
_mav_put_uint8_t(buf, 32, windspeed);
_mav_put_uint8_t(buf, 33, wind_heading);
_mav_put_uint8_t(buf, 34, eph);
_mav_put_uint8_t(buf, 35, epv);
_mav_put_int8_t(buf, 36, temperature_air);
_mav_put_int8_t(buf, 37, climb_rate);
_mav_put_int8_t(buf, 38, battery);
_mav_put_int8_t(buf, 39, custom0);
_mav_put_int8_t(buf, 40, custom1);
_mav_put_int8_t(buf, 41, custom2);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
#else
mavlink_high_latency2_t packet;
packet.timestamp = timestamp;
packet.latitude = latitude;
packet.longitude = longitude;
packet.custom_mode = custom_mode;
packet.altitude = altitude;
packet.target_altitude = target_altitude;
packet.target_distance = target_distance;
packet.wp_num = wp_num;
packet.failure_flags = failure_flags;
packet.type = type;
packet.autopilot = autopilot;
packet.heading = heading;
packet.target_heading = target_heading;
packet.throttle = throttle;
packet.airspeed = airspeed;
packet.airspeed_sp = airspeed_sp;
packet.groundspeed = groundspeed;
packet.windspeed = windspeed;
packet.wind_heading = wind_heading;
packet.eph = eph;
packet.epv = epv;
packet.temperature_air = temperature_air;
packet.climb_rate = climb_rate;
packet.battery = battery;
packet.custom0 = custom0;
packet.custom1 = custom1;
packet.custom2 = custom2;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_HIGH_LATENCY2;
return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
}
/**
* @brief Pack a high_latency2 message on a channel
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param timestamp [ms] Timestamp (milliseconds since boot or Unix epoch)
* @param type Type of the MAV (quadrotor, helicopter, etc.)
* @param autopilot Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.
* @param custom_mode A bitfield for use for autopilot-specific flags (2 byte version).
* @param latitude [degE7] Latitude
* @param longitude [degE7] Longitude
* @param altitude [m] Altitude above mean sea level
* @param target_altitude [m] Altitude setpoint
* @param heading [deg/2] Heading
* @param target_heading [deg/2] Heading setpoint
* @param target_distance [dam] Distance to target waypoint or position
* @param throttle [%] Throttle
* @param airspeed [m/s*5] Airspeed
* @param airspeed_sp [m/s*5] Airspeed setpoint
* @param groundspeed [m/s*5] Groundspeed
* @param windspeed [m/s*5] Windspeed
* @param wind_heading [deg/2] Wind heading
* @param eph [dm] Maximum error horizontal position since last message
* @param epv [dm] Maximum error vertical position since last message
* @param temperature_air [degC] Air temperature from airspeed sensor
* @param climb_rate [dm/s] Maximum climb rate magnitude since last message
* @param battery [%] Battery level (-1 if field not provided).
* @param wp_num Current waypoint number
* @param failure_flags Bitmap of failure flags.
* @param custom0 Field for custom payload.
* @param custom1 Field for custom payload.
* @param custom2 Field for custom payload.
* @return length of the message in bytes (excluding serial stream start sign)
*/
static inline uint16_t mavlink_msg_high_latency2_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
mavlink_message_t* msg,
uint32_t timestamp, uint8_t type, uint8_t autopilot, uint16_t custom_mode, int32_t latitude, int32_t longitude, int16_t altitude, int16_t target_altitude, uint8_t heading, uint8_t target_heading, uint16_t target_distance, uint8_t throttle, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, uint8_t windspeed, uint8_t wind_heading, uint8_t eph, uint8_t epv, int8_t temperature_air, int8_t climb_rate, int8_t battery, uint16_t wp_num, uint16_t failure_flags, int8_t custom0, int8_t custom1, int8_t custom2)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIGH_LATENCY2_LEN];
_mav_put_uint32_t(buf, 0, timestamp);
_mav_put_int32_t(buf, 4, latitude);
_mav_put_int32_t(buf, 8, longitude);
_mav_put_uint16_t(buf, 12, custom_mode);
_mav_put_int16_t(buf, 14, altitude);
_mav_put_int16_t(buf, 16, target_altitude);
_mav_put_uint16_t(buf, 18, target_distance);
_mav_put_uint16_t(buf, 20, wp_num);
_mav_put_uint16_t(buf, 22, failure_flags);
_mav_put_uint8_t(buf, 24, type);
_mav_put_uint8_t(buf, 25, autopilot);
_mav_put_uint8_t(buf, 26, heading);
_mav_put_uint8_t(buf, 27, target_heading);
_mav_put_uint8_t(buf, 28, throttle);
_mav_put_uint8_t(buf, 29, airspeed);
_mav_put_uint8_t(buf, 30, airspeed_sp);
_mav_put_uint8_t(buf, 31, groundspeed);
_mav_put_uint8_t(buf, 32, windspeed);
_mav_put_uint8_t(buf, 33, wind_heading);
_mav_put_uint8_t(buf, 34, eph);
_mav_put_uint8_t(buf, 35, epv);
_mav_put_int8_t(buf, 36, temperature_air);
_mav_put_int8_t(buf, 37, climb_rate);
_mav_put_int8_t(buf, 38, battery);
_mav_put_int8_t(buf, 39, custom0);
_mav_put_int8_t(buf, 40, custom1);
_mav_put_int8_t(buf, 41, custom2);
memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
#else
mavlink_high_latency2_t packet;
packet.timestamp = timestamp;
packet.latitude = latitude;
packet.longitude = longitude;
packet.custom_mode = custom_mode;
packet.altitude = altitude;
packet.target_altitude = target_altitude;
packet.target_distance = target_distance;
packet.wp_num = wp_num;
packet.failure_flags = failure_flags;
packet.type = type;
packet.autopilot = autopilot;
packet.heading = heading;
packet.target_heading = target_heading;
packet.throttle = throttle;
packet.airspeed = airspeed;
packet.airspeed_sp = airspeed_sp;
packet.groundspeed = groundspeed;
packet.windspeed = windspeed;
packet.wind_heading = wind_heading;
packet.eph = eph;
packet.epv = epv;
packet.temperature_air = temperature_air;
packet.climb_rate = climb_rate;
packet.battery = battery;
packet.custom0 = custom0;
packet.custom1 = custom1;
packet.custom2 = custom2;
memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
#endif
msg->msgid = MAVLINK_MSG_ID_HIGH_LATENCY2;
return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
}
/**
* @brief Encode a high_latency2 struct
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param msg The MAVLink message to compress the data into
* @param high_latency2 C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_high_latency2_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_high_latency2_t* high_latency2)
{
return mavlink_msg_high_latency2_pack(system_id, component_id, msg, high_latency2->timestamp, high_latency2->type, high_latency2->autopilot, high_latency2->custom_mode, high_latency2->latitude, high_latency2->longitude, high_latency2->altitude, high_latency2->target_altitude, high_latency2->heading, high_latency2->target_heading, high_latency2->target_distance, high_latency2->throttle, high_latency2->airspeed, high_latency2->airspeed_sp, high_latency2->groundspeed, high_latency2->windspeed, high_latency2->wind_heading, high_latency2->eph, high_latency2->epv, high_latency2->temperature_air, high_latency2->climb_rate, high_latency2->battery, high_latency2->wp_num, high_latency2->failure_flags, high_latency2->custom0, high_latency2->custom1, high_latency2->custom2);
}
/**
* @brief Encode a high_latency2 struct on a channel
*
* @param system_id ID of this system
* @param component_id ID of this component (e.g. 200 for IMU)
* @param chan The MAVLink channel this message will be sent over
* @param msg The MAVLink message to compress the data into
* @param high_latency2 C-struct to read the message contents from
*/
static inline uint16_t mavlink_msg_high_latency2_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_high_latency2_t* high_latency2)
{
return mavlink_msg_high_latency2_pack_chan(system_id, component_id, chan, msg, high_latency2->timestamp, high_latency2->type, high_latency2->autopilot, high_latency2->custom_mode, high_latency2->latitude, high_latency2->longitude, high_latency2->altitude, high_latency2->target_altitude, high_latency2->heading, high_latency2->target_heading, high_latency2->target_distance, high_latency2->throttle, high_latency2->airspeed, high_latency2->airspeed_sp, high_latency2->groundspeed, high_latency2->windspeed, high_latency2->wind_heading, high_latency2->eph, high_latency2->epv, high_latency2->temperature_air, high_latency2->climb_rate, high_latency2->battery, high_latency2->wp_num, high_latency2->failure_flags, high_latency2->custom0, high_latency2->custom1, high_latency2->custom2);
}
/**
* @brief Send a high_latency2 message
* @param chan MAVLink channel to send the message
*
* @param timestamp [ms] Timestamp (milliseconds since boot or Unix epoch)
* @param type Type of the MAV (quadrotor, helicopter, etc.)
* @param autopilot Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.
* @param custom_mode A bitfield for use for autopilot-specific flags (2 byte version).
* @param latitude [degE7] Latitude
* @param longitude [degE7] Longitude
* @param altitude [m] Altitude above mean sea level
* @param target_altitude [m] Altitude setpoint
* @param heading [deg/2] Heading
* @param target_heading [deg/2] Heading setpoint
* @param target_distance [dam] Distance to target waypoint or position
* @param throttle [%] Throttle
* @param airspeed [m/s*5] Airspeed
* @param airspeed_sp [m/s*5] Airspeed setpoint
* @param groundspeed [m/s*5] Groundspeed
* @param windspeed [m/s*5] Windspeed
* @param wind_heading [deg/2] Wind heading
* @param eph [dm] Maximum error horizontal position since last message
* @param epv [dm] Maximum error vertical position since last message
* @param temperature_air [degC] Air temperature from airspeed sensor
* @param climb_rate [dm/s] Maximum climb rate magnitude since last message
* @param battery [%] Battery level (-1 if field not provided).
* @param wp_num Current waypoint number
* @param failure_flags Bitmap of failure flags.
* @param custom0 Field for custom payload.
* @param custom1 Field for custom payload.
* @param custom2 Field for custom payload.
*/
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS
static inline void mavlink_msg_high_latency2_send(mavlink_channel_t chan, uint32_t timestamp, uint8_t type, uint8_t autopilot, uint16_t custom_mode, int32_t latitude, int32_t longitude, int16_t altitude, int16_t target_altitude, uint8_t heading, uint8_t target_heading, uint16_t target_distance, uint8_t throttle, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, uint8_t windspeed, uint8_t wind_heading, uint8_t eph, uint8_t epv, int8_t temperature_air, int8_t climb_rate, int8_t battery, uint16_t wp_num, uint16_t failure_flags, int8_t custom0, int8_t custom1, int8_t custom2)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char buf[MAVLINK_MSG_ID_HIGH_LATENCY2_LEN];
_mav_put_uint32_t(buf, 0, timestamp);
_mav_put_int32_t(buf, 4, latitude);
_mav_put_int32_t(buf, 8, longitude);
_mav_put_uint16_t(buf, 12, custom_mode);
_mav_put_int16_t(buf, 14, altitude);
_mav_put_int16_t(buf, 16, target_altitude);
_mav_put_uint16_t(buf, 18, target_distance);
_mav_put_uint16_t(buf, 20, wp_num);
_mav_put_uint16_t(buf, 22, failure_flags);
_mav_put_uint8_t(buf, 24, type);
_mav_put_uint8_t(buf, 25, autopilot);
_mav_put_uint8_t(buf, 26, heading);
_mav_put_uint8_t(buf, 27, target_heading);
_mav_put_uint8_t(buf, 28, throttle);
_mav_put_uint8_t(buf, 29, airspeed);
_mav_put_uint8_t(buf, 30, airspeed_sp);
_mav_put_uint8_t(buf, 31, groundspeed);
_mav_put_uint8_t(buf, 32, windspeed);
_mav_put_uint8_t(buf, 33, wind_heading);
_mav_put_uint8_t(buf, 34, eph);
_mav_put_uint8_t(buf, 35, epv);
_mav_put_int8_t(buf, 36, temperature_air);
_mav_put_int8_t(buf, 37, climb_rate);
_mav_put_int8_t(buf, 38, battery);
_mav_put_int8_t(buf, 39, custom0);
_mav_put_int8_t(buf, 40, custom1);
_mav_put_int8_t(buf, 41, custom2);
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY2, buf, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
#else
mavlink_high_latency2_t packet;
packet.timestamp = timestamp;
packet.latitude = latitude;
packet.longitude = longitude;
packet.custom_mode = custom_mode;
packet.altitude = altitude;
packet.target_altitude = target_altitude;
packet.target_distance = target_distance;
packet.wp_num = wp_num;
packet.failure_flags = failure_flags;
packet.type = type;
packet.autopilot = autopilot;
packet.heading = heading;
packet.target_heading = target_heading;
packet.throttle = throttle;
packet.airspeed = airspeed;
packet.airspeed_sp = airspeed_sp;
packet.groundspeed = groundspeed;
packet.windspeed = windspeed;
packet.wind_heading = wind_heading;
packet.eph = eph;
packet.epv = epv;
packet.temperature_air = temperature_air;
packet.climb_rate = climb_rate;
packet.battery = battery;
packet.custom0 = custom0;
packet.custom1 = custom1;
packet.custom2 = custom2;
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY2, (const char*)&packet, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
#endif
}
/**
* @brief Send a high_latency2 message
* @param chan MAVLink channel to send the message
* @param struct The MAVLink struct to serialize
*/
static inline void mavlink_msg_high_latency2_send_struct(mavlink_channel_t chan, const mavlink_high_latency2_t* high_latency2)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
mavlink_msg_high_latency2_send(chan, high_latency2->timestamp, high_latency2->type, high_latency2->autopilot, high_latency2->custom_mode, high_latency2->latitude, high_latency2->longitude, high_latency2->altitude, high_latency2->target_altitude, high_latency2->heading, high_latency2->target_heading, high_latency2->target_distance, high_latency2->throttle, high_latency2->airspeed, high_latency2->airspeed_sp, high_latency2->groundspeed, high_latency2->windspeed, high_latency2->wind_heading, high_latency2->eph, high_latency2->epv, high_latency2->temperature_air, high_latency2->climb_rate, high_latency2->battery, high_latency2->wp_num, high_latency2->failure_flags, high_latency2->custom0, high_latency2->custom1, high_latency2->custom2);
#else
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY2, (const char*)high_latency2, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
#endif
}
#if MAVLINK_MSG_ID_HIGH_LATENCY2_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
This varient of _send() can be used to save stack space by re-using
memory from the receive buffer. The caller provides a
mavlink_message_t which is the size of a full mavlink message. This
is usually the receive buffer for the channel, and allows a reply to an
incoming message with minimum stack space usage.
*/
static inline void mavlink_msg_high_latency2_send_buf(mavlink_message_t* msgbuf, mavlink_channel_t chan, uint32_t timestamp, uint8_t type, uint8_t autopilot, uint16_t custom_mode, int32_t latitude, int32_t longitude, int16_t altitude, int16_t target_altitude, uint8_t heading, uint8_t target_heading, uint16_t target_distance, uint8_t throttle, uint8_t airspeed, uint8_t airspeed_sp, uint8_t groundspeed, uint8_t windspeed, uint8_t wind_heading, uint8_t eph, uint8_t epv, int8_t temperature_air, int8_t climb_rate, int8_t battery, uint16_t wp_num, uint16_t failure_flags, int8_t custom0, int8_t custom1, int8_t custom2)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
char* buf = (char*)msgbuf;
_mav_put_uint32_t(buf, 0, timestamp);
_mav_put_int32_t(buf, 4, latitude);
_mav_put_int32_t(buf, 8, longitude);
_mav_put_uint16_t(buf, 12, custom_mode);
_mav_put_int16_t(buf, 14, altitude);
_mav_put_int16_t(buf, 16, target_altitude);
_mav_put_uint16_t(buf, 18, target_distance);
_mav_put_uint16_t(buf, 20, wp_num);
_mav_put_uint16_t(buf, 22, failure_flags);
_mav_put_uint8_t(buf, 24, type);
_mav_put_uint8_t(buf, 25, autopilot);
_mav_put_uint8_t(buf, 26, heading);
_mav_put_uint8_t(buf, 27, target_heading);
_mav_put_uint8_t(buf, 28, throttle);
_mav_put_uint8_t(buf, 29, airspeed);
_mav_put_uint8_t(buf, 30, airspeed_sp);
_mav_put_uint8_t(buf, 31, groundspeed);
_mav_put_uint8_t(buf, 32, windspeed);
_mav_put_uint8_t(buf, 33, wind_heading);
_mav_put_uint8_t(buf, 34, eph);
_mav_put_uint8_t(buf, 35, epv);
_mav_put_int8_t(buf, 36, temperature_air);
_mav_put_int8_t(buf, 37, climb_rate);
_mav_put_int8_t(buf, 38, battery);
_mav_put_int8_t(buf, 39, custom0);
_mav_put_int8_t(buf, 40, custom1);
_mav_put_int8_t(buf, 41, custom2);
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY2, buf, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
#else
mavlink_high_latency2_t* packet = (mavlink_high_latency2_t*)msgbuf;
packet->timestamp = timestamp;
packet->latitude = latitude;
packet->longitude = longitude;
packet->custom_mode = custom_mode;
packet->altitude = altitude;
packet->target_altitude = target_altitude;
packet->target_distance = target_distance;
packet->wp_num = wp_num;
packet->failure_flags = failure_flags;
packet->type = type;
packet->autopilot = autopilot;
packet->heading = heading;
packet->target_heading = target_heading;
packet->throttle = throttle;
packet->airspeed = airspeed;
packet->airspeed_sp = airspeed_sp;
packet->groundspeed = groundspeed;
packet->windspeed = windspeed;
packet->wind_heading = wind_heading;
packet->eph = eph;
packet->epv = epv;
packet->temperature_air = temperature_air;
packet->climb_rate = climb_rate;
packet->battery = battery;
packet->custom0 = custom0;
packet->custom1 = custom1;
packet->custom2 = custom2;
_mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_HIGH_LATENCY2, (const char*)packet, MAVLINK_MSG_ID_HIGH_LATENCY2_MIN_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN, MAVLINK_MSG_ID_HIGH_LATENCY2_CRC);
#endif
}
#endif
#endif
// MESSAGE HIGH_LATENCY2 UNPACKING
/**
* @brief Get field timestamp from high_latency2 message
*
* @return [ms] Timestamp (milliseconds since boot or Unix epoch)
*/
static inline uint32_t mavlink_msg_high_latency2_get_timestamp(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint32_t(msg, 0);
}
/**
* @brief Get field type from high_latency2 message
*
* @return Type of the MAV (quadrotor, helicopter, etc.)
*/
static inline uint8_t mavlink_msg_high_latency2_get_type(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 24);
}
/**
* @brief Get field autopilot from high_latency2 message
*
* @return Autopilot type / class. Use MAV_AUTOPILOT_INVALID for components that are not flight controllers.
*/
static inline uint8_t mavlink_msg_high_latency2_get_autopilot(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 25);
}
/**
* @brief Get field custom_mode from high_latency2 message
*
* @return A bitfield for use for autopilot-specific flags (2 byte version).
*/
static inline uint16_t mavlink_msg_high_latency2_get_custom_mode(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 12);
}
/**
* @brief Get field latitude from high_latency2 message
*
* @return [degE7] Latitude
*/
static inline int32_t mavlink_msg_high_latency2_get_latitude(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 4);
}
/**
* @brief Get field longitude from high_latency2 message
*
* @return [degE7] Longitude
*/
static inline int32_t mavlink_msg_high_latency2_get_longitude(const mavlink_message_t* msg)
{
return _MAV_RETURN_int32_t(msg, 8);
}
/**
* @brief Get field altitude from high_latency2 message
*
* @return [m] Altitude above mean sea level
*/
static inline int16_t mavlink_msg_high_latency2_get_altitude(const mavlink_message_t* msg)
{
return _MAV_RETURN_int16_t(msg, 14);
}
/**
* @brief Get field target_altitude from high_latency2 message
*
* @return [m] Altitude setpoint
*/
static inline int16_t mavlink_msg_high_latency2_get_target_altitude(const mavlink_message_t* msg)
{
return _MAV_RETURN_int16_t(msg, 16);
}
/**
* @brief Get field heading from high_latency2 message
*
* @return [deg/2] Heading
*/
static inline uint8_t mavlink_msg_high_latency2_get_heading(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 26);
}
/**
* @brief Get field target_heading from high_latency2 message
*
* @return [deg/2] Heading setpoint
*/
static inline uint8_t mavlink_msg_high_latency2_get_target_heading(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 27);
}
/**
* @brief Get field target_distance from high_latency2 message
*
* @return [dam] Distance to target waypoint or position
*/
static inline uint16_t mavlink_msg_high_latency2_get_target_distance(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 18);
}
/**
* @brief Get field throttle from high_latency2 message
*
* @return [%] Throttle
*/
static inline uint8_t mavlink_msg_high_latency2_get_throttle(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 28);
}
/**
* @brief Get field airspeed from high_latency2 message
*
* @return [m/s*5] Airspeed
*/
static inline uint8_t mavlink_msg_high_latency2_get_airspeed(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 29);
}
/**
* @brief Get field airspeed_sp from high_latency2 message
*
* @return [m/s*5] Airspeed setpoint
*/
static inline uint8_t mavlink_msg_high_latency2_get_airspeed_sp(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 30);
}
/**
* @brief Get field groundspeed from high_latency2 message
*
* @return [m/s*5] Groundspeed
*/
static inline uint8_t mavlink_msg_high_latency2_get_groundspeed(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 31);
}
/**
* @brief Get field windspeed from high_latency2 message
*
* @return [m/s*5] Windspeed
*/
static inline uint8_t mavlink_msg_high_latency2_get_windspeed(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 32);
}
/**
* @brief Get field wind_heading from high_latency2 message
*
* @return [deg/2] Wind heading
*/
static inline uint8_t mavlink_msg_high_latency2_get_wind_heading(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 33);
}
/**
* @brief Get field eph from high_latency2 message
*
* @return [dm] Maximum error horizontal position since last message
*/
static inline uint8_t mavlink_msg_high_latency2_get_eph(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 34);
}
/**
* @brief Get field epv from high_latency2 message
*
* @return [dm] Maximum error vertical position since last message
*/
static inline uint8_t mavlink_msg_high_latency2_get_epv(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint8_t(msg, 35);
}
/**
* @brief Get field temperature_air from high_latency2 message
*
* @return [degC] Air temperature from airspeed sensor
*/
static inline int8_t mavlink_msg_high_latency2_get_temperature_air(const mavlink_message_t* msg)
{
return _MAV_RETURN_int8_t(msg, 36);
}
/**
* @brief Get field climb_rate from high_latency2 message
*
* @return [dm/s] Maximum climb rate magnitude since last message
*/
static inline int8_t mavlink_msg_high_latency2_get_climb_rate(const mavlink_message_t* msg)
{
return _MAV_RETURN_int8_t(msg, 37);
}
/**
* @brief Get field battery from high_latency2 message
*
* @return [%] Battery level (-1 if field not provided).
*/
static inline int8_t mavlink_msg_high_latency2_get_battery(const mavlink_message_t* msg)
{
return _MAV_RETURN_int8_t(msg, 38);
}
/**
* @brief Get field wp_num from high_latency2 message
*
* @return Current waypoint number
*/
static inline uint16_t mavlink_msg_high_latency2_get_wp_num(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 20);
}
/**
* @brief Get field failure_flags from high_latency2 message
*
* @return Bitmap of failure flags.
*/
static inline uint16_t mavlink_msg_high_latency2_get_failure_flags(const mavlink_message_t* msg)
{
return _MAV_RETURN_uint16_t(msg, 22);
}
/**
* @brief Get field custom0 from high_latency2 message
*
* @return Field for custom payload.
*/
static inline int8_t mavlink_msg_high_latency2_get_custom0(const mavlink_message_t* msg)
{
return _MAV_RETURN_int8_t(msg, 39);
}
/**
* @brief Get field custom1 from high_latency2 message
*
* @return Field for custom payload.
*/
static inline int8_t mavlink_msg_high_latency2_get_custom1(const mavlink_message_t* msg)
{
return _MAV_RETURN_int8_t(msg, 40);
}
/**
* @brief Get field custom2 from high_latency2 message
*
* @return Field for custom payload.
*/
static inline int8_t mavlink_msg_high_latency2_get_custom2(const mavlink_message_t* msg)
{
return _MAV_RETURN_int8_t(msg, 41);
}
/**
* @brief Decode a high_latency2 message into a struct
*
* @param msg The message to decode
* @param high_latency2 C-struct to decode the message contents into
*/
static inline void mavlink_msg_high_latency2_decode(const mavlink_message_t* msg, mavlink_high_latency2_t* high_latency2)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
high_latency2->timestamp = mavlink_msg_high_latency2_get_timestamp(msg);
high_latency2->latitude = mavlink_msg_high_latency2_get_latitude(msg);
high_latency2->longitude = mavlink_msg_high_latency2_get_longitude(msg);
high_latency2->custom_mode = mavlink_msg_high_latency2_get_custom_mode(msg);
high_latency2->altitude = mavlink_msg_high_latency2_get_altitude(msg);
high_latency2->target_altitude = mavlink_msg_high_latency2_get_target_altitude(msg);
high_latency2->target_distance = mavlink_msg_high_latency2_get_target_distance(msg);
high_latency2->wp_num = mavlink_msg_high_latency2_get_wp_num(msg);
high_latency2->failure_flags = mavlink_msg_high_latency2_get_failure_flags(msg);
high_latency2->type = mavlink_msg_high_latency2_get_type(msg);
high_latency2->autopilot = mavlink_msg_high_latency2_get_autopilot(msg);
high_latency2->heading = mavlink_msg_high_latency2_get_heading(msg);
high_latency2->target_heading = mavlink_msg_high_latency2_get_target_heading(msg);
high_latency2->throttle = mavlink_msg_high_latency2_get_throttle(msg);
high_latency2->airspeed = mavlink_msg_high_latency2_get_airspeed(msg);
high_latency2->airspeed_sp = mavlink_msg_high_latency2_get_airspeed_sp(msg);
high_latency2->groundspeed = mavlink_msg_high_latency2_get_groundspeed(msg);
high_latency2->windspeed = mavlink_msg_high_latency2_get_windspeed(msg);
high_latency2->wind_heading = mavlink_msg_high_latency2_get_wind_heading(msg);
high_latency2->eph = mavlink_msg_high_latency2_get_eph(msg);
high_latency2->epv = mavlink_msg_high_latency2_get_epv(msg);
high_latency2->temperature_air = mavlink_msg_high_latency2_get_temperature_air(msg);
high_latency2->climb_rate = mavlink_msg_high_latency2_get_climb_rate(msg);
high_latency2->battery = mavlink_msg_high_latency2_get_battery(msg);
high_latency2->custom0 = mavlink_msg_high_latency2_get_custom0(msg);
high_latency2->custom1 = mavlink_msg_high_latency2_get_custom1(msg);
high_latency2->custom2 = mavlink_msg_high_latency2_get_custom2(msg);
#else
uint8_t len = msg->len < MAVLINK_MSG_ID_HIGH_LATENCY2_LEN ? msg->len : MAVLINK_MSG_ID_HIGH_LATENCY2_LEN;
memset(high_latency2, 0, MAVLINK_MSG_ID_HIGH_LATENCY2_LEN);
memcpy(high_latency2, _MAV_PAYLOAD(msg), len);
#endif
}
|
3dd0e993204cd8a502c089d187fac5e70c68889d
|
93be5d831adfdc50cb4275e54e1741d0d1a2ea06
|
/lib/encoding.c
|
28cdb0fe63fa2aa8de253c25a8ae13245aaf9d20
|
[
"ISC"
] |
permissive
|
reswitched/libtransistor
|
9b22a06b9244aac469e0c08f540196587e88ce2d
|
e356d4b57259e24fed725af08d1bd21902475e14
|
refs/heads/development
| 2021-05-16T03:26:54.866613
| 2019-08-25T02:51:30
| 2019-09-28T22:27:54
| 105,481,619
| 225
| 65
|
ISC
| 2019-06-22T01:01:21
| 2017-10-01T23:18:26
|
C
|
UTF-8
|
C
| false
| false
| 3,109
|
c
|
encoding.c
|
#include<libtransistor/encoding.h>
#include<stdint.h>
#include<stdlib.h>
#include<stddef.h>
// based on stb.h
trn_char16_t *trn_utf8_to_utf16(trn_char16_t *buffer, const char *ostr, size_t n)
{
unsigned char *str = (unsigned char *) ostr;
uint32_t c;
size_t i=0;
--n;
while (*str) {
if (i >= n)
return NULL;
if (!(*str & 0x80))
buffer[i++] = *str++;
else if ((*str & 0xe0) == 0xc0) {
if (*str < 0xc2) return NULL;
c = (*str++ & 0x1f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
buffer[i++] = c + (*str++ & 0x3f);
} else if ((*str & 0xf0) == 0xe0) {
if (*str == 0xe0 && (str[1] < 0xa0 || str[1] > 0xbf)) return NULL;
if (*str == 0xed && str[1] > 0x9f) return NULL; // str[1] < 0x80 is checked below
c = (*str++ & 0x0f) << 12;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
buffer[i++] = c + (*str++ & 0x3f);
} else if ((*str & 0xf8) == 0xf0) {
if (*str > 0xf4) return NULL;
if (*str == 0xf0 && (str[1] < 0x90 || str[1] > 0xbf)) return NULL;
if (*str == 0xf4 && str[1] > 0x8f) return NULL; // str[1] < 0x80 is checked below
c = (*str++ & 0x07) << 18;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 12;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f) << 6;
if ((*str & 0xc0) != 0x80) return NULL;
c += (*str++ & 0x3f);
// utf-8 encodings of values used in surrogate pairs are invalid
if ((c & 0xFFFFF800) == 0xD800) return NULL;
if (c >= 0x10000) {
c -= 0x10000;
if (i + 2 > n) return NULL;
buffer[i++] = 0xD800 | (0x3ff & (c >> 10));
buffer[i++] = 0xDC00 | (0x3ff & (c ));
}
} else
return NULL;
}
buffer[i] = 0;
return buffer;
}
char *trn_utf16_to_utf8(char *buffer, const trn_char16_t *str, size_t n)
{
size_t i=0;
--n;
while (*str) {
if (*str < 0x80) {
if (i+1 > n) return NULL;
buffer[i++] = (char) *str++;
} else if (*str < 0x800) {
if (i+2 > n) return NULL;
buffer[i++] = 0xc0 + (*str >> 6);
buffer[i++] = 0x80 + (*str & 0x3f);
str += 1;
} else if (*str >= 0xd800 && *str < 0xdc00) {
uint32_t c;
if (i+4 > n) return NULL;
c = ((str[0] - 0xd800) << 10) + ((str[1]) - 0xdc00) + 0x10000;
buffer[i++] = 0xf0 + (c >> 18);
buffer[i++] = 0x80 + ((c >> 12) & 0x3f);
buffer[i++] = 0x80 + ((c >> 6) & 0x3f);
buffer[i++] = 0x80 + ((c ) & 0x3f);
str += 2;
} else if (*str >= 0xdc00 && *str < 0xe000) {
return NULL;
} else {
if (i+3 > n) return NULL;
buffer[i++] = 0xe0 + (*str >> 12);
buffer[i++] = 0x80 + ((*str >> 6) & 0x3f);
buffer[i++] = 0x80 + ((*str ) & 0x3f);
str += 1;
}
}
buffer[i] = 0;
return buffer;
}
|
f89021478b3d078d0b6f304c2b35d62c6a3826ec
|
2ef06401fa315a036787363c95f7d503613e8398
|
/src/c-compiler/ir/exp/assign.h
|
e527a278acc6e423c894967ffdcf3b0c47924c31
|
[
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
jondgoodwin/cone
|
b574151a08bae39d21715d633188206c778d199e
|
698bd6afc75777eabbc8ef576d64d683c6a1c5ab
|
refs/heads/master
| 2022-12-18T16:40:00.287819
| 2022-12-12T07:46:40
| 2022-12-12T07:46:40
| 104,402,759
| 532
| 22
|
NOASSERTION
| 2022-02-23T09:32:54
| 2017-09-21T21:55:04
|
C
|
UTF-8
|
C
| false
| false
| 913
|
h
|
assign.h
|
/** Handling for assignment nodes
* @file
*
* This source file is part of the Cone Programming Language C compiler
* See Copyright Notice in conec.h
*/
#ifndef assign_h
#define assign_h
// Variations on assignment
enum AssignType {
NormalAssign,
LeftAssign
};
// Assignment node
typedef struct AssignNode {
IExpNodeHdr;
INode *lval;
INode *rval;
int16_t assignType;
} AssignNode;
AssignNode *newAssignNode(int16_t assigntype, INode *lval, INode *rval);
// Clone assign
INode *cloneAssignNode(CloneState *cstate, AssignNode *node);
void assignPrint(AssignNode *node);
// Name resolution for assignment node
void assignNameRes(NameResState *pstate, AssignNode *node);
// Type check for assignment node
void assignTypeCheck(TypeCheckState *pstate, AssignNode *node);
// Perform data flow analysis on assignment node
void assignFlow(FlowState *fstate, AssignNode **node);
#endif
|
6505dc23f7111810ceafd343c9eca77c4be8ba22
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/mail/courier/files/patch-courier__cdmsgq.C
|
b1f0f7a080384b6bc5cf34cfb08526fc55aaf380
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 220
|
c
|
patch-courier__cdmsgq.C
|
--- courier/cdmsgq.C.orig 2009-05-02 15:11:56 UTC
+++ courier/cdmsgq.C
@@ -38,6 +38,7 @@
#include <utime.h>
#include "numlib/numlib.h"
+#include <functional>
#include <vector>
#include <list>
#include <algorithm>
|
0cb61a9dd7ec40fffd00ece42b500064891129ba
|
d1a6e586e0ad50da88ac3cf176d40bb9facb6bf6
|
/source/operator/prototype/pad.c
|
c96ad367eff54f1b086d07b3ed8ab1366929bb80
|
[
"Apache-2.0"
] |
permissive
|
OAID/Tengine
|
025d2521040c863300ee08b0800010587b72192b
|
c73708ceb4322ae7c438e4d468178b737fa44cd0
|
refs/heads/tengine-lite
| 2023-09-03T19:15:08.100078
| 2023-05-18T06:17:39
| 2023-05-18T06:17:39
| 115,765,590
| 5,323
| 1,216
|
Apache-2.0
| 2023-09-05T06:25:47
| 2017-12-30T01:21:41
|
C++
|
UTF-8
|
C
| false
| false
| 3,054
|
c
|
pad.c
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
/*
* Copyright (c) 2021, OPEN AI LAB
* Author: sqfu@openailab.com
*/
#include "pad_param.h"
#include "api/c_api.h"
#include "graph/tensor.h"
#include "graph/node.h"
#include "graph/graph.h"
#include "module/module.h"
#include "utility/sys_port.h"
static int infer_shape(ir_node_t* node)
{
ir_graph_t* graph = node->graph;
ir_tensor_t* input = get_ir_graph_tensor(graph, node->input_tensors[0]);
ir_tensor_t* output = get_ir_graph_tensor(graph, node->output_tensors[0]);
struct pad_param* pad_param = (struct pad_param*)(node->op.param_mem);
int dims[TE_MAX_SHAPE_DIM_NUM] = {0};
if (pad_param->pad_0_h != -1 && pad_param->pad_0_w != -1 && pad_param->pad_1_h != -1 && pad_param->pad_1_w != -1 && pad_param->pad_2_h != -1 && pad_param->pad_2_w != -1 && pad_param->pad_3_h != -1 && pad_param->pad_3_w != -1)
{
dims[0] = input->dims[0] + pad_param->pad_0_h + pad_param->pad_0_w;
dims[1] = input->dims[1] + pad_param->pad_1_h + pad_param->pad_1_w;
dims[2] = input->dims[2] + pad_param->pad_2_h + pad_param->pad_2_w;
dims[3] = input->dims[3] + pad_param->pad_3_h + pad_param->pad_3_w;
}
else
{
return -1;
}
set_ir_tensor_shape(output, dims, input->dim_num);
return 0;
}
static int init_op(ir_op_t* op)
{
struct pad_param* pad_param = (struct pad_param*)sys_malloc(sizeof(struct pad_param));
if (pad_param == NULL)
{
return -1;
}
pad_param->mode = 0;
pad_param->pad_0_h = -1; // n
pad_param->pad_0_w = -1;
pad_param->pad_1_h = -1; // c
pad_param->pad_1_w = -1;
pad_param->pad_2_h = -1; // h
pad_param->pad_2_w = -1;
pad_param->pad_3_h = -1; // w
pad_param->pad_3_w = -1;
pad_param->value = 0;
/*set the param default value */
op->param_mem = pad_param;
op->param_size = sizeof(struct pad_param);
op->same_shape = 0;
op->infer_shape = infer_shape;
return 0;
}
static void release_op(ir_op_t* op)
{
sys_free(op->param_mem);
}
int register_pad_op()
{
ir_method_t m;
m.version = 1;
m.init = init_op;
m.release = release_op;
return register_op(OP_PAD, OP_PAD_NAME, &m);
}
int unregister_pad_op()
{
return unregister_op(OP_PAD, 1);
}
|
76dcc22858375f493159976605abc316204b8031
|
d2e0fb3fdad7fc2cb70894591d358f40d8db13d2
|
/libdxui/src/window.c
|
80ca3d346681d50bf078ad1a396dc6e2063916a1
|
[
"ISC",
"MIT"
] |
permissive
|
dennis95/dennix
|
54c568485862a0799664033eb0717abb028d3924
|
f898bb2d27346f6257df1650a002ee929e66e7fa
|
refs/heads/master
| 2023-08-17T06:54:17.274650
| 2023-07-10T16:06:35
| 2023-07-10T16:06:35
| 55,073,371
| 168
| 15
| null | null | null | null |
UTF-8
|
C
| false
| false
| 7,990
|
c
|
window.c
|
/* Copyright (c) 2021 Dennis Wölfing
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, 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.
*/
/* libdxui/src/window.c
* Windows.
*/
#include <dxui.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/guimsg.h>
#include "context.h"
static void deleteWindow(Control* control);
static void redrawWindow(Control* control, dxui_dim dim, dxui_color* lfb,
unsigned int pitch);
static dxui_context* getWindowContext(Container* container);
static dxui_color* getWindowFramebuffer(Container* container, dxui_dim* dim,
unsigned int* pitch);
static void updateRect(Window* window, dxui_rect rect);
static void invalidateWindowRect(Container* container, dxui_rect rect);
const ControlClass dxui_windowControlClass = {
.delete = deleteWindow,
.redraw = redrawWindow,
};
static const ContainerClass windowContainerClass = {
.getContext = getWindowContext,
.getFramebuffer = getWindowFramebuffer,
.invalidate = invalidateWindowRect,
};
void dxui_close(dxui_window* window) {
Window* win = window->internal;
dxui_context* context = win->context;
context->backend->closeWindow(context, win->id);
void (*handler)(dxui_window*) =
win->control.eventHandlers[DXUI_EVENT_WINDOW_CLOSE];
if (handler) {
handler(window);
}
Control* control = win->container.firstControl;
while (control) {
Control* next = control->next;
dxui_delete(control);
control = next;
}
if (win->prev) {
win->prev->next = win->next;
} else {
context->firstWindow = win->next;
}
if (win->next) {
win->next->prev = win->prev;
}
free(win->lfb);
free(window);
}
dxui_window* dxui_create_window(dxui_context* context, dxui_rect rect,
const char* title, int flags) {
Window* window = calloc(1, sizeof(Window));
if (!window) return NULL;
window->control.self = window;
window->control.class = &dxui_windowControlClass;
window->control.text = strdup(title);
if (!window->control.text) {
free(window);
return NULL;
}
window->compositorTitle = window->control.text;
window->control.rect = rect;
window->control.background = COLOR_WHITE_SMOKE;
window->compositorBackground = COLOR_WHITE_SMOKE;
window->container.class = &windowContainerClass;
window->context = context;
window->idAssigned = false;
window->lfbDim = rect.dim;
window->lfb = malloc(rect.width * rect.height * sizeof(dxui_color));
if (!window->lfb) {
free(window->control.text);
free(window);
return NULL;
}
window->redraw = true;
window->next = context->firstWindow;
if (window->next) {
window->next->prev = window;
}
context->firstWindow = window;
context->backend->createWindow(context, rect, title, flags);
while (!window->idAssigned) {
dxui_pump_events(context, DXUI_PUMP_ONCE, -1);
}
dxui_update(window);
return DXUI_AS_WINDOW(window);
}
dxui_color* dxui_get_framebuffer(dxui_window* window, dxui_dim dim) {
Window* win = window->internal;
if (dim.width != win->lfbDim.width || dim.height != win->lfbDim.height) {
dxui_color* lfb = malloc(dim.height * dim.width * sizeof(dxui_color));
if (!lfb) return NULL;
free(win->lfb);
win->lfb = lfb;
win->lfbDim = dim;
}
win->manualDrawing = true;
win->redraw = true;
return win->lfb;
}
void dxui_hide(dxui_window* window) {
Window* win = window->internal;
win->visible = false;
win->context->backend->hideWindow(win->context, win->id);
}
void dxui_release_framebuffer(dxui_window* window) {
Window* win = window->internal;
win->manualDrawing = false;
win->redraw = true;
dxui_update(window);
}
void dxui_resize_window(dxui_window* window, dxui_dim dim) {
Window* win = window->internal;
win->control.rect.dim = dim;
win->context->backend->resizeWindow(win->context, win->id, dim);
}
void dxui_set_cursor(dxui_window* window, int cursor) {
Window* win = window->internal;
win->context->backend->setWindowCursor(win->context, win->id, cursor);
}
void dxui_set_relative_mouse(dxui_window* window, bool relative) {
Window* win = window->internal;
win->relativeMouse = relative;
win->context->backend->setRelativeMouse(win->context, win->id, relative);
}
void dxui_show(dxui_window* window) {
Window* win = window->internal;
win->visible = true;
win->context->backend->showWindow(win->context, win->id);
}
void dxui_update_framebuffer(dxui_window* window, dxui_rect rect) {
Window* win = window->internal;
rect = dxui_rect_crop(rect, win->lfbDim);
if (win->redraw) {
win->context->backend->redrawWindow(win->context, win->id, win->lfbDim,
win->lfb);
win->redraw = false;
} else {
updateRect(win, rect);
}
}
static void deleteWindow(Control* control) {
Window* window = (Window*) control;
dxui_close(DXUI_AS_WINDOW(window));
}
static void redrawWindow(Control* control, dxui_dim dim, dxui_color* lfb,
unsigned int pitch) {
Window* window = (Window*) control;
if (window->manualDrawing) {
window->context->backend->redrawWindow(window->context, window->id,
window->lfbDim, window->lfb);
window->redraw = false;
return;
}
window->updateInProgress = true;
// Inform the compositor about changed backgrounds and titles.
if (window->compositorBackground != control->background) {
window->context->backend->setWindowBackground(window->context,
window->id, control->background);
window->compositorBackground = control->background;
}
if (window->compositorTitle != control->text) {
window->context->backend->setWindowTitle(window->context, window->id,
control->text);
window->compositorTitle = control->text;
}
for (int y = 0; y < dim.height; y++) {
for (int x = 0; x < dim.width; x++) {
lfb[y * pitch + x] = control->background;
}
}
control = window->container.firstControl;
while (control) {
control->class->redraw(control, dim, lfb, pitch);
control = control->next;
}
window->updateInProgress = false;
window->context->backend->redrawWindow(window->context, window->id,
window->lfbDim, window->lfb);
window->redraw = false;
}
static dxui_context* getWindowContext(Container* container) {
Window* window = (Window*) container;
return window->context;
}
static dxui_color* getWindowFramebuffer(Container* container, dxui_dim* dim,
unsigned int* pitch) {
Window* window = (Window*) container;
*dim = window->lfbDim;
*pitch = window->lfbDim.width;
return window->lfb;
}
static void updateRect(Window* window, dxui_rect rect) {
window->context->backend->redrawWindowPart(window->context, window->id,
window->lfbDim.width, rect, window->lfb);
}
static void invalidateWindowRect(Container* container, dxui_rect rect) {
Window* window = (Window*) container;
if (window->updateInProgress) return;
updateRect(window, dxui_rect_crop(rect, window->lfbDim));
}
|
8fb88c0ff8b9a257f563191fb51819fa4edab1ed
|
c013cf150a7ae728caa1468125f0d42f7a5a52eb
|
/src/chiabls/contrib/relic/src/eb/relic_eb_dbl.c
|
58fc4e08cc3712bacabffc0e93a9c5a4bbb16e9b
|
[
"Apache-2.0",
"ISC",
"LGPL-3.0-only",
"MIT",
"LGPL-2.1-only",
"LGPL-2.0-or-later",
"LGPL-2.1-or-later",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
PIVX-Project/PIVX
|
c9d209ea7b8cee627f5ccc1cb63d334b68c454de
|
7488a2721da8a4defc08d145dadd3c3065e2735d
|
refs/heads/master
| 2023-08-19T10:18:31.494805
| 2023-08-17T03:38:56
| 2023-08-17T03:40:09
| 50,740,659
| 663
| 1,520
|
MIT
| 2023-09-13T06:26:34
| 2016-01-30T19:20:24
|
C++
|
UTF-8
|
C
| false
| false
| 4,900
|
c
|
relic_eb_dbl.c
|
/*
* RELIC is an Efficient LIbrary for Cryptography
* Copyright (c) 2009 RELIC Authors
*
* This file is part of RELIC. RELIC is legal property of its developers,
* whose names are not listed here. Please refer to the COPYRIGHT file
* for contact information.
*
* RELIC is free software; you can redistribute it and/or modify it under the
* terms of the version 2.1 (or later) of the GNU Lesser General Public License
* as published by the Free Software Foundation; or version 2.0 of the Apache
* License as published by the Apache Software Foundation. See the LICENSE files
* for more details.
*
* RELIC 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 LICENSE files for more details.
*
* You should have received a copy of the GNU Lesser General Public or the
* Apache License along with RELIC. If not, see <https://www.gnu.org/licenses/>
* or <https://www.apache.org/licenses/>.
*/
/**
* @file
*
* Implementation of point doubling on binary elliptic curves.
*
* @ingroup eb
*/
#include "string.h"
#include "relic_core.h"
#include "relic_eb.h"
/*============================================================================*/
/* Private definitions */
/*============================================================================*/
#if EB_ADD == BASIC || !defined(STRIP)
/**
* Doubles a point represented in affine coordinates on an ordinary binary
* elliptic curve.
*
* @param[out] r - the result.
* @param[in] p - the point to double.
*/
static void eb_dbl_basic_imp(eb_t r, const eb_t p) {
fb_t t0, t1, t2;
fb_null(t0);
fb_null(t1);
fb_null(t2);
RLC_TRY {
fb_new(t0);
fb_new(t1);
fb_new(t2);
/* t0 = 1/x1. */
fb_inv(t0, p->x);
/* t0 = y1/x1. */
fb_mul(t0, t0, p->y);
/* t0 = lambda = x1 + y1/x1. */
fb_add(t0, t0, p->x);
/* t1 = lambda^2. */
fb_sqr(t1, t0);
/* t2 = lambda^2 + lambda. */
fb_add(t2, t1, t0);
/* t2 = lambda^2 + lambda + a2. */
switch (eb_curve_opt_a()) {
case RLC_ZERO:
break;
case RLC_ONE:
fb_add_dig(t2, t2, (dig_t)1);
break;
case RLC_TINY:
fb_add_dig(t2, t2, eb_curve_get_a()[0]);
break;
default:
fb_add(t2, t2, eb_curve_get_a());
break;
}
/* t1 = x1 + x3. */
fb_add(t1, t2, p->x);
/* t1 = lambda * (x1 + x3). */
fb_mul(t1, t0, t1);
fb_copy(r->x, t2);
/* y3 = lambda * (x1 + x3) + x3 + y1. */
fb_add(t1, t1, r->x);
fb_add(r->y, t1, p->y);
fb_copy(r->z, p->z);
r->coord = BASIC;
}
RLC_CATCH_ANY {
RLC_THROW(ERR_CAUGHT);
}
RLC_FINALLY {
fb_free(t0);
fb_free(t1);
fb_free(t2);
}
}
#endif /* EB_ADD == BASIC */
#if EB_ADD == PROJC || !defined(STRIP)
/**
* Doubles a point represented in projective coordinates on an ordinary binary
* elliptic curve.
*
* @param[out] r - the result.
* @param[in] p - the point to double.
*/
static void eb_dbl_projc_imp(eb_t r, const eb_t p) {
fb_t t0, t1;
fb_null(t0);
fb_null(t1);
RLC_TRY {
fb_new(t0);
fb_new(t1);
/* t0 = B = x1^2. */
fb_sqr(t0, p->x);
/* C = B + y1. */
fb_add(r->y, t0, p->y);
if (p->coord != BASIC) {
/* A = x1 * z1. */
fb_mul(t1, p->x, p->z);
/* z3 = A^2. */
fb_sqr(r->z, t1);
} else {
/* if z1 = 1, A = x1. */
fb_copy(t1, p->x);
/* if z1 = 1, z3 = x1^2. */
fb_copy(r->z, t0);
}
/* t1 = D = A * C. */
fb_mul(t1, t1, r->y);
/* C^2 + D. */
fb_sqr(r->y, r->y);
fb_add(r->x, t1, r->y);
/* C^2 + D + a2 * z3. */
switch (eb_curve_opt_a()) {
case RLC_ZERO:
break;
case RLC_ONE:
fb_add(r->x, r->z, r->x);
break;
case RLC_TINY:
fb_mul_dig(r->y, r->z, eb_curve_get_a()[0]);
fb_add(r->x, r->y, r->x);
break;
default:
fb_mul(r->y, r->z, eb_curve_get_a());
fb_add(r->x, r->y, r->x);
break;
}
/* t1 = (D + z3). */
fb_add(t1, t1, r->z);
/* t0 = B^2. */
fb_sqr(t0, t0);
/* t0 = B^2 * z3. */
fb_mul(t0, t0, r->z);
/* y3 = (D + z3) * r3 + B^2 * z3. */
fb_mul(r->y, t1, r->x);
fb_add(r->y, r->y, t0);
r->coord = PROJC;
}
RLC_CATCH_ANY {
RLC_THROW(ERR_CAUGHT);
}
RLC_FINALLY {
fb_free(t0);
fb_free(t1);
}
}
#endif /* EB_ADD == PROJC */
/*============================================================================*/
/* Public definitions */
/*============================================================================*/
#if EB_ADD == BASIC || !defined(STRIP)
void eb_dbl_basic(eb_t r, const eb_t p) {
if (eb_is_infty(p)) {
eb_set_infty(r);
return;
}
eb_dbl_basic_imp(r, p);
}
#endif
#if EB_ADD == PROJC || !defined(STRIP)
void eb_dbl_projc(eb_t r, const eb_t p) {
if (eb_is_infty(p)) {
eb_set_infty(r);
return;
}
eb_dbl_projc_imp(r, p);
}
#endif
|
005ee7bbe1e19d636361a7105ce2f311a897bfae
|
6799592f780197259b8217c70c7f905da233a2ed
|
/misc/fexcept/execdump/xxlib/Std/HSend.h
|
b30bc163d724681acccfa4205c6a1c0db89517de
|
[
"BSD-3-Clause"
] |
permissive
|
FarGroup/FarManager
|
22b1f754a4cf4bcc6e1822a6ce66408fabf140d5
|
da34b0c6da3e03518b8ce7e53783e9fda518bac4
|
refs/heads/master
| 2023-08-20T04:52:54.443453
| 2023-08-12T20:53:56
| 2023-08-12T20:53:56
| 107,807,404
| 1,691
| 228
|
BSD-3-Clause
| 2023-09-14T20:07:19
| 2017-10-21T18:55:45
|
C++
|
UTF-8
|
C
| false
| false
| 3,727
|
h
|
HSend.h
|
#ifndef __MY_PIPE_SEND
#define __MY_PIPE_SEND
#if defined( __HWIN__ )
STRUCT( HPipeStat )
int Names; //Number of items in names array
int Channels; //Number of currently known channels
int Threads; //Number of listener threads
int NNames, //Number of registered unique names
NPipes, //Number of pipes open
NFiles, //Number of files open
NConnect; //Number of connected clients
};
/* HPipeSend
Sends message to known nameserver, wait and receive servers reply.
If server expects less data than 'ssz' send only part of data.
If server reply less data than 'rsz' receive only part of data.
Ret:
rsz - number of really received bytes
-1 - on error
*/
HDECLSPEC int MYRTLEXP HPipeSend( pid_t pid, LPCVOID smsg, LPVOID rmsg, DWORD ssz, DWORD rsz,DWORD tmout = INFINITE );
/* HPipeReply
Send reply to clietn prev connected by Receive.
If 'pid' is not connected to client return -1.
If client expects less data than 'sz' only part of data will be send.
If 'tmout' is set to 0 it used only for check available connection. Data transfers
uses MIN_TIMEOUT instead of zero.
If 'tmout' is set to INFINITE will locks until error or connection made.
In INFINITE mode, if connection made but transfers error reached -1 will be returned.
Ret:
pid - connection id, can be used for Reply and|or Send data back.
-1 - on error
*/
HDECLSPEC int MYRTLEXP HPipeReply( pid_t pid, LPCVOID msg, DWORD sz,DWORD tmout = INFINITE );
/* HPipeReceive
Wait for connection and receive client request.
If client sends less data than 'sz' fill only part of data.
If 'tmout' is set to 0 it used only for check available connection. Data transfers
uses MIN_TIMEOUT instead of zero.
If 'tmout' is set to INFINITE will locks until error or connection made.
In INFINITE mode, if connection made but transfers error reached -1 will be returned.
Ret:
pid - connection id, can be used for Reply and|or Send data back.
-1 - on error
*/
HDECLSPEC pid_t MYRTLEXP HPipeReceive( pid_t pid, LPVOID msg, DWORD ssz,DWORD tmout = INFINITE );
/* HPipeNameLocate
Look for network name, create commenication channel and returns id of channel.
Ret:
channel id - nonzero, on success
-1 - on error
*/
HDECLSPEC pid_t MYRTLEXP HPipeNameLocate( CONSTSTR nm );
/* HPipeNameAttach
Registers global net-wide name.
Ret:
registered ID
-1 on error
*/
HDECLSPEC int MYRTLEXP HPipeNameAttach( CONSTSTR nm );
/* HPipeNameDetach
Unregisters global net-wide name.
Ret:
0 on success
-1 on error
*/
HDECLSPEC int MYRTLEXP HPipeNameDetach( int pid );
/* Fill statistics structure
*/
HDECLSPEC void MYRTLEXP HPipeGetStats( PHPipeStat st );
/* Close all internal data used.
*/
HDECLSPEC void MYRTLEXP HPipeCloseConnections( void );
#define IO_Send HPipeSend
#define IO_Receive HPipeReceive
#define IO_Creceive( p, m, s ) HPipeReceive( p,m,s,0 )
#define IO_Reply HPipeReply
#define IO_NameAttach HPipeNameAttach
#define IO_NameLocate HPipeNameLocate
#define IO_NameDetach HPipeNameDetach
//INTRxxx on QNX are signal-safe functions which are mapped to regular ones on HWIN
#define INTRSend IO_Send
#define INTRReply IO_Reply
#define INTRReceive IO_Receive
#else
#if defined(__QNX__)
#define IO_NameAttach( nm ) qnx_name_attach( 0, nm )
#define IO_NameLocate( nm) qnx_name_locate( 0, nm, 0, NULL )
#define IO_NameDetach( pid ) qnx_name_detach( 0, pid )
#endif
#endif
#endif
|
c1dd004f6b9785253a474f7aea60a4b8801498cd
|
a3d6556180e74af7b555f8d47d3fea55b94bcbda
|
/third_party/opus/src/silk/fixed/vector_ops_FIX.c
|
dcf84070a6b0081b505d593d4cc884e9e30c8d64
|
[
"GPL-1.0-or-later",
"MIT",
"LGPL-2.0-or-later",
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license",
"BSD-3-Clause-Clear"
] |
permissive
|
chromium/chromium
|
aaa9eda10115b50b0616d2f1aed5ef35d1d779d6
|
a401d6cf4f7bf0e2d2e964c512ebb923c3d8832c
|
refs/heads/main
| 2023-08-24T00:35:12.585945
| 2023-08-23T22:01:11
| 2023-08-23T22:01:11
| 120,360,765
| 17,408
| 7,102
|
BSD-3-Clause
| 2023-09-10T23:44:27
| 2018-02-05T20:55:32
| null |
UTF-8
|
C
| false
| false
| 4,767
|
c
|
vector_ops_FIX.c
|
/***********************************************************************
Copyright (c) 2006-2011, Skype Limited. 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 Internet Society, IETF or IETF Trust, nor the
names of specific 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.
***********************************************************************/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "SigProc_FIX.h"
#include "pitch.h"
/* Copy and multiply a vector by a constant */
void silk_scale_copy_vector16(
opus_int16 *data_out,
const opus_int16 *data_in,
opus_int32 gain_Q16, /* I Gain in Q16 */
const opus_int dataSize /* I Length */
)
{
opus_int i;
opus_int32 tmp32;
for( i = 0; i < dataSize; i++ ) {
tmp32 = silk_SMULWB( gain_Q16, data_in[ i ] );
data_out[ i ] = (opus_int16)silk_CHECK_FIT16( tmp32 );
}
}
/* Multiply a vector by a constant */
void silk_scale_vector32_Q26_lshift_18(
opus_int32 *data1, /* I/O Q0/Q18 */
opus_int32 gain_Q26, /* I Q26 */
opus_int dataSize /* I length */
)
{
opus_int i;
for( i = 0; i < dataSize; i++ ) {
data1[ i ] = (opus_int32)silk_CHECK_FIT32( silk_RSHIFT64( silk_SMULL( data1[ i ], gain_Q26 ), 8 ) ); /* OUTPUT: Q18 */
}
}
/* sum = for(i=0;i<len;i++)inVec1[i]*inVec2[i]; --- inner product */
/* Note for ARM asm: */
/* * inVec1 and inVec2 should be at least 2 byte aligned. */
/* * len should be positive 16bit integer. */
/* * only when len>6, memory access can be reduced by half. */
opus_int32 silk_inner_prod_aligned(
const opus_int16 *const inVec1, /* I input vector 1 */
const opus_int16 *const inVec2, /* I input vector 2 */
const opus_int len, /* I vector lengths */
int arch /* I Run-time architecture */
)
{
#ifdef FIXED_POINT
return celt_inner_prod(inVec1, inVec2, len, arch);
#else
opus_int i;
opus_int32 sum = 0;
for( i = 0; i < len; i++ ) {
sum = silk_SMLABB( sum, inVec1[ i ], inVec2[ i ] );
}
return sum;
#endif
}
opus_int64 silk_inner_prod16_c(
const opus_int16 *inVec1, /* I input vector 1 */
const opus_int16 *inVec2, /* I input vector 2 */
const opus_int len /* I vector lengths */
)
{
opus_int i;
opus_int64 sum = 0;
for( i = 0; i < len; i++ ) {
sum = silk_SMLALBB( sum, inVec1[ i ], inVec2[ i ] );
}
return sum;
}
|
2b7b95ba474914e49dfcc0d20bb5f995d081aa01
|
35266a567d1f4e389bb234e72e2d8e4af06bb707
|
/tests/TestInterface.h
|
661cba5d0e4f270a3ba4038459b799b6dfeb8d3b
|
[
"MIT"
] |
permissive
|
WheretIB/nullc
|
6c6ec4a0f53a28c1ede2c0e3e4a9d0af5437d96d
|
bac1a2b2c35676a61392c094b142b50b92952fc8
|
refs/heads/master
| 2022-11-11T03:38:03.706686
| 2022-11-06T01:55:45
| 2022-11-06T01:55:45
| 32,209,998
| 161
| 13
|
MIT
| 2022-11-06T01:55:46
| 2015-03-14T12:15:38
|
C++
|
UTF-8
|
C
| false
| false
| 68
|
h
|
TestInterface.h
|
#pragma once
void RunInterfaceTests();
void RunUtilityTests();
|
fc569b78e0354930d9575985a94fbfa82be13c27
|
42ab733e143d02091d13424fb4df16379d5bba0d
|
/third_party/libsdl2/src/video/wayland/SDL_waylandvideo.c
|
8401a0884e1d7bd0ee9f276dfc5ce0c560e5a9bc
|
[
"Apache-2.0",
"CC0-1.0",
"LicenseRef-scancode-unknown-license-reference",
"Zlib"
] |
permissive
|
google/filament
|
11cd37ac68790fcf8b33416b7d8d8870e48181f0
|
0aa0efe1599798d887fa6e33c412c09e81bea1bf
|
refs/heads/main
| 2023-08-29T17:58:22.496956
| 2023-08-28T17:27:38
| 2023-08-28T17:27:38
| 143,455,116
| 16,631
| 1,961
|
Apache-2.0
| 2023-09-14T16:23:39
| 2018-08-03T17:26:00
|
C++
|
UTF-8
|
C
| false
| false
| 14,972
|
c
|
SDL_waylandvideo.c
|
/*
Simple DirectMedia Layer
Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
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. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*/
#include "../../SDL_internal.h"
#if SDL_VIDEO_DRIVER_WAYLAND
#include "SDL_video.h"
#include "SDL_mouse.h"
#include "SDL_stdinc.h"
#include "../../events/SDL_events_c.h"
#include "SDL_waylandvideo.h"
#include "SDL_waylandevents_c.h"
#include "SDL_waylandwindow.h"
#include "SDL_waylandopengles.h"
#include "SDL_waylandmouse.h"
#include "SDL_waylandtouch.h"
#include "SDL_waylandclipboard.h"
#include "SDL_waylandvulkan.h"
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <xkbcommon/xkbcommon.h>
#include "SDL_waylanddyn.h"
#include <wayland-util.h>
#include "xdg-shell-unstable-v6-client-protocol.h"
#define WAYLANDVID_DRIVER_NAME "wayland"
/* Initialization/Query functions */
static int
Wayland_VideoInit(_THIS);
static void
Wayland_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display);
static int
Wayland_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode);
static void
Wayland_VideoQuit(_THIS);
/* Find out what class name we should use
* Based on src/video/x11/SDL_x11video.c */
static char *
get_classname()
{
/* !!! FIXME: this is probably wrong, albeit harmless in many common cases. From protocol spec:
"The surface class identifies the general class of applications
to which the surface belongs. A common convention is to use the
file name (or the full path if it is a non-standard location) of
the application's .desktop file as the class." */
char *spot;
#if defined(__LINUX__) || defined(__FREEBSD__)
char procfile[1024];
char linkfile[1024];
int linksize;
#endif
/* First allow environment variable override */
spot = SDL_getenv("SDL_VIDEO_WAYLAND_WMCLASS");
if (spot) {
return SDL_strdup(spot);
} else {
/* Fallback to the "old" envvar */
spot = SDL_getenv("SDL_VIDEO_X11_WMCLASS");
if (spot) {
return SDL_strdup(spot);
}
}
/* Next look at the application's executable name */
#if defined(__LINUX__) || defined(__FREEBSD__)
#if defined(__LINUX__)
SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/exe", getpid());
#elif defined(__FREEBSD__)
SDL_snprintf(procfile, SDL_arraysize(procfile), "/proc/%d/file",
getpid());
#else
#error Where can we find the executable name?
#endif
linksize = readlink(procfile, linkfile, sizeof(linkfile) - 1);
if (linksize > 0) {
linkfile[linksize] = '\0';
spot = SDL_strrchr(linkfile, '/');
if (spot) {
return SDL_strdup(spot + 1);
} else {
return SDL_strdup(linkfile);
}
}
#endif /* __LINUX__ || __FREEBSD__ */
/* Finally use the default we've used forever */
return SDL_strdup("SDL_App");
}
/* Wayland driver bootstrap functions */
static int
Wayland_Available(void)
{
struct wl_display *display = NULL;
if (SDL_WAYLAND_LoadSymbols()) {
display = WAYLAND_wl_display_connect(NULL);
if (display != NULL) {
WAYLAND_wl_display_disconnect(display);
}
SDL_WAYLAND_UnloadSymbols();
}
return (display != NULL);
}
static void
Wayland_DeleteDevice(SDL_VideoDevice *device)
{
SDL_free(device);
SDL_WAYLAND_UnloadSymbols();
}
static SDL_VideoDevice *
Wayland_CreateDevice(int devindex)
{
SDL_VideoDevice *device;
if (!SDL_WAYLAND_LoadSymbols()) {
return NULL;
}
/* Initialize all variables that we clean on shutdown */
device = SDL_calloc(1, sizeof(SDL_VideoDevice));
if (!device) {
SDL_WAYLAND_UnloadSymbols();
SDL_OutOfMemory();
return NULL;
}
/* Set the function pointers */
device->VideoInit = Wayland_VideoInit;
device->VideoQuit = Wayland_VideoQuit;
device->SetDisplayMode = Wayland_SetDisplayMode;
device->GetDisplayModes = Wayland_GetDisplayModes;
device->GetWindowWMInfo = Wayland_GetWindowWMInfo;
device->PumpEvents = Wayland_PumpEvents;
device->GL_SwapWindow = Wayland_GLES_SwapWindow;
device->GL_GetSwapInterval = Wayland_GLES_GetSwapInterval;
device->GL_SetSwapInterval = Wayland_GLES_SetSwapInterval;
device->GL_MakeCurrent = Wayland_GLES_MakeCurrent;
device->GL_CreateContext = Wayland_GLES_CreateContext;
device->GL_LoadLibrary = Wayland_GLES_LoadLibrary;
device->GL_UnloadLibrary = Wayland_GLES_UnloadLibrary;
device->GL_GetProcAddress = Wayland_GLES_GetProcAddress;
device->GL_DeleteContext = Wayland_GLES_DeleteContext;
device->CreateSDLWindow = Wayland_CreateWindow;
device->ShowWindow = Wayland_ShowWindow;
device->SetWindowFullscreen = Wayland_SetWindowFullscreen;
device->MaximizeWindow = Wayland_MaximizeWindow;
device->RestoreWindow = Wayland_RestoreWindow;
device->SetWindowSize = Wayland_SetWindowSize;
device->SetWindowTitle = Wayland_SetWindowTitle;
device->DestroyWindow = Wayland_DestroyWindow;
device->SetWindowHitTest = Wayland_SetWindowHitTest;
device->SetClipboardText = Wayland_SetClipboardText;
device->GetClipboardText = Wayland_GetClipboardText;
device->HasClipboardText = Wayland_HasClipboardText;
#if SDL_VIDEO_VULKAN
device->Vulkan_LoadLibrary = Wayland_Vulkan_LoadLibrary;
device->Vulkan_UnloadLibrary = Wayland_Vulkan_UnloadLibrary;
device->Vulkan_GetInstanceExtensions = Wayland_Vulkan_GetInstanceExtensions;
device->Vulkan_CreateSurface = Wayland_Vulkan_CreateSurface;
#endif
device->free = Wayland_DeleteDevice;
return device;
}
VideoBootStrap Wayland_bootstrap = {
WAYLANDVID_DRIVER_NAME, "SDL Wayland video driver",
Wayland_Available, Wayland_CreateDevice
};
static void
display_handle_geometry(void *data,
struct wl_output *output,
int x, int y,
int physical_width,
int physical_height,
int subpixel,
const char *make,
const char *model,
int transform)
{
SDL_VideoDisplay *display = data;
display->name = SDL_strdup(model);
display->driverdata = output;
}
static void
display_handle_mode(void *data,
struct wl_output *output,
uint32_t flags,
int width,
int height,
int refresh)
{
SDL_VideoDisplay *display = data;
SDL_DisplayMode mode;
SDL_zero(mode);
mode.format = SDL_PIXELFORMAT_RGB888;
mode.w = width;
mode.h = height;
mode.refresh_rate = refresh / 1000; // mHz to Hz
mode.driverdata = display->driverdata;
SDL_AddDisplayMode(display, &mode);
if (flags & WL_OUTPUT_MODE_CURRENT) {
display->current_mode = mode;
display->desktop_mode = mode;
}
}
static void
display_handle_done(void *data,
struct wl_output *output)
{
SDL_VideoDisplay *display = data;
SDL_AddVideoDisplay(display);
SDL_free(display->name);
SDL_free(display);
}
static void
display_handle_scale(void *data,
struct wl_output *output,
int32_t factor)
{
// TODO: do HiDPI stuff.
}
static const struct wl_output_listener output_listener = {
display_handle_geometry,
display_handle_mode,
display_handle_done,
display_handle_scale
};
static void
Wayland_add_display(SDL_VideoData *d, uint32_t id)
{
struct wl_output *output;
SDL_VideoDisplay *display = SDL_malloc(sizeof *display);
if (!display) {
SDL_OutOfMemory();
return;
}
SDL_zero(*display);
output = wl_registry_bind(d->registry, id, &wl_output_interface, 2);
if (!output) {
SDL_SetError("Failed to retrieve output.");
SDL_free(display);
return;
}
wl_output_add_listener(output, &output_listener, display);
}
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
static void
windowmanager_hints(void *data, struct qt_windowmanager *qt_windowmanager,
int32_t show_is_fullscreen)
{
}
static void
windowmanager_quit(void *data, struct qt_windowmanager *qt_windowmanager)
{
SDL_SendQuit();
}
static const struct qt_windowmanager_listener windowmanager_listener = {
windowmanager_hints,
windowmanager_quit,
};
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
static void
handle_ping_zxdg_shell(void *data, struct zxdg_shell_v6 *zxdg, uint32_t serial)
{
zxdg_shell_v6_pong(zxdg, serial);
}
static const struct zxdg_shell_v6_listener shell_listener_zxdg = {
handle_ping_zxdg_shell
};
static void
display_handle_global(void *data, struct wl_registry *registry, uint32_t id,
const char *interface, uint32_t version)
{
SDL_VideoData *d = data;
if (strcmp(interface, "wl_compositor") == 0) {
d->compositor = wl_registry_bind(d->registry, id, &wl_compositor_interface, 1);
} else if (strcmp(interface, "wl_output") == 0) {
Wayland_add_display(d, id);
} else if (strcmp(interface, "wl_seat") == 0) {
Wayland_display_add_input(d, id);
} else if (strcmp(interface, "zxdg_shell_v6") == 0) {
d->shell.zxdg = wl_registry_bind(d->registry, id, &zxdg_shell_v6_interface, 1);
zxdg_shell_v6_add_listener(d->shell.zxdg, &shell_listener_zxdg, NULL);
} else if (strcmp(interface, "wl_shell") == 0) {
d->shell.wl = wl_registry_bind(d->registry, id, &wl_shell_interface, 1);
} else if (strcmp(interface, "wl_shm") == 0) {
d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1);
d->cursor_theme = WAYLAND_wl_cursor_theme_load(NULL, 32, d->shm);
} else if (strcmp(interface, "zwp_relative_pointer_manager_v1") == 0) {
Wayland_display_add_relative_pointer_manager(d, id);
} else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0) {
Wayland_display_add_pointer_constraints(d, id);
} else if (strcmp(interface, "wl_data_device_manager") == 0) {
d->data_device_manager = wl_registry_bind(d->registry, id, &wl_data_device_manager_interface, 3);
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
} else if (strcmp(interface, "qt_touch_extension") == 0) {
Wayland_touch_create(d, id);
} else if (strcmp(interface, "qt_surface_extension") == 0) {
d->surface_extension = wl_registry_bind(registry, id,
&qt_surface_extension_interface, 1);
} else if (strcmp(interface, "qt_windowmanager") == 0) {
d->windowmanager = wl_registry_bind(registry, id,
&qt_windowmanager_interface, 1);
qt_windowmanager_add_listener(d->windowmanager, &windowmanager_listener, d);
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
}
}
static const struct wl_registry_listener registry_listener = {
display_handle_global,
NULL, /* global_remove */
};
int
Wayland_VideoInit(_THIS)
{
SDL_VideoData *data = SDL_malloc(sizeof *data);
if (data == NULL)
return SDL_OutOfMemory();
memset(data, 0, sizeof *data);
_this->driverdata = data;
data->xkb_context = WAYLAND_xkb_context_new(0);
if (!data->xkb_context) {
return SDL_SetError("Failed to create XKB context");
}
data->display = WAYLAND_wl_display_connect(NULL);
if (data->display == NULL) {
return SDL_SetError("Failed to connect to a Wayland display");
}
data->registry = wl_display_get_registry(data->display);
if (data->registry == NULL) {
return SDL_SetError("Failed to get the Wayland registry");
}
wl_registry_add_listener(data->registry, ®istry_listener, data);
// First roundtrip to receive all registry objects.
WAYLAND_wl_display_roundtrip(data->display);
// Second roundtrip to receive all output events.
WAYLAND_wl_display_roundtrip(data->display);
Wayland_InitMouse();
/* Get the surface class name, usually the name of the application */
data->classname = get_classname();
WAYLAND_wl_display_flush(data->display);
return 0;
}
static void
Wayland_GetDisplayModes(_THIS, SDL_VideoDisplay *sdl_display)
{
// Nothing to do here, everything was already done in the wl_output
// callbacks.
}
static int
Wayland_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode)
{
return SDL_Unsupported();
}
void
Wayland_VideoQuit(_THIS)
{
SDL_VideoData *data = _this->driverdata;
int i, j;
Wayland_FiniMouse ();
for (i = 0; i < _this->num_displays; ++i) {
SDL_VideoDisplay *display = &_this->displays[i];
wl_output_destroy(display->driverdata);
display->driverdata = NULL;
for (j = display->num_display_modes; j--;) {
display->display_modes[j].driverdata = NULL;
}
display->desktop_mode.driverdata = NULL;
}
Wayland_display_destroy_input(data);
Wayland_display_destroy_pointer_constraints(data);
Wayland_display_destroy_relative_pointer_manager(data);
if (data->xkb_context) {
WAYLAND_xkb_context_unref(data->xkb_context);
data->xkb_context = NULL;
}
#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH
if (data->windowmanager)
qt_windowmanager_destroy(data->windowmanager);
if (data->surface_extension)
qt_surface_extension_destroy(data->surface_extension);
Wayland_touch_destroy(data);
#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */
if (data->shm)
wl_shm_destroy(data->shm);
if (data->cursor_theme)
WAYLAND_wl_cursor_theme_destroy(data->cursor_theme);
if (data->shell.wl)
wl_shell_destroy(data->shell.wl);
if (data->shell.zxdg)
zxdg_shell_v6_destroy(data->shell.zxdg);
if (data->compositor)
wl_compositor_destroy(data->compositor);
if (data->registry)
wl_registry_destroy(data->registry);
if (data->display) {
WAYLAND_wl_display_flush(data->display);
WAYLAND_wl_display_disconnect(data->display);
}
SDL_free(data->classname);
SDL_free(data);
_this->driverdata = NULL;
}
#endif /* SDL_VIDEO_DRIVER_WAYLAND */
/* vi: set ts=4 sw=4 expandtab: */
|
55831a5be1c467722379f2eb140417f14067ed69
|
9f01cf4f599af5ef184b0a0c5ddc9a5ae6e249bf
|
/tools/borplay/source/ao.h
|
a08d8d608ac52c55d8eb48ebcedccaea9e39f538
|
[
"LicenseRef-scancode-free-unknown"
] |
permissive
|
DCurrent/openbor
|
89f348ce7a93519f420ac6602d1fea615703f4ca
|
7f6f17507078848be625e6d1c1b4f41823151387
|
refs/heads/master
| 2023-09-03T12:41:21.059545
| 2022-04-22T20:39:58
| 2022-04-22T20:39:58
| 86,879,076
| 817
| 127
|
BSD-3-Clause
| 2023-09-13T11:47:20
| 2017-04-01T03:06:14
|
C
|
UTF-8
|
C
| false
| false
| 4,217
|
h
|
ao.h
|
/*
*
* ao.h
*
* Original Copyright (C) Aaron Holtzman - May 1999
* Modifications Copyright (C) Stan Seibert - July 2000, July 2001
* More Modifications Copyright (C) Jack Moffitt - October 2000
*
* This file is part of libao, a cross-platform audio outputlibrary. See
* README for a history of this source code.
*
* libao 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, or (at your option)
* any later version.
*
* libao 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 GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __AO_H__
#define __AO_H__
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <windows.h>
#include <mmsystem.h>
#include "os_types.h"
/* --- Constants ---*/
#define AO_TYPE_LIVE 1
#define AO_TYPE_FILE 2
#define AO_ENODRIVER 1
#define AO_ENOTFILE 2
#define AO_ENOTLIVE 3
#define AO_EBADOPTION 4
#define AO_EOPENDEVICE 5
#define AO_EOPENFILE 6
#define AO_EFILEEXISTS 7
#define AO_EFAIL 100
#define AO_FMT_LITTLE 1
#define AO_FMT_BIG 2
#define AO_FMT_NATIVE 4
/* --- Structures --- */
typedef struct ao_info {
int type; /* live output or file output? */
char *name; /* full name of driver */
char *short_name; /* short name of driver */
char *author; /* driver author */
char *comment; /* driver comment */
int preferred_byte_format;
int priority;
char **options;
int option_count;
} ao_info;
typedef struct ao_functions ao_functions; /* Forward decl to make C happy */
typedef struct ao_device {
int type; /* live output or file output? */
// int driver_id;
HWAVEOUT driver_id;
ao_functions *funcs;
FILE *file; /* File for output if this is a file driver */
int client_byte_format;
int machine_byte_format;
int driver_byte_format;
char *swap_buffer;
int swap_buffer_size; /* Bytes allocated to swap_buffer */
void *internal; /* Pointer to driver-specific data */
} ao_device;
typedef struct ao_sample_format {
int bits; /* bits per sample */
int rate; /* samples per second (in a single channel) */
int channels; /* number of audio channels */
int byte_format; /* Byte ordering in sample, see constants below */
} ao_sample_format;
struct ao_functions {
int (*test)(void);
ao_info* (*driver_info)(void);
int (*device_init)(ao_device *device);
int (*set_option)(ao_device *device, const char *key,
const char *value);
int (*open)(ao_device *device, ao_sample_format *format);
int (*play)(ao_device *device, const char *output_samples,
uint_32 num_bytes);
int (*close)(ao_device *device);
void (*device_clear)(ao_device *device);
char* (*file_extension)(void);
};
typedef struct ao_option {
char *key;
char *value;
struct ao_option *next;
} ao_option;
/* --- Functions --- */
/* library setup/teardown */
void ao_initialize(void);
void ao_shutdown(void);
/* device setup/playback/teardown */
int ao_append_option(ao_option **options, const char *key,
const char *value);
void ao_free_options(ao_option *options);
ao_device* ao_open_live(int driver_id, ao_sample_format *format,
ao_option *option);
ao_device* ao_open_file(int driver_id, const char *filename, int overwrite,
ao_sample_format *format, ao_option *option);
int ao_play(ao_device *device, char *output_samples, uint_32 num_bytes);
int ao_close(ao_device *device);
/* driver information */
int ao_driver_id(const char *short_name);
int ao_default_driver_id();
ao_info *ao_driver_info(int driver_id);
ao_info **ao_driver_info_list(int *driver_count);
char *ao_file_extension(int driver_id);
/* miscellaneous */
int ao_is_big_endian(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __AO_H__ */
|
c28f6faacdb70a062a2067c212e3f91b0aac3ca2
|
e65a4dbfbfb0e54e59787ba7741efee12f7687f3
|
/mail/antivirus-milter/files/patch-antivirus.c
|
8975376919daedc2a674070aaebf588630dfcd55
|
[
"BSD-2-Clause"
] |
permissive
|
freebsd/freebsd-ports
|
86f2e89d43913412c4f6b2be3e255bc0945eac12
|
605a2983f245ac63f5420e023e7dce56898ad801
|
refs/heads/main
| 2023-08-30T21:46:28.720924
| 2023-08-30T19:33:44
| 2023-08-30T19:33:44
| 1,803,961
| 916
| 918
|
NOASSERTION
| 2023-09-08T04:06:26
| 2011-05-26T11:15:35
| null |
UTF-8
|
C
| false
| false
| 2,614
|
c
|
patch-antivirus.c
|
--- antivirus.c.orig 2003-07-15 19:27:14 UTC
+++ antivirus.c
@@ -85,6 +85,8 @@ static char *VIRUSACTION=NULL;
static char *FORMAT=NULL;
static sfsistat avfailcode=0;
static int purgevirus=0;
+static int skipwords=0;
+static int ignorerror2=0;
static char *avargs[]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
/*
@@ -128,6 +130,12 @@ static char *badext[]={".com",".scr",".v
#define FORMAT_SOPHOS ">>> Virus '%[^']s' found in file %*s"
/*
+** This one is for clamav
+*/
+#define FORMAT_CLAMAV " %s FOUND"
+#define SCANARGS_CLAMAV "--disable-summary"
+
+/*
** this can be given on the command line
*/
static char *configfile=NULL;
@@ -502,6 +510,7 @@ sfsistat virusscan(SMFICTX *ctx, char *p
int retval;
int fd;
int i;
+ char *word;
char *p=NULL;
char *av[]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
@@ -552,13 +561,26 @@ sfsistat virusscan(SMFICTX *ctx, char *p
(int)ctx, retval,priv->workdir);
}
+ if (ignorerror2 > 0 )
+ {
+ if ( retval == 2 )
+ retval = 0;
+ }
+
if (retval>0)
{
fseek(priv->childfp,0,SEEK_SET);
memset(viruses,0,sizeof(buf));
while (fgets(buf,sizeof(buf),priv->childfp)!=NULL)
{
- if (sscanf(buf,format,tmp)==1)
+ word = buf;
+ if (skipwords > 0 )
+ {
+ word = strchr( word, ' ' );
+ if ( word == NULL )
+ word = buf;
+ }
+ if (sscanf(word,format,tmp)==1)
{
if (viruses[0])
strncat(viruses," ",sizeof(viruses));
@@ -572,10 +594,8 @@ sfsistat virusscan(SMFICTX *ctx, char *p
if (viruses[0])
priv->viruses=strdup(viruses);
else
- priv->viruses=strdup("please contact postmaster");
-
- if ((priv->viruses)==NULL)
{
+ priv->viruses=strdup("please contact postmaster");
return(avfailcode);
}
return(SMFIS_REJECT);
@@ -1211,6 +1231,7 @@ int init(void)
if (AVFAILACTION==NULL) AVFAILACTION=CONF_AVFAILACTION;
if (VIRUSACTION==NULL) VIRUSACTION=CONF_VIRUSACTION;
+ skipwords = 0;
if (strcasecmp(AVPRODUCT,"mcafee")==0)
{
FORMAT=FORMAT_MCAFEE;
@@ -1225,10 +1246,17 @@ int init(void)
{
FORMAT=FORMAT_FSAV;
}
+ else if (strcasecmp(AVPRODUCT,"clamav")==0)
+ {
+ FORMAT=FORMAT_CLAMAV;
+ AVSCANARGS=SCANARGS_CLAMAV;
+ skipwords = 1;
+ ignorerror2 = 1;
+ }
else
{
fprintf(stderr,"init(): unrecognized AVPRODUCT %s\n",AVPRODUCT);
- fprintf(stderr,"init(): valid values are: mcafee, fsva, sophos\n");
+ fprintf(stderr,"init(): valid values are: mcafee, fsva, sophos, clamav\n");
return(-1);
}
|
1d4bb85fb443173f852a8c8f3b72c487e96dd355
|
7664f318ed04bd0680f3d82321c18896e3ef6ad5
|
/src/libultra/io/sptaskyield.c
|
ec7a248bbbacdb46dc74105d57c951f73133b753
|
[] |
no_license
|
zeldaret/oot
|
9c80ce17f2d8fd61514b375f92ee4739b5ce9d4e
|
2875ab4fcf5c5f81d76353d1ee0024c9ea8d0b23
|
refs/heads/master
| 2023-08-29T05:29:31.356427
| 2023-08-28T22:48:52
| 2023-08-28T22:48:52
| 247,875,738
| 4,401
| 802
| null | 2023-09-14T13:34:38
| 2020-03-17T04:02:19
|
C
|
UTF-8
|
C
| false
| false
| 84
|
c
|
sptaskyield.c
|
#include "global.h"
void osSpTaskYield(void) {
__osSpSetStatus(SP_SET_SIG0);
}
|
05e4675d615eb2f51c53c9a0a598fe2291f0c413
|
d61b532db0d3e08818338cfaac530a1ced1ffe3b
|
/util/ceg/defaults/pseudo/C_df_ilb.c
|
852572ce9a8d1bb6815256ee29397219383fa4a9
|
[
"LicenseRef-scancode-other-permissive"
] |
permissive
|
davidgiven/ack
|
61049c7a8e95ff61a77b1edd3c22bb290720e276
|
db5a32c68c4a60ca26a3927a799ea662b5b2b0e5
|
refs/heads/default
| 2023-08-29T07:33:12.771205
| 2023-07-08T20:17:27
| 2023-07-08T20:17:27
| 37,686,316
| 376
| 74
|
NOASSERTION
| 2023-07-08T20:17:28
| 2015-06-18T21:33:42
|
C
|
UTF-8
|
C
| false
| false
| 203
|
c
|
C_df_ilb.c
|
#define CODE_EXPANDER
#include <em.h>
#include "back.h"
extern int B_procno;
void
C_df_ilb( l)
label l;
{
char *s;
swtxt();
symbol_definition(s = extnd_ilb( l, B_procno));
set_local_visible(s);
}
|
9e3c7278b4bd8812d7c8e86fdf2231122b0a7684
|
9ceacf33fd96913cac7ef15492c126d96cae6911
|
/lib/libc/hidden/dirent.h
|
1e8398291c8eb509c07257ef9fc2386e85f50fe9
|
[
"ISC"
] |
permissive
|
openbsd/src
|
ab97ef834fd2d5a7f6729814665e9782b586c130
|
9e79f3a0ebd11a25b4bff61e900cb6de9e7795e9
|
refs/heads/master
| 2023-09-02T18:54:56.624627
| 2023-09-02T15:16:12
| 2023-09-02T15:16:12
| 66,966,208
| 3,394
| 1,235
| null | 2023-08-08T02:42:25
| 2016-08-30T18:18:25
|
C
|
UTF-8
|
C
| false
| false
| 1,270
|
h
|
dirent.h
|
/* $OpenBSD: dirent.h,v 1.1 2015/09/12 13:34:22 guenther Exp $ */
/*
* Copyright (c) 2015 Philip Guenther <guenther@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, 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.
*/
#ifndef _LIBC_DIRENT_H_
#define _LIBC_DIRENT_H_
#include_next <dirent.h>
PROTO_DEPRECATED(alphasort);
PROTO_NORMAL(closedir);
PROTO_NORMAL(dirfd);
PROTO_NORMAL(fdopendir);
PROTO_NORMAL(getdents);
PROTO_NORMAL(opendir);
PROTO_NORMAL(readdir);
PROTO_DEPRECATED(readdir_r);
PROTO_DEPRECATED(rewinddir);
PROTO_DEPRECATED(scandir);
PROTO_NORMAL(seekdir);
PROTO_NORMAL(telldir);
#endif /* !_LIBC_DIRENT_H_ */
|
4dfb090c8240450f7ebe08ca74822e72981f58c0
|
9ceacf33fd96913cac7ef15492c126d96cae6911
|
/lib/libc/rpc/xdr_reference.c
|
de7f4f6b7f869c3b955c7d359624447463632314
|
[
"BSD-3-Clause"
] |
permissive
|
openbsd/src
|
ab97ef834fd2d5a7f6729814665e9782b586c130
|
9e79f3a0ebd11a25b4bff61e900cb6de9e7795e9
|
refs/heads/master
| 2023-09-02T18:54:56.624627
| 2023-09-02T15:16:12
| 2023-09-02T15:16:12
| 66,966,208
| 3,394
| 1,235
| null | 2023-08-08T02:42:25
| 2016-08-30T18:18:25
|
C
|
UTF-8
|
C
| false
| false
| 3,787
|
c
|
xdr_reference.c
|
/* $OpenBSD: xdr_reference.c,v 1.13 2022/12/27 17:10:06 jmc Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
*
* 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 the "Oracle America, Inc." 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.
*/
/*
* xdr_reference.c, Generic XDR routines implementation.
*
* These are the "non-trivial" xdr primitives used to serialize and de-serialize
* "pointers". See xdr.h for more info on the interface to xdr.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
/*
* XDR an indirect pointer
* xdr_reference is for recursively translating a structure that is
* referenced by a pointer inside the structure that is currently being
* translated. pp references a pointer to storage. If *pp is null
* the necessary storage is allocated.
* size is the sizeof the referenced structure.
* proc is the routine to handle the referenced structure.
*/
bool_t
xdr_reference(XDR *xdrs,
caddr_t *pp, /* the pointer to work on */
u_int size, /* size of the object pointed to */
xdrproc_t proc) /* xdr routine to handle the object */
{
caddr_t loc = *pp;
bool_t stat;
if (loc == NULL)
switch (xdrs->x_op) {
case XDR_FREE:
return (TRUE);
case XDR_DECODE:
*pp = loc = (caddr_t) calloc(size, 1);
if (loc == NULL)
return (FALSE);
break;
default:
break;
}
stat = (*proc)(xdrs, loc);
if (xdrs->x_op == XDR_FREE) {
mem_free(loc, size);
*pp = NULL;
}
return (stat);
}
DEF_WEAK(xdr_reference);
/*
* xdr_pointer():
*
* XDR a pointer to a possibly recursive data structure. This
* differs with xdr_reference in that it can serialize/deserialiaze
* trees correctly.
*
* What's sent is actually a union:
*
* union object_pointer switch (boolean b) {
* case TRUE: object_data data;
* case FALSE: void nothing;
* }
*
* > objpp: Pointer to the pointer to the object.
* > obj_size: size of the object.
* > xdr_obj: routine to XDR an object.
*
*/
bool_t
xdr_pointer(XDR *xdrs, char **objpp, u_int obj_size, xdrproc_t xdr_obj)
{
bool_t more_data;
more_data = (*objpp != NULL);
if (! xdr_bool(xdrs,&more_data)) {
return (FALSE);
}
if (! more_data) {
*objpp = NULL;
return (TRUE);
}
return (xdr_reference(xdrs,objpp,obj_size,xdr_obj));
}
DEF_WEAK(xdr_pointer);
|
c9f192edefdb8fbce325fa39b67027184b34d480
|
a4515918f56dd7ab527e4999aa7fce818b6dd6f6
|
/calculator.c
|
c5f985af210d3064d6fbe8dd70d7a7a015cf9f21
|
[
"MIT"
] |
permissive
|
rathoresrikant/HacktoberFestContribute
|
0e2d4692a305f079e5aebcd331e8df04b90f90da
|
e2a69e284b3b1bd0c7c16ea41217cc6c2ec57592
|
refs/heads/master
| 2023-06-13T09:22:22.554887
| 2021-10-27T07:51:41
| 2021-10-27T07:51:41
| 151,832,935
| 102
| 901
|
MIT
| 2023-06-23T06:53:32
| 2018-10-06T11:23:31
|
C++
|
UTF-8
|
C
| false
| false
| 608
|
c
|
calculator.c
|
#include<stdio.h>
int main(void)
{
char operator;
double n1,n2;
printf("Enter an operator (+, -, *,/): ");
scanf("%c", &operator);
printf("Enter two numbers: ");
scanf("%lf %lf",&n1, &n2);
switch(operator)
{
case '+':
printf("%lf + %lf = %lf ", n1, n2, n1 + n2);
break;
case '-':
printf("%lf - %lf = %lf ", n1, n2, n1 - n2);
break;
case '*':
printf("%lf * %lf = %lf ", n1, n2, n1 * n2);
break;
case '/':
printf("%lf / %lf = %lf ", n1, n2, n1 / n2);
break;
}
printf("\n");
return 0;
}
|
586fee0df056628c69dd79de200354c7852093bf
|
7f6c235b0598353549959c18f69eefd20b766907
|
/include/_DEVELOPMENT/sdcc/threads.h
|
61962e29543c7e943f800b060204a97a62c469af
|
[
"ClArtistic"
] |
permissive
|
z88dk/z88dk
|
46dfd4905f36d99333173cadd0a660839befc9f0
|
8b07f37cc43c5d9ffe69b563c80763491d8faff7
|
refs/heads/master
| 2023-09-04T19:29:49.254958
| 2023-09-03T20:51:24
| 2023-09-03T20:51:24
| 54,035,569
| 820
| 263
|
NOASSERTION
| 2023-09-05T11:09:04
| 2016-03-16T13:48:16
|
Assembly
|
UTF-8
|
C
| false
| false
| 2,333
|
h
|
threads.h
|
// automatically generated by m4 from headers in proto subdir
#ifndef __THREADS_H__
#define __THREADS_H__
#include <stdint.h>
// DATA STRUCTURES
typedef struct mtx_s
{
uint8_t thrd_owner;
uint8_t mutex_type;
uint8_t lock_count;
uint8_t spinlock;
void *q; // p_forward_list *
} mtx_t;
typedef uint16_t once_flag;
#define ONCE_FLAG_INIT 0x00fe
// mutex
extern void call_once(once_flag *flag,void *func);
extern void call_once_callee(once_flag *flag,void *func) __z88dk_callee;
#define call_once(a,b) call_once_callee(a,b)
extern void mtx_destroy(mtx_t *m) __preserves_regs(b,c,d,e);
extern void mtx_destroy_fastcall(mtx_t *m) __preserves_regs(b,c,d,e) __z88dk_fastcall;
#define mtx_destroy(a) mtx_destroy_fastcall(a)
extern int mtx_init(mtx_t *m,int type) __preserves_regs(d,e);
extern int mtx_init_callee(mtx_t *m,int type) __preserves_regs(d,e) __z88dk_callee;
#define mtx_init(a,b) mtx_init_callee(a,b)
extern int mtx_lock(mtx_t *m);
extern int mtx_lock_fastcall(mtx_t *m) __z88dk_fastcall;
#define mtx_lock(a) mtx_lock_fastcall(a)
extern int mtx_timedlock(mtx_t *m,struct timespec *ts);
extern int mtx_timedlock_callee(mtx_t *m,struct timespec *ts) __z88dk_callee;
#define mtx_timedlock(a,b) mtx_timedlock_callee(a,b)
extern int mtx_trylock(mtx_t *m) __preserves_regs(b,c,d,e);
extern int mtx_trylock_fastcall(mtx_t *m) __preserves_regs(b,c,d,e) __z88dk_fastcall;
#define mtx_trylock(a) mtx_trylock_fastcall(a)
extern int mtx_unlock(mtx_t *m);
extern int mtx_unlock_fastcall(mtx_t *m) __z88dk_fastcall;
#define mtx_unlock(a) mtx_unlock_fastcall(a)
extern void spinlock_acquire(char *spinlock) __preserves_regs(b,c,d,e);
extern void spinlock_acquire_fastcall(char *spinlock) __preserves_regs(a,b,c,d,e,h,l) __z88dk_fastcall;
#define spinlock_acquire(a) spinlock_acquire_fastcall(a)
extern void spinlock_release(char *spinlock) __preserves_regs(b,c,d,e);
extern void spinlock_release_fastcall(char *spinlock) __preserves_regs(a,b,c,d,e,h,l) __z88dk_fastcall;
#define spinlock_release(a) spinlock_release_fastcall(a)
extern int spinlock_tryacquire(char *spinlock) __preserves_regs(b,c,d,e);
extern int spinlock_tryacquire_fastcall(char *spinlock) __preserves_regs(a,b,c,d,e) __z88dk_fastcall;
#define spinlock_tryacquire(a) spinlock_tryacquire_fastcall(a)
#endif
|
4dd7cc9c2b6a61ae4dd5a1c0b88c7f8fa159c2cd
|
cfb156de35a7f3987f88d6b025c762921f5e9931
|
/tests/math_data/log1p_intel_data.h
|
12118ea3dd2375578f898c205da40cf601d37773
|
[
"Apache-2.0",
"BSD-2-Clause"
] |
permissive
|
aosp-mirror/platform_bionic
|
6faa82304cb67f3347a9b04f2f0eb712444d764a
|
143f3cea320becbfc836309fade5dfa1074731d0
|
refs/heads/master
| 2023-07-08T07:44:02.618070
| 2023-06-26T23:35:08
| 2023-06-26T23:35:08
| 65,830
| 300
| 131
| null | 2018-11-05T20:53:52
| 2008-10-21T18:19:55
|
Objective-C
|
UTF-8
|
C
| false
| false
| 33,202
|
h
|
log1p_intel_data.h
|
/*
* Copyright (C) 2014 The Android Open Source Project
*
* 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.
*/
static data_1_1_t<double, double> g_log1p_intel_data[] = {
{ // Entry 0
-0x1.00000000000010p-1022,
-0x1.0000000000001p-1022
},
{ // Entry 1
-0x1.0415d89e74446809b5d7e16e90dcfb17p-5,
-0x1.0000000000002p-5
},
{ // Entry 2
-0x1.269621334db92803beb76a16b5547d4dp-2,
-0x1.000000180p-2
},
{ // Entry 3
-0x1.00080000000008008002000000555d55p-52,
-0x1.00080p-52
},
{ // Entry 4
-0x1.001000000040080040001559559556b2p-41,
-0x1.001p-41
},
{ // Entry 5
-0x1.65724c2110f35416c9322de1fbce6ea0p-2,
-0x1.2dba262a7c8b0p-2
},
{ // Entry 6
-0x1.5af4179028eb7638f1145bd433d6c831p-11,
-0x1.5ad6b5ad6b5b0p-11
},
{ // Entry 7
-0x1.74fc36f06cd5b7ffd79b0ff90a64bb6ep-6,
-0x1.70c58e67b7aeap-6
},
{ // Entry 8
-0x1.d62e0cd7372ac11cfb2f285d279dc3d4p-2,
-0x1.7905b82a1839dp-2
},
{ // Entry 9
-0x1.7d9c1debf082f7fe3df487d0e4823676p-6,
-0x1.793331eece596p-6
},
{ // Entry 10
-0x1.e148a1a2726cbfb45f343d2e78b71a51p-2,
-0x1.7ffffffffffffp-2
},
{ // Entry 11
-0x1.9baf61134c048801e3731883b65290b3p-5,
-0x1.9182fde7e3318p-5
},
{ // Entry 12
-0x1.ff93ccbd3124237a5b3cf16c47c915c9p-2,
-0x1.92a7fc86dcbd9p-2
},
{ // Entry 13
-0x1.8feb5ba3c5b0d7fddffe1b9133bd3827p0,
-0x1.94a5294a5294cp-1
},
{ // Entry 14
-0x1.e265a1d9483178002922dd984d33f198p-4,
-0x1.c712d0d7f0490p-4
},
{ // Entry 15
-0x1.cd4e4c03a55707e868994265170eefb8p-10,
-0x1.cce673399cce8p-10
},
{ // Entry 16
-0x1.e5df7f9b307ac000115f8473c90fb515p-9,
-0x1.e4f93e4f93e50p-9
},
{ // Entry 17
-0x1.f96ef48ecd4037fe220ffae33fef5d04p-5,
-0x1.ea28302403580p-5
},
{ // Entry 18
-0x1.fdd09f73d7f688dd5508c770fe7b7a9fp-5,
-0x1.ee4675d0ac9aap-5
},
{ // Entry 19
-0x1.ffffffffffe4b72dd5ac98791a728e1fp-5,
-0x1.f0540438fd429p-5
},
{ // Entry 20
-0x1.ff7fac9bb11607daf86980492f147eedp-10,
-0x1.ff0001ffffffep-10
},
{ // Entry 21
-0x1.ffe7fffffffff7ff40047fffffaaaaaap-54,
-0x1.ffe7fffffffffp-54
},
{ // Entry 22
-0x1.4cb9ed50b6bc79d44d301801ce0ff6f3p4,
-0x1.fffffff801fffp-1
},
{ // Entry 23
-0x1.57cd0e3026827bbcd5d3d6a532515bd1p4,
-0x1.fffffffbfffffp-1
},
{ // Entry 24
-0x1.002005545508732d7b57a1ec86bd5c7ap-10,
-0x1.fffffffc0p-11
},
{ // Entry 25
-0x1.08598b57c1806001dbb99c0aebf44bdep-4,
-0x1.fffffffc0003fp-5
},
{ // Entry 26
-0x1.08598b58e3a06001bf513750331fb25cp-4,
-0x1.fffffffe1ffffp-5
},
{ // Entry 27
-0x1.ffffffff000007fffffff800002aacaap-54,
-0x1.ffffffff0p-54
},
{ // Entry 28
-0x1.00000000001ff7fffffff54d55555547p-40,
-0x1.ffffffffff3ffp-41
},
{ // Entry 29
-0x1.ffffffffffffeffffffffffffeaaaaaap-53,
-0x1.ffffffffffffep-53
},
{ // Entry 30
0x1.ffffffffff0000000000aaaaaaaaaa2ap-41,
0x1.0p-40
},
{ // Entry 31
0x1.ffffffffffffffffffffffffffffffp-121,
0x1.0p-120
},
{ // Entry 32
0.0,
0x1.0p-1074
},
{ // Entry 33
0x1.fffffffffffffffffffffffffeaaaaaap-52,
0x1.0000000000001p-51
},
{ // Entry 34
0x1.00000000000007ffffffffffff555555p-52,
0x1.0000000000001p-52
},
{ // Entry 35
0x1.9f323ecbf9855480be2cbc494f93df36p-2,
0x1.0000000000007p-1
},
{ // Entry 36
0x1.ffffffffffc0000000000aaaaaaaaaa8p-42,
0x1.00000000002p-41
},
{ // Entry 37
0x1.ffffffffffdffffffffffaaaaaaaaaaep-42,
0x1.00000000003p-41
},
{ // Entry 38
0x1.ffe002ae6a31006877edb3328bd3ae91p-12,
0x1.00000001fffffp-11
},
{ // Entry 39
0x1.9f323f094c68a8000013901093412da6p-2,
0x1.0000002dfe2afp-1
},
{ // Entry 40
0x1.9f323f094c692800000be5b40e615d2dp-2,
0x1.0000002dfe2b5p-1
},
{ // Entry 41
0x1.193ea82ad0308976a42437ffabe62762p0,
0x1.000000cp1
},
{ // Entry 42
0x1.f0b21b0c9a27f7973092bef2b8a18d80p-5,
0x1.00080p-4
},
{ // Entry 43
0x1.1ace1631f668001f17e5430537a94f9fp5,
0x1.00080p51
},
{ // Entry 44
0x1.000fffffffbff7ffc0001559559556a2p-41,
0x1.001p-41
},
{ // Entry 45
0x1.f31cdeeb3cd4c7c0a3e945ad856befcbp4,
0x1.00cp45
},
{ // Entry 46
0x1.206360b7e569587b36009d7c942d4f3cp5,
0x1.014p52
},
{ // Entry 47
0x1.f333a5f5edb1b76e16684e60b7181719p-5,
0x1.015cdfc51f91cp-4
},
{ // Entry 48
0x1.64892563f80250000b60adaac677e2eap-1,
0x1.01a5a2b15fc5cp0
},
{ // Entry 49
0x1.0482afcf527d98002bc41c40cd3b44c5p-23,
0x1.0482b0d86c362p-23
},
{ // Entry 50
0x1.045dcf2cb15f57fe3f2ed152226368c8p-5,
0x1.088c59ac8c7d1p-5
},
{ // Entry 51
0x1.015e05876e3e67fff047c696eba44ba2p-4,
0x1.09ap-4
},
{ // Entry 52
0x1.0b6515d81d9732694cd7ec512fc6f1b4p-11,
0x1.0b768b5ad8019p-11
},
{ // Entry 53
0x1.b346a1d28f44d7fdcee7a0bd07405845p-2,
0x1.0f35566ed3cc2p-1
},
{ // Entry 54
0x1.b3cce9b7221757feb43dcf531070c894p0,
0x1.1f27c14e425b9p2
},
{ // Entry 55
0x1.fbc379bd13a6b00091e8da2307a3712fp-3,
0x1.202p-2
},
{ // Entry 56
0x1.2140a33ee4f537fe4de38bae4056e098p-5,
0x1.266b753946441p-5
},
{ // Entry 57
0x1.d6bfbea5ab7fd4c43b30348da32e2a7dp-2,
0x1.2ad0c02f60402p-1
},
{ // Entry 58
0x1.c09da5a8b37876f669efaffd93412f9ap0,
0x1.312e7b7be62a5p2
},
{ // Entry 59
0x1.e3a91d4d7516cb9db08fd3c3cf7d40cap-2,
0x1.351a8d46a35p-1
},
{ // Entry 60
0x1.f128f5faf06ecb35c83b1131cf5d73d5p-2,
0x1.4p-1
},
{ // Entry 61
0x1.f1ee31f14d4f17ffde2f2fe766dfc318p-2,
0x1.40a0502814080p-1
},
{ // Entry 62
0x1.41e3e450b6073001c502b22fec3ab4d7p-5,
0x1.484c43acc194cp-5
},
{ // Entry 63
0x1.4d9ff934d99f37ff40fd39eb618dcd3ap-21,
0x1.4dap-21
},
{ // Entry 64
0x1.a0711f9b475687ffffd2981b5b49910ep2,
0x1.4e5fffff0p9
},
{ // Entry 65
0x1.e1905175711a17c09fd40254fad72ae8p4,
0x1.56f3052920ef0p43
},
{ // Entry 66
0x1.4f7ef3b13e1fa800361c4277dfa1092ap-4,
0x1.5d9e6884d6ac2p-4
},
{ // Entry 67
0x1.e45c01e8c233cffe5ac108bc6c123bfap0,
0x1.688p2
},
{ // Entry 68
0x1.c34366179d4258048e0ec51c6fefd58cp-1,
0x1.6a09e667f3bcbp0
},
{ // Entry 69
0x1.e2af1644433ac7c03096da53cf28c18ap4,
0x1.6fd1ffb140878p43
},
{ // Entry 70
0x1.6392a510033287ffc3d40d8ce33d1627p-4,
0x1.73767fd8537b3p-4
},
{ // Entry 71
0x1.d36a35aaae768800f77be0b2a29e40b7p-1,
0x1.7dd89e50e078ep0
},
{ // Entry 72
0x1.83ffed9f8129180039f0eacf23501c34p-20,
0x1.840p-20
},
{ // Entry 73
0x1.8996381ef2cb67ff2c1a031d8e88fa81p-8,
0x1.8ac562b158ac4p-8
},
{ // Entry 74
0x1.926499264fd877fe77bab85881dbab74p-43,
0x1.926499265p-43
},
{ // Entry 75
0x1.e737cb23865c6b921552ad81d572b729p-1,
0x1.970p0
},
{ // Entry 76
0x1.588c2de5e88db000000ea4e59847d15cp-2,
0x1.99999a1030f9dp-2
},
{ // Entry 77
0x1.588c2df2c02057ffffefc30ff25d79ddp-2,
0x1.99999a222b93fp-2
},
{ // Entry 78
0x1.756501be3e242800001019cd7cd7ce3fp-3,
0x1.99999a598c15cp-3
},
{ // Entry 79
0x1.756502257dbf5000000bc0ddc72156fap-3,
0x1.99999ad572033p-3
},
{ // Entry 80
0x1.8663f9903e12effffff039fafc6b5f67p-4,
0x1.99999bc8ec375p-4
},
{ // Entry 81
0x1.9bd8abb150fbd005aa9e2ed5a074a08ep-21,
0x1.9bd8b60b96e2fp-21
},
{ // Entry 82
0x1.9955bad1e36537ffd7fd8448d392de25p-7,
0x1.9be6f9be6f9b1p-7
},
{ // Entry 83
0x1.5ba06e3fb01a2d107ec5201223f00bbbp-2,
0x1.9dead086a58cdp-2
},
{ // Entry 84
0x1.5f1a557f41f26cc673db4f91686a3758p-2,
0x1.a2ce8df554b2cp-2
},
{ // Entry 85
0x1.62405ebd6ab333837c8a77026ab4aae8p-2,
0x1.a74p-2
},
{ // Entry 86
0x1.f5f73d69114c2b85b3b151d45a33d0e5p-1,
0x1.aa6p0
},
{ // Entry 87
0x1.b229fbeca7781fffe6f5fdb97b7242c6p-5,
0x1.bdep-5
},
{ // Entry 88
0x1.bc21a8cfe0c4178b34990a731d3fbd15p-5,
0x1.c86432190c8p-5
},
{ // Entry 89
0x1.07952367af5c880000105e2b54a5a062p0,
0x1.cccccced2ed7ep0
},
{ // Entry 90
0x1.c1de8bc3181ba001c1b60c40eff90650p-5,
0x1.ce7375b5023c4p-5
},
{ // Entry 91
0x1.d59efda67795a800fddf8c5bba4a60b3p-43,
0x1.d59efda677cb8p-43
},
{ // Entry 92
0x1.d80158c4069057ff768740aa80c0bd66p-7,
0x1.db6bcf502f3e0p-7
},
{ // Entry 93
0x1.dfeabe29b510312e8367f414b0511949p-11,
0x1.e022fd930f86ap-11
},
{ // Entry 94
0x1.8a9a59caf11980a5915d2b6b7cf2553dp-2,
0x1.e16b24d38d1b2p-2
},
{ // Entry 95
0x1.8f11e873662c77e1769d569868a65e72p-2,
0x1.e80p-2
},
{ // Entry 96
0x1.dd166106e87f37622aac2c908d6aaf91p-5,
0x1.eb40e151fad81p-5
},
{ // Entry 97
0x1.ec80ffffffc4b7fe6ff009824ddc235ap-43,
0x1.ec80fffffffffp-43
},
{ // Entry 98
0x1.edf52c2e34740b24b736dca45fb4ae9ep-13,
0x1.ee0410e3b1d24p-13
},
{ // Entry 99
0x1.f02717d855569ffe85bb9f224358afeap-6,
0x1.f7bdd6789c670p-6
},
{ // Entry 100
0x1.fbfffffffe07e80000029aea55555174p-40,
0x1.fbfffffffffffp-40
},
{ // Entry 101
0x1.fbfffffffe07f80000029aca95555174p-40,
0x1.fc0p-40
},
{ // Entry 102
0x1.367799dc39a238068eae0d5339eafee2p5,
0x1.fc00000000006p55
},
{ // Entry 103
0x1.ffc7ffffff0027fcf000aa82af0a71p-41,
0x1.ffc7fffffffffp-41
},
{ // Entry 104
0x1.ffdfffffffffe800fff8000000aa9aabp-54,
0x1.ffdffffffffffp-54
},
{ // Entry 105
0x1.fff7fffffefff7fff000aab2aa8aa9ffp-41,
0x1.fff7fffffffffp-41
},
{ // Entry 106
0x1.fff7ffffffffe8003fff800000aaa6aap-54,
0x1.fff7fffffffffp-54
},
{ // Entry 107
0x1.c55179395a000800ddc334790469d4dep7,
0x1.fffffe3ffffffp326
},
{ // Entry 108
0x1.ffc00aa4ac10abd44706d89cf12892a3p-11,
0x1.fffffffbfffffp-11
},
{ // Entry 109
0x1.ffc00aa7ab50ebc44bf56111ce332375p-11,
0x1.ffffffff0p-11
},
{ // Entry 110
0x1.25e4f7b2737f9fc486612173c6596892p5,
0x1.ffffffffffff8p52
},
{ // Entry 111
0x1.62e42fefa39ef33793c7673007e1ed5ep9,
0x1.ffffffffffff8p1023
},
{ // Entry 112
0x1.9f323ecbf98489d61382119eae69348bp-2,
0x1.ffffffffffffbp-2
},
{ // Entry 113
0x1.5ca72d17ed3ea80089ae65dfafc1e2b2p8,
0x1.ffffffffffffep502
},
{ // Entry 114
0x1.11d14e1fcb72edcb28a032e083a6f199p-1,
0x1.6a09e667f3bccp-1
},
{ // Entry 115
0x1.2ccac6c8f41b74d6b733c9141c0bece5p-1,
0x1.995255f2d00abp-1
},
{ // Entry 116
0x1.466a9269707376e50187259ee2b04818p-1,
0x1.c89ac57dac58ap-1
},
{ // Entry 117
0x1.5ed1a7dce11ace55a3cdbe341ee88222p-1,
0x1.f7e3350888a69p-1
},
{ // Entry 118
0x1.761c7d9dddc01d509dcb9b4ebceca84ep-1,
0x1.1395d249b27a4p0
},
{ // Entry 119
0x1.8c63d27d4ca03daba8c98a232b2380f0p-1,
0x1.2b3a0a0f20a14p0
},
{ // Entry 120
0x1.a1bd4c77d55363ab3b61dc89f7812c71p-1,
0x1.42de41d48ec84p0
},
{ // Entry 121
0x1.b63bf7baf5eaa6eadec65ed0408ff964p-1,
0x1.5a827999fcef4p0
},
{ // Entry 122
0x1.c9f0ad341cbebd1d84ae0c2674a34983p-1,
0x1.7226b15f6b164p0
},
{ // Entry 123
0x1.dcea661b59e7f2a61f64bc6d943ab5aep-1,
0x1.89cae924d93d4p0
},
{ // Entry 124
0x1.ef36808e501ff5bc97de3be617ad08b5p-1,
0x1.a16f20ea47644p0
},
{ // Entry 125
0x1.00707c29c4643ea6f53f2c0edcf3f90ep0,
0x1.b91358afb58b4p0
},
{ // Entry 126
0x1.08fa4b129d365103d8615b0fee830753p0,
0x1.d0b7907523b24p0
},
{ // Entry 127
0x1.113d8baca8608c19974ff89c21cc8d16p0,
0x1.e85bc83a91d94p0
},
{ // Entry 128
0x1.193ea7aad030a976a4198d55053b7cb5p0,
0x1.0p1
},
{ // Entry 129
0x1.11d14e1fcb72edcb28a032e083a6f199p-1,
0x1.6a09e667f3bccp-1
},
{ // Entry 130
0x1.26990e07e25825de21cb52e655390d9ap-1,
0x1.8e3e170bf282dp-1
},
{ // Entry 131
0x1.3a914a1db8cc3855d200ca3202e23d04p-1,
0x1.b27247aff148ep-1
},
{ // Entry 132
0x1.4dc997cbf2ed6806315c6962614b41f2p-1,
0x1.d6a67853f00efp-1
},
{ // Entry 133
0x1.604fdb515451526fcf632e2255d97ef2p-1,
0x1.fadaa8f7eed50p-1
},
{ // Entry 134
0x1.72308447c51665ec8f42f6c1c2f51294p-1,
0x1.0f876ccdf6cd9p0
},
{ // Entry 135
0x1.8376bff406f913a3579a23f2e932df57p-1,
0x1.21a1851ff630ap0
},
{ // Entry 136
0x1.942ca35e8f18f3591aded43add2260dbp-1,
0x1.33bb9d71f593bp0
},
{ // Entry 137
0x1.a45b4ec4852597b4ab8fdd6275a5c1f7p-1,
0x1.45d5b5c3f4f6cp0
},
{ // Entry 138
0x1.b40b0b9a489f168f5ffc2c60ac5bd06ap-1,
0x1.57efce15f459dp0
},
{ // Entry 139
0x1.c34366179d426545cadbc394096e719bp-1,
0x1.6a09e667f3bccp0
},
{ // Entry 140
0x1.1e85f5e7040d03dec59a5f3e3c6be5cfp-1,
0x1.8p-1
},
{ // Entry 141
0x1.34024ac47b6fcebf994c642ef7a882adp-1,
0x1.a666666666666p-1
},
{ // Entry 142
0x1.48a11293d785b50c2a3feb14c3680501p-1,
0x1.cccccccccccccp-1
},
{ // Entry 143
0x1.5c73760b3c362e51806f6a2fcb5402b3p-1,
0x1.f333333333332p-1
},
{ // Entry 144
0x1.6f88b286b22f0a5f70b8ce35df42c80ap-1,
0x1.0ccccccccccccp0
},
{ // Entry 145
0x1.81ee60afb5018aaa0181c98fe3d11e57p-1,
0x1.1ffffffffffffp0
},
{ // Entry 146
0x1.93b0aee21c2c6f1afb29632c77f0434bp-1,
0x1.3333333333332p0
},
{ // Entry 147
0x1.a4da91c611dbcf17d743bad01121e91dp-1,
0x1.4666666666665p0
},
{ // Entry 148
0x1.b575ed0743492c8aacff60d5920dffc4p-1,
0x1.5999999999998p0
},
{ // Entry 149
0x1.c58bb5a60978a15095fe55861acca737p-1,
0x1.6cccccccccccbp0
},
{ // Entry 150
0x1.d5240f0e0e07606e918e49626c8f05e6p-1,
0x1.7fffffffffffep0
},
{ // Entry 151
0x1.62e42fefa39ef35793c7673007e5ed5ep-1,
0x1.0p0
},
{ // Entry 152
0x1.7bdf362e9666e2dc442baf4dc625807dp-1,
0x1.199999999999ap0
},
{ // Entry 153
0x1.93b0aee21c2c8c3240fad7898f606525p-1,
0x1.3333333333334p0
},
{ // Entry 154
0x1.aa73108717b6b240250c5393b356e40ap-1,
0x1.4cccccccccccep0
},
{ // Entry 155
0x1.c03d703735f8e1920627f4336073fe78p-1,
0x1.6666666666668p0
},
{ // Entry 156
0x1.d5240f0e0e0793a1c4c17c959fc23919p-1,
0x1.8000000000002p0
},
{ // Entry 157
0x1.e938cbceb16defcbb921fdd58d5dd567p-1,
0x1.999999999999cp0
},
{ // Entry 158
0x1.fc8b7f138bdeb93fee2e78b4fe3e0831p-1,
0x1.b333333333336p0
},
{ // Entry 159
0x1.0795235c1ea1ca8c0592ee75b4579a8ep0,
0x1.cccccccccccd0p0
},
{ // Entry 160
0x1.1090e20315213b2ddb45c328435c3ca7p0,
0x1.e66666666666ap0
},
{ // Entry 161
0x1.193ea7aad030a976a4198d55053b7cb5p0,
0x1.0p1
},
{ // Entry 162
-0x1.62e42fefa39ef35793c7673007e5ed5ep-1,
-0x1.0p-1
},
{ // Entry 163
-0x1.3217b0fd2b116908897cb1050beea205p-1,
-0x1.ccccccccccccdp-2
},
{ // Entry 164
-0x1.058aefa811451fc7cc1184d75997dc44p-1,
-0x1.999999999999ap-2
},
{ // Entry 165
-0x1.b91f28212ba0379f7a6379b28d1ba9b7p-2,
-0x1.6666666666667p-2
},
{ // Entry 166
-0x1.6d3c324e13f4fe9befad50a0273411c8p-2,
-0x1.3333333333334p-2
},
{ // Entry 167
-0x1.269621134db93cd9140cbcc16037fb86p-2,
-0x1.0000000000001p-2
},
{ // Entry 168
-0x1.c8ff7c79a9a24ac25d81ef2ffc2a24aep-3,
-0x1.999999999999cp-3
},
{ // Entry 169
-0x1.4cd6b9796417b5f11f10de290430b32bp-3,
-0x1.3333333333336p-3
},
{ // Entry 170
-0x1.af8e8210a41636e61283e0400e72f380p-4,
-0x1.999999999999fp-4
},
{ // Entry 171
-0x1.a431d5bcc1942814e94f55ea2e15d5f4p-5,
-0x1.99999999999a4p-5
},
{ // Entry 172
-0x1.400000000000032000000000000a6aaap-54,
-0x1.4p-54
},
{ // Entry 173
0.0,
0.0
},
{ // Entry 174
0x1.8fb063ef2c7e9cdd4f691425091f8212p-5,
0x1.999999999999ap-5
},
{ // Entry 175
0x1.8663f793c46c6f8f982725b4f7100a62p-4,
0x1.999999999999ap-4
},
{ // Entry 176
0x1.1e3b825dd05ec3fb503515bb34638d41p-3,
0x1.3333333333334p-3
},
{ // Entry 177
0x1.7565011e496768e9c982340d63fd99bep-3,
0x1.999999999999ap-3
},
{ // Entry 178
0x1.c8ff7c79a9a21ac25d81ef2ffb9a24aep-3,
0x1.0p-2
},
{ // Entry 179
0x1.0ca937be1b9dbb5e7217a3726f197837p-2,
0x1.3333333333333p-2
},
{ // Entry 180
0x1.334e9e47d07f44b44307069827b79584p-2,
0x1.6666666666666p-2
},
{ // Entry 181
0x1.588c2d913348f380eebceb76c4296aeap-2,
0x1.9999999999999p-2
},
{ // Entry 182
0x1.7c7b282d0d46adc1a6a2b9d712581488p-2,
0x1.cccccccccccccp-2
},
{ // Entry 183
0x1.9f323ecbf984b480be2cbc495a69348bp-2,
0x1.fffffffffffffp-2
},
{ // Entry 184
-0x1.7f7427b73e38f503b99f86230b9f8fa9p1,
-0x1.e666666666666p-1
},
{ // Entry 185
-0x1.26bb1bbb5551382dd4adac5709a61451p1,
-0x1.cccccccccccccp-1
},
{ // Entry 186
-0x1.e5a9a7c3ac414090cf257ef11203a29dp0,
-0x1.b333333333332p-1
},
{ // Entry 187
-0x1.9c041f7ed8d2f6afdf77a5160f5931f4p0,
-0x1.9999999999998p-1
},
{ // Entry 188
-0x1.62e42fefa39eb35793c767300fe5ed5ep0,
-0x1.7fffffffffffep-1
},
{ // Entry 189
-0x1.34378fcbda71c6e50541cb590e10abedp0,
-0x1.6666666666664p-1
},
{ // Entry 190
-0x1.0cc1248b56cc74c07caa7576f1233f0cp0,
-0x1.4cccccccccccap-1
},
{ // Entry 191
-0x1.d5240f0e0e06fa082b27e2fc16cc768ap-1,
-0x1.3333333333330p-1
},
{ // Entry 192
-0x1.98d60031b8212e345617e33819904bcep-1,
-0x1.1999999999996p-1
},
{ // Entry 193
-0x1.62e42fefa39ef35793c7673007e5ed5ep-1,
-0x1.0p-1
},
{ // Entry 194
0x1.1542457337d42e1c6b73c89d866ba171p6,
0x1.0p100
},
{ // Entry 195
0x1.15a3de711cc5494e20ce2f7e3974c4edp6,
0x1.199999999999ap100
},
{ // Entry 196
0x1.15fcf7f3c6f8e1f8e05889b78d1212e9p6,
0x1.3333333333334p100
},
{ // Entry 197
0x1.164eeeaaf5efcc1553be7dcad167cc55p6,
0x1.4cccccccccccep100
},
{ // Entry 198
0x1.169ad1a0c907775fec628588fd1aeadcp6,
0x1.6666666666668p100
},
{ // Entry 199
0x1.16e177b203cdb330ec31f559cfad3551p6,
0x1.8000000000002p100
},
{ // Entry 200
0x1.17238e14da469b55b96c96744e61203ap6,
0x1.999999999999cp100
},
{ // Entry 201
0x1.1761a2765a6960abe5cf92c0959da837p6,
0x1.b333333333336p100
},
{ // Entry 202
0x1.179c2a3292f266ff2833283af2c71bb8p6,
0x1.cccccccccccd0p100
},
{ // Entry 203
0x1.17d387985f833a0d4069f79c1b97242fp6,
0x1.e66666666666ap100
},
{ // Entry 204
0x1.18080dd3171b6c031a9b576be65b6d4cp6,
0x1.0p101
},
{ // Entry 205
0x1.1542457337d42e1c6b73c89d862ba171p7,
0x1.0p200
},
{ // Entry 206
0x1.157311f22a4cbbb54620fc0ddfb31be9p7,
0x1.199999999999ap200
},
{ // Entry 207
0x1.159f9eb37f66880aa5e6292a89842f82p7,
0x1.3333333333334p200
},
{ // Entry 208
0x1.15c89a0f16e1fd18df9923342bb11959p7,
0x1.4cccccccccccep200
},
{ // Entry 209
0x1.15ee8b8a006dd2be2beb2713418c6ab9p7,
0x1.6666666666668p200
},
{ // Entry 210
0x1.1611de929dd0f0a6abd2defbaad7160cp7,
0x1.8000000000002p200
},
{ // Entry 211
0x1.1632e9c4090d64b912702f88ea3260d6p7,
0x1.999999999999cp200
},
{ // Entry 212
0x1.1651f3f4c91ec76428a1adaf0dd1d201p7,
0x1.b333333333336p200
},
{ // Entry 213
0x1.166f37d2e5634a8dc9d3786c3c679778p7,
0x1.cccccccccccd0p200
},
{ // Entry 214
0x1.168ae685cbabb414d5eee01cd0d08b3cp7,
0x1.e66666666666ap200
},
{ // Entry 215
0x1.16a529a32777cd0fc3079004b633875fp7,
0x1.0p201
},
{ // Entry 216
0x1.5a92d6d005c939a38650bac4e7b689cep9,
0x1.0p1000
},
{ // Entry 217
0x1.5a9f09efc2675d09bcfc07a0fe18686cp9,
0x1.199999999999ap1000
},
{ // Entry 218
0x1.5aaa2d2017add01f14ed52e8288cad52p9,
0x1.3333333333334p1000
},
{ // Entry 219
0x1.5ab46bf6fd8cad62a35a116a9117e7c8p9,
0x1.4cccccccccccep1000
},
{ // Entry 220
0x1.5abde855b7efa2cbf66e9262568ebc20p9,
0x1.6666666666668p1000
},
{ // Entry 221
0x1.5ac6bd17df486a461668805c70e166f4p9,
0x1.8000000000002p1000
},
{ // Entry 222
0x1.5aceffe43a17874ab00fd47fc0b839a7p9,
0x1.999999999999cp1000
},
{ // Entry 223
0x1.5ad6c2706a1bdff5759c340949a015f2p9,
0x1.b333333333336p1000
},
{ // Entry 224
0x1.5ade1367f12d00bfdde8a6b895458750p9,
0x1.cccccccccccd0p1000
},
{ // Entry 225
0x1.5ae4ff14aabf1b21a0ef80a4ba5fc441p9,
0x1.e66666666666ap1000
},
{ // Entry 226
0x1.5aeb8fdc01b221605c35ac9eb3b88349p9,
0x1.0p1001
},
{ // Entry 227
0x1.62e42fefa39ef35393c7673007e5dd5ep9,
0x1.fffffffffffffp1023
},
{ // Entry 228
0.0,
0x1.0p-1074
},
{ // Entry 229
-0x1.p-1074,
-0x1.0p-1074
},
{ // Entry 230
0x1.11d14e1fcb72e46bc706b21c5008b9f1p-1,
0x1.6a09e667f3bcbp-1
},
{ // Entry 231
0x1.11d14e1fcb72edcb28a032e083a6f199p-1,
0x1.6a09e667f3bccp-1
},
{ // Entry 232
0x1.11d14e1fcb72f72a8a39b3a4b7193d0ep-1,
0x1.6a09e667f3bcdp-1
},
{ // Entry 233
-0x1.3a5abf07b788ff1b06e03c7b74301bb8p0,
-0x1.6a09e667f3bcdp-1
},
{ // Entry 234
-0x1.3a5abf07b788e3cab7acfcdd8e180c5dp0,
-0x1.6a09e667f3bccp-1
},
{ // Entry 235
-0x1.3a5abf07b788c87a6879bd3faaea06e8p0,
-0x1.6a09e667f3bcbp-1
},
{ // Entry 236
0x1.c34366179d4258048e0ec51c6fefd58cp-1,
0x1.6a09e667f3bcbp0
},
{ // Entry 237
0x1.c34366179d426545cadbc394096e719bp-1,
0x1.6a09e667f3bccp0
},
{ // Entry 238
0x1.c34366179d42728707a8c20ba2953544p-1,
0x1.6a09e667f3bcdp0
},
{ // Entry 239
0x1.9f323ecbf984b480be2cbc495a69348bp-2,
0x1.fffffffffffffp-2
},
{ // Entry 240
0x1.9f323ecbf984bf2b68d766f405221819p-2,
0x1.0p-1
},
{ // Entry 241
0x1.9f323ecbf984d480be2cbc495a3e89e1p-2,
0x1.0000000000001p-1
},
{ // Entry 242
0x1.1e85f5e7040cfaba33513aabf3326da5p-1,
0x1.7ffffffffffffp-1
},
{ // Entry 243
0x1.1e85f5e7040d03dec59a5f3e3c6be5cfp-1,
0x1.8p-1
},
{ // Entry 244
0x1.1e85f5e7040d0d0357e383d0857b9238p-1,
0x1.8000000000001p-1
},
{ // Entry 245
-0x1.62e42fefa39f135793c7673009e5ed5ep0,
-0x1.8000000000001p-1
},
{ // Entry 246
-0x1.62e42fefa39ef35793c7673007e5ed5ep0,
-0x1.8p-1
},
{ // Entry 247
-0x1.62e42fefa39ed35793c7673009e5ed5ep0,
-0x1.7ffffffffffffp-1
},
{ // Entry 248
0x1.d5240f0e0e076d3b5e5b162f39d6b3fap-1,
0x1.7ffffffffffffp0
},
{ // Entry 249
0x1.d5240f0e0e077a082b27e2fc06cc768ap-1,
0x1.8p0
},
{ // Entry 250
0x1.d5240f0e0e0786d4f7f4afc8d3704d94p-1,
0x1.8000000000001p0
},
{ // Entry 251
-0x1.25e4f7b2737fa18486612173c68a6892p5,
-0x1.fffffffffffffp-1
},
{ // Entry 252
0x1.9c041f7ed8d3304979113eafa0de50acp0,
0x1.fffffffffffffp1
},
{ // Entry 253
0x1.9c041f7ed8d336afdf77a516075931f4p0,
0x1.0p2
},
{ // Entry 254
0x1.9c041f7ed8d3437cac4471e2d3d4133bp0,
0x1.0000000000001p2
},
{ // Entry 255
0x1.193ea7aad030a4214ec437ffafd7ee7cp0,
0x1.fffffffffffffp0
},
{ // Entry 256
0x1.193ea7aad030a976a4198d55053b7cb5p0,
0x1.0p1
},
{ // Entry 257
0x1.193ea7aad030b4214ec437ffafad43d2p0,
0x1.0000000000001p1
},
{ // Entry 258
0x1.62e42fefa39eeb5793c7673007d5ed5ep-1,
0x1.fffffffffffffp-1
},
{ // Entry 259
0x1.62e42fefa39ef35793c7673007e5ed5ep-1,
0x1.0p0
},
{ // Entry 260
0x1.62e42fefa39f035793c7673007a5ed5ep-1,
0x1.0000000000001p0
},
{ // Entry 261
0x1.9f323ecbf984b480be2cbc495a69348bp-2,
0x1.fffffffffffffp-2
},
{ // Entry 262
0x1.9f323ecbf984bf2b68d766f405221819p-2,
0x1.0p-1
},
{ // Entry 263
0x1.9f323ecbf984d480be2cbc495a3e89e1p-2,
0x1.0000000000001p-1
},
{ // Entry 264
0x1.c8ff7c79a9a20df590b522632ec31a70p-3,
0x1.fffffffffffffp-3
},
{ // Entry 265
0x1.c8ff7c79a9a21ac25d81ef2ffb9a24aep-3,
0x1.0p-2
},
{ // Entry 266
0x1.c8ff7c79a9a2345bf71b88c9950ac885p-3,
0x1.0000000000001p-2
},
{ // Entry 267
0x1.e27076e2af2e5065c4f1c53c5ba22021p-4,
0x1.fffffffffffffp-4
},
{ // Entry 268
0x1.e27076e2af2e5e9ea87ffe1fe9e155dbp-4,
0x1.0p-3
},
{ // Entry 269
0x1.e27076e2af2e7b106f9c6fe70639d447p-4,
0x1.0000000000001p-3
},
{ // Entry 270
0x1.f0a30c01162a5708bd8807dfa41c78f8p-5,
0x1.fffffffffffffp-5
},
{ // Entry 271
0x1.f0a30c01162a6617cc9716eeb32f131ap-5,
0x1.0p-4
},
{ // Entry 272
0x1.f0a30c01162a8435eab5350cd13f04eep-5,
0x1.0000000000001p-4
},
{ // Entry 273
0x1.f829b0e7832ff54baec8fe6c44c511fdp-6,
0x1.fffffffffffffp-6
},
{ // Entry 274
0x1.f829b0e7833004cf8fc13c7bc8a7ebabp-6,
0x1.0p-5
},
{ // Entry 275
0x1.f829b0e7833023d751b1b89ad0625665p-6,
0x1.0000000000001p-5
},
{ // Entry 276
0x1.fc0a8b0fc03e2d38f1978c3b9c1379b6p-7,
0x1.fffffffffffffp-7
},
{ // Entry 277
0x1.fc0a8b0fc03e3cf9eda74d37abd56df5p-7,
0x1.0p-6
},
{ // Entry 278
0x1.fc0a8b0fc03e5c7be5c6cf2fcb538558p-7,
0x1.0000000000001p-6
},
{ // Entry 279
0x1.fe02a6b106787fe3370f3b19ca72746ep-8,
0x1.fffffffffffffp-8
},
{ // Entry 280
0x1.fe02a6b106788fc37690391dc282d2b3p-8,
0x1.0p-7
},
{ // Entry 281
0x1.fe02a6b10678af83f5923525b2a09b1bp-8,
0x1.0000000000001p-7
},
{ // Entry 282
0x1.ff00aa2b10bbf4b076c559c4c4c719a8p-9,
0x1.fffffffffffffp-9
},
{ // Entry 283
0x1.ff00aa2b10bc04a086b569b4d4b76919p-9,
0x1.0p-8
},
{ // Entry 284
0x1.ff00aa2b10bc2480a6958994f4968af6p-9,
0x1.0000000000001p-8
},
{ // Entry 285
0x1.ff802a9ab10e579274ea53f96c2ac73bp-10,
0x1.fffffffffffffp-10
},
{ // Entry 286
0x1.ff802a9ab10e678a78e854f8ec6ac72bp-10,
0x1.0p-9
},
{ // Entry 287
0x1.ff802a9ab10e877a80e456f7ecea07cap-10,
0x1.0000000000001p-9
},
{ // Entry 288
0x1.ffc00aa8ab10ebc44c055914cd3364b9p-11,
0x1.fffffffffffffp-11
},
{ // Entry 289
0x1.ffc00aa8ab10fbc04d051924c9347471p-11,
0x1.0p-10
},
{ // Entry 290
0x1.ffc00aa8ab111bb84f049944c1363411p-11,
0x1.0000000000001p-10
},
{ // Entry 291
0x1.fff8002aa9aaa11166638b10aec3e0a4p-14,
0x1.fffffffffffffp-14
},
{ // Entry 292
0x1.fff8002aa9aab110e6678af0afc3daa4p-14,
0x1.0p-13
},
{ // Entry 293
0x1.fff8002aa9aad10fe66f8ab0b1c3c2a5p-14,
0x1.0000000000001p-13
},
{ // Entry 294
-0x1.62e42fefa39f135793c7673008e5ed5ep-1,
-0x1.0000000000001p-1
},
{ // Entry 295
-0x1.62e42fefa39ef35793c7673007e5ed5ep-1,
-0x1.0p-1
},
{ // Entry 296
-0x1.62e42fefa39ee35793c767300825ed5ep-1,
-0x1.fffffffffffffp-2
},
{ // Entry 297
-0x1.269621134db93cd9140cbcc16037fb86p-2,
-0x1.0000000000001p-2
},
{ // Entry 298
-0x1.269621134db92783beb7676c0aa9c2a3p-2,
-0x1.0p-2
},
{ // Entry 299
-0x1.269621134db91cd9140cbcc1600d50dbp-2,
-0x1.fffffffffffffp-3
},
{ // Entry 300
-0x1.1178e8227e47d02c5d4668ebc04628aep-3,
-0x1.0000000000001p-3
},
{ // Entry 301
-0x1.1178e8227e47bde338b41fc72de81e3bp-3,
-0x1.0p-3
},
{ // Entry 302
-0x1.1178e8227e47b4bea66afb34e4c8c56ap-3,
-0x1.fffffffffffffp-4
},
{ // Entry 303
-0x1.08598b59e3a0799b50ead061448cec6cp-4,
-0x1.0000000000001p-4
},
{ // Entry 304
-0x1.08598b59e3a0688a3fd9bf503372c12fp-4,
-0x1.0p-4
},
{ // Entry 305
-0x1.08598b59e3a06001b75136c7aaec7f32p-4,
-0x1.fffffffffffffp-5
},
{ // Entry 306
-0x1.0415d89e7444578594cf9f5e0caf2971p-5,
-0x1.0000000000001p-5
},
{ // Entry 307
-0x1.0415d89e7444470173c75d4d8889de0ep-5,
-0x1.0p-5
},
{ // Entry 308
-0x1.0415d89e74443ebf63433c45467a6ab5p-5,
-0x1.fffffffffffffp-6
},
{ // Entry 309
-0x1.02056589358484e027b146bdd7feaee1p-6,
-0x1.0000000000001p-6
},
{ // Entry 310
-0x1.020565893584749f23a105b9c7bb9a6fp-6,
-0x1.0p-6
},
{ // Entry 311
-0x1.0205658935846c7ea198e537bf9b9c7fp-6,
-0x1.fffffffffffffp-7
},
{ // Entry 312
-0x1.010157588de722ad0cdb84fde21218d8p-7,
-0x1.0000000000001p-7
},
{ // Entry 313
-0x1.010157588de7128ccc5a82f9da00f48bp-7,
-0x1.0p-7
},
{ // Entry 314
-0x1.010157588de70a7cac1a01f7d5f9256ep-7,
-0x1.fffffffffffffp-8
},
{ // Entry 315
-0x1.0080559588b367f5a8f34d9dadc40b3ap-8,
-0x1.0000000000001p-8
},
{ // Entry 316
-0x1.0080559588b357e598e33d8d9db37a29p-8,
-0x1.0p-8
},
{ // Entry 317
-0x1.0080559588b34fdd90db358595ab9261p-8,
-0x1.fffffffffffffp-9
},
{ // Entry 318
-0x1.0040155d5889ee786b20efc1400f5ea4p-9,
-0x1.0000000000001p-9
},
{ // Entry 319
-0x1.0040155d5889de70671eeec0bfcefe53p-9,
-0x1.0p-9
},
{ // Entry 320
-0x1.0040155d5889d66c651dee407faefe5bp-9,
-0x1.fffffffffffffp-10
},
{ // Entry 321
-0x1.002005565588a3397dd822048abe2755p-10,
-0x1.0000000000001p-10
},
{ // Entry 322
-0x1.00200556558893357cd7e1f486bd0705p-10,
-0x1.0p-10
},
{ // Entry 323
-0x1.0020055655888b337c57c1ec84bc8ee9p-10,
-0x1.fffffffffffffp-11
},
{ // Entry 324
-0x1.0004001555d568891de2704b038ca596p-13,
-0x1.0000000000001p-13
},
{ // Entry 325
-0x1.0004001555d558889dde702b028c9996p-13,
-0x1.0p-13
},
{ // Entry 326
-0x1.0004001555d550885ddc701b020c9696p-13,
-0x1.fffffffffffffp-14
},
{ // Entry 327
0x1.73242d45267376d3a2a0a820c4902335p-1,
0x1.1082b577d34eap0
},
{ // Entry 328
0x1.73242d4526738653ad4a41d5fe7ea6c1p-1,
0x1.1082b577d34ebp0
},
{ // Entry 329
0x1.73242d45267395d3b7f3db8b37f509a8p-1,
0x1.1082b577d34ecp0
},
{ // Entry 330
0x1.73242d452673a553c29d754070f34beap-1,
0x1.1082b577d34edp0
},
{ // Entry 331
0x1.73242d452673b4d3cd470ef5a9796d86p-1,
0x1.1082b577d34eep0
},
{ // Entry 332
0x1.73242d452673c453d7f0a8aae1876e7ep-1,
0x1.1082b577d34efp0
},
{ // Entry 333
0x1.73242d452673d3d3e29a4260191d4ecfp-1,
0x1.1082b577d34f0p0
},
{ // Entry 334
-0x1.00000000000018ade0e8cb684e083468p-4,
-0x1.f0540438fd5c6p-5
},
{ // Entry 335
-0x1.0000000000001029cb3d0ccdd73ea85ap-4,
-0x1.f0540438fd5c5p-5
},
{ // Entry 336
-0x1.00000000000007a5b5914e336079a4a5p-4,
-0x1.f0540438fd5c4p-5
},
{ // Entry 337
-0x1.fffffffffffffe433fcb1f31d3725290p-5,
-0x1.f0540438fd5c3p-5
},
{ // Entry 338
-0x1.ffffffffffffed3b1473a1fce5fa6c86p-5,
-0x1.f0540438fd5c2p-5
},
{ // Entry 339
-0x1.ffffffffffffdc32e91c24c7f88b972cp-5,
-0x1.f0540438fd5c1p-5
},
{ // Entry 340
-0x1.ffffffffffffcb2abdc4a7930b25d282p-5,
-0x1.f0540438fd5c0p-5
},
{ // Entry 341
HUGE_VAL,
HUGE_VAL
},
{ // Entry 342
0x1.62e42fefa39ef35393c7673007e5dd5ep9,
0x1.fffffffffffffp1023
},
{ // Entry 343
0x1.62e42fefa39ef34f93c7673007e5ad5ep9,
0x1.ffffffffffffep1023
},
{ // Entry 344
0x1.6bcbed09f00aece2ea800b6af0f24a0bp0,
0x1.921fb54442d18p1
},
{ // Entry 345
0x1.e3703db0ab119bed3e763f434dd7c4fbp-1,
0x1.921fb54442d18p0
},
{ // Entry 346
0x1.62e42fefa39f035793c7673007a5ed5ep-1,
0x1.0000000000001p0
},
{ // Entry 347
0x1.62e42fefa39ef35793c7673007e5ed5ep-1,
0x1.0p0
},
{ // Entry 348
-HUGE_VAL,
-0x1.0p0
},
{ // Entry 349
0x1.62e42fefa39eeb5793c7673007d5ed5ep-1,
0x1.fffffffffffffp-1
},
{ // Entry 350
-0x1.25e4f7b2737fa18486612173c68a6892p5,
-0x1.fffffffffffffp-1
},
{ // Entry 351
0x1.28c6c3a79fe295c7ca64ed982642adcfp-1,
0x1.921fb54442d18p-1
},
{ // Entry 352
-0x1.89f9ff0c761bc5454f17ec539e887d37p0,
-0x1.921fb54442d18p-1
},
{ // Entry 353
0x1.0000000000000fffffffffffffffffffp-1022,
0x1.0000000000001p-1022
},
{ // Entry 354
-0x1.00000000000010p-1022,
-0x1.0000000000001p-1022
},
{ // Entry 355
0x1.ffffffffffffffffffffffffffffffffp-1023,
0x1.0p-1022
},
{ // Entry 356
-0x1.p-1022,
-0x1.0p-1022
},
{ // Entry 357
0x1.ffffffffffffdfffffffffffffffffffp-1023,
0x1.ffffffffffffep-1023
},
{ // Entry 358
-0x1.ffffffffffffe0p-1023,
-0x1.ffffffffffffep-1023
},
{ // Entry 359
0x1.ffffffffffffbfffffffffffffffffffp-1023,
0x1.ffffffffffffcp-1023
},
{ // Entry 360
-0x1.ffffffffffffc0p-1023,
-0x1.ffffffffffffcp-1023
},
{ // Entry 361
0x1.ffffffffffffffffffffffffffffffffp-1074,
0x1.0p-1073
},
{ // Entry 362
-0x1.p-1073,
-0x1.0p-1073
},
{ // Entry 363
0.0,
0x1.0p-1074
},
{ // Entry 364
-0x1.p-1074,
-0x1.0p-1074
},
{ // Entry 365
0.0,
0.0
},
{ // Entry 366
-0.0,
-0.0
}
};
|
0028fbc0859cd7e753d03d1534e7c0e0517ff516
|
7f86525d675d31795376ab3b070befb6af5f8a9f
|
/version.c
|
2c16f0e432ed333c2baac1cb8c53031a7ad98496
|
[
"LicenseRef-scancode-public-domain"
] |
permissive
|
wryun/es-shell
|
8f61d87338e3ea0cda34835e65b5c71cbf2e141c
|
4945413062a0a5707694f3c64184d04fbff573c8
|
refs/heads/master
| 2023-05-14T12:03:15.000531
| 2023-01-04T22:30:03
| 2023-01-04T22:30:03
| 5,487,041
| 293
| 32
|
NOASSERTION
| 2023-04-30T16:22:31
| 2012-08-20T21:31:00
|
C
|
UTF-8
|
C
| false
| false
| 131
|
c
|
version.c
|
#include "es.h"
static const char id[] = "@(#)es version 0.9.2 2-Mar-2022";
const char * const version = id + (sizeof "@(#)" - 1);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.