Skip to content

Commit

Permalink
WIP libticalcs: start building the Nspire CX II / NWB protocol suppor…
Browse files Browse the repository at this point in the history
…t code, from RE work by myself and Fabian "Vogtinator" Vogt.

Also, simplify the code in nsp_cmd.cc to use fewer memory allocations.

TODO commit message.

Signed-off-by: Lionel Debroux <[email protected]>
  • Loading branch information
debrouxl committed Mar 20, 2020
1 parent 956c8dc commit 53df032
Show file tree
Hide file tree
Showing 29 changed files with 2,759 additions and 559 deletions.
13 changes: 9 additions & 4 deletions .travis/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,29 @@ export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:${prefixpath}/lib/pkgconfig

if [ "$PREBUILDER" == "autotools" ]; then
cd libticonv/trunk
mkdir m4; autoreconf -ivf
mkdir m4; autoreconf -ivf &
cd ../../libtifiles/trunk
mkdir m4; autoreconf -ivf &
cd ../../libticables/trunk
mkdir m4; autoreconf -ivf &
cd ../../libticalcs/trunk
mkdir m4; autoreconf -ivf &
wait
cd ../../libticonv/trunk
./configure --prefix=${prefixpath}
make -j${NPROC} check
make -j${NPROC} install
cd ../../libtifiles/trunk
mkdir m4; autoreconf -ivf
cd po; make libtifiles2.pot-update; make update-po; cd ..
./configure --prefix=${prefixpath}
make -j${NPROC} check
make -j${NPROC} install
cd ../../libticables/trunk
mkdir m4; autoreconf -ivf
cd po; make libticables2.pot-update; make update-po; cd ..
./configure --prefix=${prefixpath} --enable-logging --enable-libusb10
make -j${NPROC} check
make -j${NPROC} install
cd ../../libticalcs/trunk
mkdir m4; autoreconf -ivf
cd po; make libticalcs2.pot-update; make update-po; cd ..
./configure --prefix=${prefixpath}
make -j${NPROC} check
Expand Down
6 changes: 6 additions & 0 deletions libticalcs/trunk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ set(SRC_FILES
src/keys86.cc
src/keys89.cc
src/keys92p.cc
src/nnse_cmd.cc
src/nnse_rpkt.cc
src/nnse_vpkt.cc
src/nsp_cmd.cc
src/nsp_rpkt.cc
src/nsp_vpkt.cc
Expand All @@ -56,6 +59,9 @@ set(PUBLIC_HEADERS
src/dusb_rpkt.h
src/dusb_vpkt.h
src/dusb_cmd.h
src/nnse_rpkt.h
src/nnse_vpkt.h
src/nnse_cmd.h
src/nsp_rpkt.h
src/nsp_vpkt.h
src/nsp_cmd.h
Expand Down
5 changes: 3 additions & 2 deletions libticalcs/trunk/src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ libticalcsinclude_HEADERS = \
ticalcs.h export3.h \
keys73.h keys83.h keys83p.h keys86.h keys89.h keys92p.h \
dbus_pkt.h dusb_rpkt.h dusb_vpkt.h dusb_cmd.h nsp_rpkt.h nsp_vpkt.h nsp_cmd.h \
cmdz80.h cmd68k.h calclabequipmentdata.h
nnse_rpkt.h nnse_vpkt.h nnse_cmd.h cmdz80.h cmd68k.h calclabequipmentdata.h

# build instructions
libticalcs2_la_CPPFLAGS = -I$(top_srcdir)/intl \
Expand All @@ -28,13 +28,14 @@ libticalcs2_la_SOURCES = *.h \
calc_nsp.cc \
calclabequipmentdata.cc \
clock.cc \
cmdz80.cc cmd68k.cc dusb_cmd.cc nsp_cmd.cc \
cmdz80.cc cmd68k.cc dusb_cmd.cc nsp_cmd.cc nnse_cmd.cc \
dirlist.cc \
error.cc \
keys73.cc keys83.cc keys83p.cc keys86.cc keys89.cc keys92p.cc \
dbus_pkt.cc \
dusb_rpkt.cc dusb_vpkt.cc \
nsp_rpkt.cc nsp_vpkt.cc \
nnse_rpkt.cc nnse_vpkt.cc \
probe.cc \
romdump.cc \
screen.cc \
Expand Down
6 changes: 3 additions & 3 deletions libticalcs/trunk/src/dbus_pkt.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Hey EMACS -*- linux-c -*- */
/* $Id$ */

/* libticalcs - Ti Calculator library, a part of the TiLP project
* Copyright (C) 1999-2005 Romain Liévin
/* libticalcs - TI Calculator library, a part of the TILP project
* Copyright (C) 1999-2009 Romain Liévin
* Copyright (C) 2009-2019 Lionel Debroux
*
* 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
Expand Down
6 changes: 3 additions & 3 deletions libticalcs/trunk/src/dbus_pkt.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Hey EMACS -*- linux-c -*- */
/* $Id: packets.h 1179 2005-06-06 14:42:32Z roms $ */

/* libticalcs - Ti Calculator library, a part of the TiLP project
* Copyright (C) 1999-2005 Romain Liévin
/* libticalcs - TI Calculator library, a part of the TILP project
* Copyright (C) 1999-2009 Romain Liévin
* Copyright (C) 2009-2019 Lionel Debroux
*
* 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
Expand Down
6 changes: 3 additions & 3 deletions libticalcs/trunk/src/dusb_cmd.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Hey EMACS -*- linux-c -*- */
/* $Id: cmd84p.c 2077 2006-03-31 21:16:19Z roms $ */

/* libticalcs - Ti Calculator library, a part of the TiLP project
* Copyright (C) 1999-2005 Romain Liévin
/* libticalcs - TI Calculator library, a part of the TILP project
* Copyright (C) 2004-2009 Romain Liévin
* Copyright (C) 2009-2019 Lionel Debroux
*
* 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
Expand Down
6 changes: 3 additions & 3 deletions libticalcs/trunk/src/dusb_cmd.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Hey EMACS -*- linux-c -*- */
/* $Id: cmd84p.h 2074 2006-03-31 08:36:06Z roms $ */

/* libticalcs - Ti Calculator library, a part of the TiLP project
* Copyright (C) 1999-2005 Romain Liévin
/* libticalcs - TI Calculator library, a part of the TILP project
* Copyright (C) 2004-2009 Romain Liévin
* Copyright (C) 2009-2019 Lionel Debroux
*
* 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
Expand Down
6 changes: 3 additions & 3 deletions libticalcs/trunk/src/dusb_rpkt.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Hey EMACS -*- linux-c -*- */
/* $Id: packets.c 1404 2005-07-20 20:39:39Z roms $ */

/* libticalcs - Ti Calculator library, a part of the TiLP project
* Copyright (C) 1999-2005 Romain Liévin
/* libticalcs - TI Calculator library, a part of the TILP project
* Copyright (C) 2004-2009 Romain Liévin
* Copyright (C) 2009-2019 Lionel Debroux
*
* 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
Expand Down
6 changes: 3 additions & 3 deletions libticalcs/trunk/src/dusb_rpkt.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Hey EMACS -*- linux-c -*- */
/* $Id: packets.h 1179 2005-06-06 14:42:32Z roms $ */

/* libticalcs - Ti Calculator library, a part of the TiLP project
* Copyright (C) 1999-2005 Romain Liévin
/* libticalcs - TI Calculator library, a part of the TILP project
* Copyright (C) 2004-2009 Romain Liévin
* Copyright (C) 2009-2019 Lionel Debroux
*
* 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
Expand Down
8 changes: 4 additions & 4 deletions libticalcs/trunk/src/dusb_vpkt.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Hey EMACS -*- linux-c -*- */
/* $Id: cmd84p.c 2077 2006-03-31 21:16:19Z roms $ */

/* libticalcs - Ti Calculator library, a part of the TiLP project
* Copyright (C) 1999-2005 Romain Liévin
/* libticalcs - TI Calculator library, a part of the TILP project
* Copyright (C) 2004-2009 Romain Liévin
* Copyright (C) 2009-2019 Lionel Debroux
*
* 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
Expand Down Expand Up @@ -98,7 +98,7 @@ TIEXPORT3 DUSBVirtualPacket* TICALL dusb_vtl_pkt_new_ex(CalcHandle * handle, uin

if (ticalcs_validate_handle(handle))
{
vtl = (DUSBVirtualPacket *)g_malloc0(sizeof(DUSBVirtualPacket));
vtl = (DUSBVirtualPacket *)g_malloc0(sizeof(*vtl));

if (NULL != vtl)
{
Expand Down
6 changes: 3 additions & 3 deletions libticalcs/trunk/src/dusb_vpkt.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* Hey EMACS -*- linux-c -*- */
/* $Id: cmd84p.h 2074 2006-03-31 08:36:06Z roms $ */

/* libticalcs - Ti Calculator library, a part of the TiLP project
* Copyright (C) 1999-2005 Romain Liévin
/* libticalcs - TI Calculator library, a part of the TILP project
* Copyright (C) 2004-2009 Romain Liévin
* Copyright (C) 2009-2019 Lionel Debroux
*
* 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
Expand Down
31 changes: 27 additions & 4 deletions libticalcs/trunk/src/internal.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* libticalcs - Ti Calculator library, a part of the TiLP project
* Copyright (C) 1999-2012 Romain Liévin
* Copyright (C) 2012 Lionel Debroux
/* libticalcs - TI Calculator library, a part of the TILP project
* Copyright (C) 1999-2009 Romain Liévin
* Copyright (C) 2009-2019 Lionel Debroux
*
* 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
Expand Down Expand Up @@ -309,7 +309,7 @@ static inline void ticalcs_event_fill_dusb_vpkt(CalcEventData * event, uint32_t
event->data.dusb_vpkt.data = data;
}

static inline void ticalcs_event_fill_nsp_rpkt(CalcEventData * event, uint16_t src_addr, uint16_t src_port, uint16_t dst_addr, uint16_t dst_port, uint16_t data_sum, uint8_t data_size, uint8_t ack, uint8_t seq, uint8_t hdr_sum, uint8_t * data)
static inline void ticalcs_event_fill_nsp_rpkt(CalcEventData * event, uint16_t src_addr, uint16_t src_port, uint16_t dst_addr, uint16_t dst_port, uint16_t data_sum, uint32_t data_size, uint8_t ack, uint8_t seq, uint8_t hdr_sum, uint8_t * data)
{
event->data.nsp_rpkt.src_addr = src_addr;
event->data.nsp_rpkt.src_port = src_port;
Expand All @@ -323,6 +323,20 @@ static inline void ticalcs_event_fill_nsp_rpkt(CalcEventData * event, uint16_t s
event->data.nsp_rpkt.data = data;
}

static inline void ticalcs_event_fill_nnse_rpkt(CalcEventData * event, uint8_t unused1, uint8_t service, uint8_t src_addr, uint8_t dst_addr, uint8_t unknown2, uint8_t req_ack, uint16_t size, uint16_t seq, uint16_t csum, uint8_t * data)
{
event->data.nnse_rpkt.unused1 = unused1;
event->data.nnse_rpkt.service = service;
event->data.nnse_rpkt.src_addr = src_addr;
event->data.nnse_rpkt.dst_addr = dst_addr;
event->data.nnse_rpkt.unknown2 = unknown2;
event->data.nnse_rpkt.req_ack = req_ack;
event->data.nnse_rpkt.size = size;
event->data.nnse_rpkt.seq = seq;
event->data.nnse_rpkt.csum = csum;
event->data.nnse_rpkt.data = data;
}

static inline void ticalcs_event_fill_nsp_vpkt(CalcEventData * event, uint16_t src_addr, uint16_t src_port, uint16_t dst_addr, uint16_t dst_port, uint8_t cmd, uint32_t size, uint8_t * data)
{
event->data.nsp_vpkt.src_addr = src_addr;
Expand All @@ -334,6 +348,15 @@ static inline void ticalcs_event_fill_nsp_vpkt(CalcEventData * event, uint16_t s
event->data.nsp_vpkt.data = data;
}

static inline void ticalcs_event_fill_nnse_vpkt(CalcEventData * event, uint8_t service, uint8_t src_addr, uint8_t dst_addr, uint32_t size, uint8_t * data)
{
event->data.nnse_vpkt.service = service;
event->data.nnse_vpkt.src_addr = src_addr;
event->data.nnse_vpkt.dst_addr = dst_addr;
event->data.nnse_vpkt.size = size;
event->data.nnse_vpkt.data = data;
}

static inline void ticalcs_event_fill_romdump_pkt(CalcEventData * event, uint16_t length, uint16_t cmd, uint8_t * data)
{
event->data.romdump_pkt.length = length;
Expand Down
Loading

0 comments on commit 53df032

Please sign in to comment.