Add wasm tacle-bench targets

This commit is contained in:
2026-06-12 20:06:22 +02:00
parent 30daa8a00c
commit 08c2e9c13d
1122 changed files with 520422 additions and 0 deletions

View File

@ -0,0 +1,49 @@
/*
downlink.h
Copyright (C) 2003 Antoine Drouin
This file is part of paparazzi.
paparazzi 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.
paparazzi 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 paparazzi; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
decodes downlink protocol
*/
#ifndef DOWNLINK_H
#define DOWNLINK_H
#include <glib.h>
#include "protocol.h"
#include "transport.h"
#include "geometry.h"
#define DL_STX 0x05
#define DL_ETX 0x06
#define DL_HEAD_LEN 1
#define DL_PAYLOAD_OFFSET 1
#define DL_TAIL_LEN 2
struct Transport *downlink_new( struct PprzProtocol *protocol,
void( *err_callback )( gpointer callback_data, GError *error ),
void( *msg_callback )( gpointer callback_data, struct TransportMsg *msg ),
gpointer callback_data );
#endif

View File

@ -0,0 +1,185 @@
/*
geometry.h
Copyright (C) 2003 Antoine Drouin
This file is part of paparazzi.
paparazzi 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.
paparazzi 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 paparazzi; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
geometry :) originated from Pascal Brisset pascal(dot)brisset(at)free(dot)fr
ocaml code.
*/
#ifndef GEOMETRY_H
#define GEOMETRY_H
#include <math.h>
#include "angles.h"
/*
please use
x, y, z, h in meters
lat, lon in radians
*/
struct double_c2d {
double x, y;
};
struct double_p2d {
double r, teta;
};
struct double_e2d {
double lat, lon;
};
struct double_c3d {
double x, y, z;
};
struct double_e3d {
double lat, lon, h;
};
struct double_c2d vector_c2d( const struct double_c2d a,
const struct double_c2d b );
struct double_c2d unit_vector_c2d( const struct double_c2d a,
const struct double_c2d b );
struct double_c2d normal_vector_c2d( const struct double_c2d u );
double vect_prod_c2d( const struct double_c2d a, const struct double_c2d b );
double scal_prod_c2d( const struct double_c2d a, const struct double_c2d b );
double module_c2d( const struct double_c2d a );
double norme2_c2d( const struct double_c2d a );
double distance_c2d( const struct double_c2d a, const struct double_c2d b );
void rotate_c2d( struct double_c2d *a, double alpha );
void translate_c2d( struct double_c2d *a, const struct double_c2d v );
void add_c2d_s( struct double_c2d *a, const struct double_c2d b );
struct double_c2d add_c2d( struct double_c2d a, struct double_c2d b );
void minus_c2d_s( struct double_c2d *a, const struct double_c2d v );
struct double_c2d minus_c2d( struct double_c2d a, const struct double_c2d v );
void normalise_c2d_s( struct double_c2d *a );
struct double_c2d normalise_c2d( struct double_c2d a );
void scale_c2d_s( struct double_c2d *v, double factor );
struct double_c2d scale_c2d( struct double_c2d v, double factor );
double angle_c2d( struct double_c2d u, struct double_c2d v );
struct double_p2d p2d_of_c2d( const struct double_c2d c );
struct double_c2d c2d_of_p2d( const struct double_p2d p );
struct double_c2d c2d_of_polar( double r, double teta );
struct double_p2d add_p2d( const struct double_p2d p1,
const struct double_p2d p2 );
struct double_p2d minus_p2d( const struct double_p2d p1,
const struct double_p2d p2 );
void translate_c3d( struct double_c3d *a, const struct double_c3d v );
void scale_c3d( struct double_c3d *v, double factor );
struct double_c2d lin_interp_c2d( struct double_c2d a, double ta,
struct double_c2d b, double tb, double t );
/* rad is an angle in EAST NORTH frame,
returns the wind direction in degrees
*/
double wind_dir_from_angle_rad( double rad );
/* converts between angle in EAST NORTH frame
and headings (0->N 90->E) */
double heading_of_to_angle_deg( double angle );
double heading_of_to_angle_rad( double angle );
/*
compute bank angle
*/
double compute_phi( struct double_c2d curspeed, struct double_c2d last_speed,
double delta_t );
#define SEC_OF_TIMEVAL(tv) (tv.tv_sec + 1e-6 * tv.tv_usec)
#define DELAY_SEC_OF_TIMEVAL(tv1, tv2) (SEC_OF_TIMEVAL(tv1) - SEC_OF_TIMEVAL(tv2))
double mpi_pi( double val );
struct ellipsoid {
double dx, dy, dz;
double a;
double df;
double e;
};
enum type_ellipsoid {
NTF,
WGS84,
ED50,
NAD27,
ELLIPSOID_NB
};
extern const struct ellipsoid ellipsoids[ ELLIPSOID_NB ];
struct lambert {
const struct ellipsoid *ellipsoid;
double phi0; /* radians */
double lphi0;
double r0;
double lambda0;
long x0;
long y0;
long ys;
long k0; /* scale factor */
};
enum type_lambert {
LAMBERTI,
LAMBERTII,
LAMBERTIIE,
LAMBERTIII,
LAMBERTIV,
LAMBERT_NB
};
extern const struct lambert lamberts[ LAMBERT_NB ];
#define DECIMAL(D,M,S) (D + M / 60. + S / 3600.)
#define RAD_OF_DEG(D) (D*M_PI/180.)
#define DEG_OF_RAD(R) (R/M_PI*180.)
#define LATITUDE_ISOMETRIQUE(PHI,E) (log(tan(M_PI_4 + PHI/2.0)) - E/2.0 * log((1.0+E*sin(PHI)) / (1.0-E*sin(PHI))))
#define E_SQUARE(D) (2.0*D - D * D)
#define E_PRIME_SQUARE(D) (1.0 / (1.0 - D) / (1.0 - D) - 1.0)
/* projections */
void lambert_of_e2d ( const enum type_lambert lmb,
const enum type_ellipsoid elps,
struct double_e2d world_pos, struct double_c2d *lmb_pos );
void e2d_of_lambert ( const enum type_lambert lmb,
const enum type_ellipsoid elps,
struct double_c2d c_pos, struct double_e2d *e_pos );
/* coordinates */
void e3d_of_c3d( const enum type_ellipsoid elps, struct double_c3d c_pos,
struct double_e3d *e_pos );
void e2d_of_e2d( const enum type_ellipsoid dest, const enum type_ellipsoid src,
struct double_e2d *e2d_pos );
#endif /* GEOMETRY_H */

View File

@ -0,0 +1,66 @@
/*
glade_support.h
Copyright (C) 2003 Antoine Drouin
This file is part of paparazzi.
paparazzi 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.
paparazzi 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 paparazzi; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
glade hack.
*/
#ifndef GLADE_SUPPORT_H
#define GLADE_SUPPORT_H
#define DEFAULT_LEN 256
#define UPDATE_LABEL(object, label_name, fmt, args...) \
{ \
GtkLabel* label = GTK_LABEL(gtk_object_get_data(GTK_OBJECT(object), label_name)); \
GString* str = g_string_sized_new(DEFAULT_LEN); \
if (label) { \
g_string_printf(str, fmt, ##args); \
gtk_label_set_text(label, str->str); \
} \
else \
g_message("##### unknown label [ %s ]", label_name); \
g_string_free(str, TRUE); \
} \
#define UPDATE_LABEL_COLOR(object, label_name, test, fmt, args...) \
{ \
GtkStateType state; \
GtkLabel* label = GTK_LABEL(gtk_object_get_data(GTK_OBJECT(object), label_name)); \
GString* str = g_string_sized_new(DEFAULT_LEN); \
if (label) { \
g_string_printf(str, fmt, ##args); \
gtk_label_set_text(label, str->str); \
} \
else \
g_message("##### unknown label [ %s ]", label_name); \
g_string_free(str, TRUE); \
for (state = GTK_STATE_NORMAL; state <= GTK_STATE_INSENSITIVE; state++) \
gtk_widget_modify_fg(GTK_WIDGET(label), state, (test)?&my_red_color:&gtk_widget_get_default_style()->fg[ state ]); \
} \
#endif /* GLADE_SUPPORT_H */

View File

@ -0,0 +1,51 @@
/*
logger.h
Copyright (C) 2003 Antoine Drouin
This file is part of paparazzi.
paparazzi 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.
paparazzi 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 paparazzi; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
write and read logs for the paparazzi
*/
#ifndef LOGGER_H
#define LOGGER_H
#include <glib.h>
#include <libxml/parser.h>
#include "downlink.h"
#include "protocol.h"
struct Logger {
GIOChannel *channel;
};
struct Logger *logger_new( const gchar *out_file, xmlDocPtr doc );
void logger_log( struct Logger *this, struct PprzMsg *msg );
void logger_free( struct Logger *this );
GList *logger_parse_log( const gchar *filename,
struct PprzProtocol **protocol );
#endif

View File

@ -0,0 +1,70 @@
/*
$id:$
Copyright (C) 2003 Antoine Drouin
This file is part of paparazzi.
paparazzi 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.
paparazzi 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 paparazzi; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
/*
network functions
*/
#ifndef NETWORK_H
#define NETWORK_H
#include <glib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include "protocol.h"
struct NetworkClient {
int socket;
struct sockaddr_in bcast_addr;
struct sockaddr_in server_addr;
GFunc rcv_callback;
GFunc err_callback;
gpointer user_data;
struct PprzProtocol *protocol;
};
struct NetworkServer {
int bcast_socket;
struct sockaddr_in bcast_addr;
int listening_socket;
GFunc rcv_callback;
GFunc err_callback;
gpointer user_data;
struct PprzProtocol *protocol;
};
struct NetworkServer *network_server_new( struct PprzProtocol *protocol,
const char *bcast_addr, const int bcast_port,
GFunc rcv_callback, GFunc err_callback, gpointer user_data );
void network_server_dispatch( struct NetworkServer *this, struct PprzMsg *msg );
struct NetworkClient *network_client_new( struct PprzProtocol *protocol,
const char *bcast_addr, const int bcast_port,
GFunc rcv_callback, GFunc err_callback, gpointer user_data );
void network_client_send_to_server( struct NetworkClient *this,
struct PprzMsg *msg );
#endif /* NETWORK_H */

View File

@ -0,0 +1,120 @@
/*
$Id: protocol.h,v 1.1 2011-01-18 12:48:44 moellmer Exp $
Copyright (C) 2003 Pascal Brisset, Antoine Drouin
This file is part of paparazzi.
paparazzi 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.
paparazzi 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 paparazzi; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef PROTOCOL_H
#define PROTOCOL_H
#include <glib.h>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
enum PprzFieldType {
TYP_UINT_8,
TYP_UINT_16,
TYP_UINT_32,
TYP_INT_8,
TYP_INT_16,
TYP_INT_32,
TYP_FLOAT,
TYP_ARRAY_UINT_8,
TYP_NB
};
struct PprzFieldClass {
gchar *name;
enum PprzFieldType type;
guint offset;
gchar *format;
gchar *unit;
gchar *description;
};
struct PprzMsgClass {
guint id;
gchar *name;
GList *fields_classes;
GHashTable *fields_classes_by_name;
struct PprzFieldClass **fields_classes_by_id;
guint nb_fields_classes;
guint size; /* size in byte off all fields + 1 for id */
};
struct PprzMsg {
GTimeVal date;
struct PprzMsgClass *class;
guchar *bytes;
};
struct PprzProtocol {
GList *msgs_classes;
GHashTable *msgs_classes_by_name;
struct PprzMsgClass **msgs_classes_by_id;
guint nb_msgs_classes;
};
struct PprzProtocol *pprz_protocol_new_from_xml( xmlDocPtr doc,
xmlNodePtr cur );
void pprz_protocol_free( struct PprzProtocol *this );
struct PprzMsg *pprz_msg_new( struct PprzMsgClass *msg_class, GTimeVal date );
struct PprzMsg *pprz_protocol_msg_new_by_id( struct PprzProtocol *this,
guchar id, GTimeVal date );
struct PprzMsg *pprz_protocol_msg_new_by_name( struct PprzProtocol *this,
const gchar *name, GTimeVal date );
struct PprzMsg *pprz_protocol_msg_new_of_bin( struct PprzProtocol *this,
const guchar *buf, GTimeVal date );
struct PprzMsg *pprz_protocol_msg_new_of_ascii( struct PprzProtocol *this,
const gchar *line );
void pprz_msg_free( struct PprzMsg *msg );
void pprz_protocol_ascii_of_msg( struct PprzMsg *msg, GString **buf );
const gchar *pprz_protocol_str_of_field_type( enum PprzFieldType type );
const guint pprz_protocol_size_of_field_type( enum PprzFieldType type );
const struct PprzMsgClass *protocol_msg_class_of_id( struct PprzProtocol *this,
guint id );
void pprz_msg_ascii_of_field( struct PprzMsg *msg,
struct PprzFieldClass *field_class, GString *buf );
gpointer pprz_msg_get_field( struct PprzMsg *msg,
struct PprzFieldClass *field_class );
gpointer pprz_msg_get_field_by_name( struct PprzMsg *msg, const gchar *name );
gpointer pprz_msg_get_field_by_place( struct PprzMsg *msg, guint place );
gboolean pprz_msg_set_field( struct PprzMsg *msg,
struct PprzFieldClass *field_class, gconstpointer value );
gboolean pprz_msg_set_field_by_name( struct PprzMsg *msg, const gchar *name,
gconstpointer value );
gboolean pprz_msg_set_field_by_id( struct PprzMsg *msg, guint id,
gconstpointer value );
gboolean pprz_msg_set_field_ascii( struct PprzMsg *msg,
struct PprzFieldClass *field_class, const gchar *str_val );
gboolean pprz_msg_set_field_ascii_by_name( struct PprzMsg *msg,
const gchar *name, const gchar *str_val );
gboolean pprz_msg_set_field_ascii_by_id( struct PprzMsg *msg, guint id,
const gchar *str_val );
#endif /* PROTOCOL_H */

View File

@ -0,0 +1,60 @@
/*
traces.h
Copyright (C) 2003 Antoine Drouin
This file is part of paparazzi.
paparazzi 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.
paparazzi 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 paparazzi; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef TRACES_H
#define TRACES_H
#define TRACE_ON
#define TIME_STAMP_TRACE
#ifdef TRACE_ON
#include <stdio.h>
#define TRACE_ERROR 0x00000001L
#define TRACE_DATA_READ 0x00000002L
#define TRACE_MSG_RAW 0x00000004L
#define TRACE_MSG 0x00000008L
#define TRACE_CHECKSUM 0x00000010L
#define TRACE_DOWNLINK 0x00000020L
#define TRACE_MODEM 0x00000040L
#define TRACE_MODEM_VERB 0x00000080L
#define TRACE_MODEM_READ 0x00000100L
#define TRACE_PARSER 0x00000200L
#define TRACE_TRANSPORT 0x00000400L
#define TRACE_TRANSPORT_VERB 0x00000800L
extern unsigned long TraceLevel;
#define TRACE(type,fmt,args...) \
{ \
if (TraceLevel&type) { \
fprintf(stderr, "[ "#type" ] " fmt, ##args); \
} \
}
const char *print_hex( const unsigned char *buf, unsigned int len );
#else
#define TRACE(type,fmt,args...)
#endif /* TRACE_ON */
#endif /* TRACES_H */

View File

@ -0,0 +1,75 @@
#ifndef TRANSPORT_H
#define TRANSPORT_H
#include <glib.h>
#include <string.h>
#define TRANSPORT_BUF_LEN 1024
#define TRANSPORT_HEAD_LEN 1
#define TRANSPORT_PAYLOAD_OFFSET TRANSPORT_HEAD_LEN
#define TRANSPORT_TAIL_LEN 2
enum TransportError {
TRANSPORT_NO_ERROR,
TRANSPORT_CHECKSUM_ERROR,
TRANSPORT_NO_ETX,
TRANSPORT_INVALID_MSG_ID,
TRANSPORT_INVALID_MSG_LEN,
TRANSPORT_BUF_OVFW,
TRANSPORT_ERROR_NB
};
struct TransportMsg {
GTimeVal date;
guint len;
guchar *data;
};
struct TransportStatus {
guint32 run_time;
guint32 nb_byte;
guint32 nb_msg;
guint32 nb_err;
gfloat byte_rate;
gfloat msg_rate;
};
struct Transport {
void( *err_callback )( gpointer callback_data, GError *error );
void( *msg_callback )( gpointer callback_data, struct TransportMsg *msg );
gpointer callback_data;
GQuark quark;
gchar stx;
gchar etx;
gboolean fixed_size;
gboolean two_bytes_checksum;
guint nb_msg_type;
guint *size_msg;
guint max_msg_size;
struct TransportStatus status;
gulong nb_msg_last_status;
gulong nb_byte_last_status;
guchar buf[ TRANSPORT_BUF_LEN ];
guint buf_len;
GTimeVal start_date, last_status_date;
};
struct Transport *transport_new( gboolean fixed_size,
gboolean two_bytes_checksum, guint nb_msg, guint *size_msg, guint max_msg_size,
guchar stx, guchar etx,
void( *err_callback )( gpointer callback_data, GError *error ),
void( *msg_callback )( gpointer callback_data, struct TransportMsg *msg ),
gpointer callback_data );
struct TransportStatus *transport_get_status( struct Transport *this );
void transport_feed_data( struct Transport *this, const guchar *buf,
guint len );
void transport_free( struct Transport *this );
#endif /* TRANSPORT_H */

View File

@ -0,0 +1,12 @@
#ifndef INTTYPES_H_
#define INTTYPES_H_
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed long int32_t;
typedef unsigned long uint32_t;
#endif // INTTYPES_H_

View File

@ -0,0 +1,21 @@
#ifndef MATH_H_
#define MATH_H_
#define M_PI 3.141592653589793238462643
#define HALFPI 1.57079632679489661923
#define sin(x) (pp_sin(x))
#define atan2(x,y) (pp_atan2(x,y))
#define sqrt(x) (pp_sqrt(x))
#define cos(x) (pp_sin(x+HALFPI)) /*cosinus [ radians ]*/
#define fabs(x) (pp_fabs(x))
#define pp_fabs(x) ((x)< 0. ? -(x) : (x)) /*floating absolute value*/
#define Max(x,y) (pp_Max(x,y))
#define pp_Max(x,y) ((x) >= (y) ? (x) : (y))
#define Min(x,y) (pp_Min(x,y))
#define pp_Min(x,y) ((x) <= (y) ? (x) : (y))
extern double pp_sin( double x );
extern double pp_sqrt( double x );
extern double pp_atan2( double x, double y );
#endif /*MATH_H_*/

View File

@ -0,0 +1,22 @@
#ifndef STD_H
#define STD_H
#include <inttypes.h>
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE (!FALSE)
#endif
typedef uint8_t bool_t; // Boolean values
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
#endif /* STD_H */