Add ld10k1 tool

Added ld10k1 tool by Peter Zubaj.
This commit is contained in:
Takashi Iwai 2005-03-18 13:40:44 +00:00
parent 37104ebf62
commit 2df1aa7c20
98 changed files with 19970 additions and 1 deletions

View file

@ -0,0 +1,33 @@
lo10k1includedir = $(includedir)/lo10k1
lo10k1include_HEADERS = version.h comm.h liblo10k1.h liblo10k1ef.h ld10k1_error.h ld10k1_fnc.h liblo10k1lf.h lo10k1.h
INCLUDES = -I$(top_srcdir)/include
#taken from alsa-lib - start
CLEANFILES = stamp-vh version.h lo10k1
version.h: stamp-vh
@:
stamp-vh: $(top_builddir)/configure.in
@echo "/*" > ver.tmp
@echo " * version.h" >> ver.tmp
@echo " */" >> ver.tmp
@echo "" >> ver.tmp
@echo "#define LD10K1_LIB_MAJOR $(LD10K1_LIB_MAJOR) /**< major number of library version */" >> ver.tmp
@echo "#define LD10K1_LIB_MINOR $(LD10K1_LIB_MINOR) /**< minor number of library version */" >> ver.tmp
@echo "#define LD10K1_LIB_SUBMINOR $(LD10K1_LIB_SUBMINOR) /**< subminor number of library version */" >> ver.tmp
@echo "/** library version */" >> ver.tmp
@echo "#define LD10K1_LIB_VERSION ((LD10K1_LIB_MAJOR<<16)|\\" >> ver.tmp
@echo " (LD10K1_LIB_MINOR<<8)|\\" >> ver.tmp
@echo " LD10K1_LIB_SUBMINOR)" >> ver.tmp
@echo "/** library version (string) */" >> ver.tmp
@echo "#define LD10K1_LIB_VERSION_STR \"$(LD10K1_LIB_VERSION)\"" >> ver.tmp
@echo >> ver.tmp
@cmp -s version.h ver.tmp \
|| (echo "Updating version.h"; \
cp ver.tmp version.h; \
echo timestamp > stamp-vh)
-@rm -f ver.tmp
#taken from alsa-lib - end

71
ld10k1/include/comm.h Normal file
View file

@ -0,0 +1,71 @@
/*
* EMU10k1 loader lib
* Copyright (c) 2003,2004 by Peter Zubaj
*
*
* This library 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __COMM_H
#define __COMM_H
#ifdef __cplusplus
extern "C" {
#endif
struct msg_req
{
int op;
int size;
};
struct msg_resp
{
int op;
int err;
int size;
};
#define COMM_TYPE_LOCAL 0
#define COMM_TYPE_IP 1
typedef struct
{
int type;
int server;
char *name;
unsigned short port;
int wfc;
} comm_param;
int setup_comm(comm_param *param);
int connect_comm(int conn_num, comm_param *param);
int listen_comm(int conn_num);
int accept_comm(int conn_num);
int free_comm(int conn_num);
int send_request(int conn_num, int op, void *data, int data_size);
int send_response(int conn_num, int op, int err, void *data, int data_size);
int send_msg_data(int conn_num, void *data, int data_size);
int receive_request(int conn_num, int *op, int *data_size);
int receive_response(int conn_num, int *op, int *data_size);
int receive_msg_data(int conn_num, void *data, int data_size);
void *receive_msg_data_malloc(int conn_num, int data_size);
#ifdef __cplusplus
}
#endif
#endif /* __COMM_H */

View file

@ -0,0 +1,104 @@
/*
* EMU10k1 loader lib
* Copyright (c) 2003,2004 by Peter Zubaj
*
*
* This library 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __LD10K1_ERROR_H
#define __LD10K1_ERROR_H
#define LD10K1_ERR_UNKNOWN -1 /* unknown error */
#define LD10K1_ERR_COMM_READ -2 /* errorn in read from socket */
#define LD10K1_ERR_COMM_WRITE -3 /* error in write to socket */
#define LD10K1_ERR_UNKNOWN_PATCH_NUM -4 /* wrong parameter - patch with this num doesn't exists */
#define LD10K1_ERR_PROTOCOL -5 /* ld10k1 is expecting more or less data as it got */
#define LD10K1_ERR_COMM_CONN -29 /* */
#define LD10K1_ERR_PROTOCOL_IN_COUNT -6 /* */
#define LD10K1_ERR_PROTOCOL_OUT_COUNT -7 /* */
#define LD10K1_ERR_PROTOCOL_CONST_COUNT -8 /* */
#define LD10K1_ERR_PROTOCOL_STATIC_COUNT -9 /* */
#define LD10K1_ERR_PROTOCOL_DYNAMIC_COUNT -10 /* */
#define LD10K1_ERR_PROTOCOL_HW_COUNT -11 /* */
#define LD10K1_ERR_PROTOCOL_TRAM_COUNT -12 /* */
#define LD10K1_ERR_PROTOCOL_TRAM_ACC_COUNT -13 /* */
#define LD10K1_ERR_PROTOCOL_CTL_COUNT -14 /* */
#define LD10K1_ERR_PROTOCOL_INSTR_COUNT -15 /* */
/* driver */
#define LD10K1_ERR_DRIVER_CODE_POKE -16 /* unable to poke code */
#define LD10K1_ERR_DRIVER_INFO -17 /* unable to get info */
#define LD10K1_ERR_DRIVER_CODE_PEEK -18 /* unable to peek code */
#define LD10K1_ERR_DRIVER_PCM_POKE -19 /* unable to poke pcm */
/* tram */
#define LD10K1_ERR_ITRAM_FULL -20 /* not enought free itram */
#define LD10K1_ERR_ETRAM_FULL -21 /* not enought free etram */
#define LD10K1_ERR_TRAM_FULL -22 /* not enought free tram */
#define LD10K1_ERR_TRAM_FULL_GRP -23 /* not enought free tram group */
#define LD10K1_ERR_ITRAM_FULL_ACC -25 /* not enought free itram acc */
#define LD10K1_ERR_ETRAM_FULL_ACC -26 /* not enought free etram acc */
#define LD10K1_ERR_TRAM_FULL_ACC -27 /* not enought free tram acc */
#define LD10K1_ERR_MAX_CON_PER_POINT -28 /* maximum connections per point reached */
/* others */
#define LD10K1_ERR_NO_MEM -30 /* not enought free mem */
#define LD10K1_ERR_MAX_PATCH_COUNT -31 /* max patch count excesed */
#define LD10K1_ERR_NOT_FREE_REG -32 /* there is not free reg */
#define LD10K1_ERR_NOT_FREE_INSTR -34 /* there is no free instruction slot */
/* patch chceck */
#define LD10K1_ERR_WRONG_REG_HW_INDEX -36 /* */
#define LD10K1_ERR_WRONG_TRAM_POS -37 /* */
#define LD10K1_ERR_WRONG_TRAM_TYPE -39 /* */
#define LD10K1_ERR_WRONG_TRAM_SIZE -40 /* */
#define LD10K1_ERR_WRONG_TRAM_ACC_TYPE -41 /* */
#define LD10K1_ERR_TRAM_GRP_OUT_OF_RANGE -42 /* */
#define LD10K1_ERR_TRAM_ACC_OUT_OF_RANGE -43 /* */
#define LD10K1_ERR_CTL_VCOUNT_OUT_OF_RANGE -48 /* */
#define LD10K1_ERR_CTL_COUNT_OUT_OF_RANGE -49 /* */
#define LD10K1_ERR_CTL_MIN_MAX_RANGE -50 /* */
#define LD10K1_ERR_CTL_TRANLSLATION -51 /* */
#define LD10K1_ERR_CTL_REG_INDEX -52 /* */
#define LD10K1_ERR_CTL_REG_VALUE -53 /* */
#define LD10K1_ERR_INSTR_OPCODE -54 /* */
#define LD10K1_ERR_INSTR_ARG_INDEX -56 /* */
#define LD10K1_ERR_UNKNOWN_REG_NUM -57 /* */
#define LD10K1_ERR_UNKNOWN_PATCH_REG_NUM -58 /* */
#define LD10K1_ERR_CONNECTION -59 /* can't connect */
#define LD10K1_ERR_CONNECTION_FNC -60 /* wrong connection funcion requested */
#define LD10K1_ERR_CTL_EXISTS -61 /* */
#define LD10K1_ERR_PATCH_RENAME -62 /* */
#define LD10K1_ERR_PATCH_REG_RENAME -63 /* */
#define LD10K1_ERR_REG_RENAME -64 /* */
#define LD10K1_ERR_WRONG_VER -65 /* wrong ld10k1 <=> lo10k1 version */
#define LD10K1_ERR_UNKNOWN_POINT -66 /* */
#endif /* __LD10K1_ERROR_H */

386
ld10k1/include/ld10k1_fnc.h Normal file
View file

@ -0,0 +1,386 @@
/*
* EMU10k1 loader lib
* Copyright (c) 2003,2004 by Peter Zubaj
*
*
* This library 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __LD10K1_FNC_H
#define __LD10K1_FNC_H
#define MAX_NAME_LEN 256
#define MAX_CTL_GPR_COUNT 32
#define EMU10K1_GPR_TRANSLATION_LAST EMU10K1_GPR_TRANSLATION_ONOFF
#define EMU10K1_REG_TYPE_NONE 0
#define EMU10K1_REG_TYPE_FX 1
#define EMU10K1_REG_TYPE_INPUT 2
#define EMU10K1_REG_TYPE_OUTPUT 3
#define EMU10K1_REG_TYPE_HW 4
#define EMU10K1_REG_TYPE_TRAM_CTL 5 /* only on Audigy */
#define EMU10K1_REG_TYPE_TRAM_DATA 6
#define EMU10K1_REG_TYPE_TRAM_ADDR 7
#define EMU10K1_REG_TYPE_NORMAL 8
#define EMU10K1_REG_TYPE_CONST 9
#define EMU10K1_REG_TYPE_ALL 10
#define EMU10K1_REG_TYPE_NAMED 11
#define EMU10K1_REG_TYPE_MASK 0xF0000000
/* access macros */
#define EMU10K1_REG_TYPE(type) (((type) << 28) & EMU10K1_REG_TYPE_MASK)
#define EMU10K1_REG_TYPE_B(type) (((type) & EMU10K1_REG_TYPE_MASK) >> 28)
#define EMU10K1_REG_FX(fxnum) (EMU10K1_REG_TYPE(EMU10K1_REG_TYPE_FX) | ((fxnum) & 0x3F))
#define EMU10K1_REG_IN(innum) (EMU10K1_REG_TYPE(EMU10K1_REG_TYPE_INPUT) | ((innum) & 0x1F))
#define EMU10K1_REG_OUT(outnum) (EMU10K1_REG_TYPE(EMU10K1_REG_TYPE_OUTPUT) | ((outnum) & 0x3F))
#define EMU10K1_REG_HW(hwnum) (EMU10K1_REG_TYPE(EMU10K1_REG_TYPE_HW) | ((hwnum) & 0x3F))
#define EMU10K1_REG_TRAM_CTL(ctlnum) (EMU10K1_REG_TYPE(EMU10K1_REG_TYPE_TRAM_CTL) | ((ctlnum) & 0xFF))
#define EMU10K1_REG_TRAM_DATA(datanum) (EMU10K1_REG_TYPE(EMU10K1_REG_TYPE_TRAM_DATA) | ((datanum) & 0xFF))
#define EMU10K1_REG_TRAM_ADDR(addrnum) (EMU10K1_REG_TYPE(EMU10K1_REG_TYPE_TRAM_ADDR) | ((addrnum) & 0xFF))
#define EMU10K1_REG_NORMAL(num) (EMU10K1_REG_TYPE(EMU10K1_REG_TYPE_NORMAL) | ((num) & 0x1FF))
#define EMU10K1_REG_CONST(num) (EMU10K1_REG_TYPE(EMU10K1_REG_TYPE_CONST) | ((num) & 0x2ff))
#define EMU10K1_REG_ALL(num) (EMU10K1_REG_TYPE(EMU10K1_REG_TYPE_ALL) | ((num) & 0x7FF))
#define EMU10K1_REG_NAMED(num) (EMU10K1_REG_TYPE(EMU10K1_REG_TYPE_ALL) | ((num) & 0xFFFFFFF))
/* this will not be changed */
/* FX buses */
#define EMU10K1_NREG_FXBUS_PCM_LEFT EMU10K1_REG_NAMED(0x0000)
#define EMU10K1_NREG_FXBUS_PCM_RIGHT EMU10K1_REG_NAMED(0x0001)
#define EMU10K1_NREG_FXBUS_PCM_FRONT_LEFT EMU10K1_REG_NAMED(0x0002)
#define EMU10K1_NREG_FXBUS_PCM_FRONT_RIGHT EMU10K1_REG_NAMED(0x0003)
#define EMU10K1_NREG_FXBUS_PCM_REAR_LEFT EMU10K1_REG_NAMED(0x0004)
#define EMU10K1_NREG_FXBUS_PCM_REAR_RIGHT EMU10K1_REG_NAMED(0x0005)
#define EMU10K1_NREG_FXBUS_PCM_CENTER EMU10K1_REG_NAMED(0x0006)
#define EMU10K1_NREG_FXBUS_PCM_LFE EMU10K1_REG_NAMED(0x0007)
#define EMU10K1_NREG_FXBUS_MIDI_LEFT EMU10K1_REG_NAMED(0x0008)
#define EMU10K1_NREG_FXBUS_MIDI_RIGHT EMU10K1_REG_NAMED(0x0009)
#define EMU10K1_NREG_FXBUS_MIDI_REVERB EMU10K1_REG_NAMED(0x000A)
#define EMU10K1_NREG_FXBUS_MIDI_CHORUS EMU10K1_REG_NAMED(0x000B)
#define EMU10K1_A_NREG_FXBUS_PT_LEFT EMU10K1_REG_NAMED(0x000C)
#define EMU10K1_A_NREG_FXBUS_PT_RIGHT EMU10K1_REG_NAMED(0x000D)
/* inputs */
#define EMU10K1_NREG_IN_AC97_LEFT EMU10K1_REG_NAMED(0x0100)
#define EMU10K1_NREG_IN_AC97_RIGHT EMU10K1_REG_NAMED(0x0101)
#define EMU10K1_NREG_IN_SPDIF_CD_LEFT EMU10K1_REG_NAMED(0x0102)
#define EMU10K1_NREG_IN_SPDIF_CD_RIGHT EMU10K1_REG_NAMED(0x0103)
#define EMU10K1_NREG_IN_SPDIF_OPT_LEFT EMU10K1_REG_NAMED(0x0104)
#define EMU10K1_NREG_IN_SPDIF_OPT_RIGHT EMU10K1_REG_NAMED(0x0105)
#define EMU10K1_NREG_IN_I2S_1_LEFT EMU10K1_REG_NAMED(0x0106)
#define EMU10K1_NREG_IN_I2S_1_RIGHT EMU10K1_REG_NAMED(0x0107)
#define EMU10K1_NREG_IN_I2S_2_LEFT EMU10K1_REG_NAMED(0x0108)
#define EMU10K1_NREG_IN_I2S_2_RIGHT EMU10K1_REG_NAMED(0x0109)
#define EMU10K1_L_NREG_IN_SPDIF_COAX_LEFT EMU10K1_REG_NAMED(0x010A)
#define EMU10K1_L_NREG_IN_SPDIF_COAX_RIGHT EMU10K1_REG_NAMED(0x010B)
#define EMU10K1_L_NREG_IN_ZOOM_LEFT EMU10K1_REG_NAMED(0x010C)
#define EMU10K1_L_NREG_IN_ZOOM_RIGHT EMU10K1_REG_NAMED(0x010D)
#define EMU10K1_L_NREG_IN_LINE_1_LEFT EMU10K1_REG_NAMED(0x010E)
#define EMU10K1_L_NREG_IN_LINE_1_RIGHT EMU10K1_REG_NAMED(0x010F)
#define EMU10K1_L_NREG_IN_LINE_2_LEFT EMU10K1_REG_NAMED(0x0110)
#define EMU10K1_L_NREG_IN_LINE_2_RIGHT EMU10K1_REG_NAMED(0x0111)
#define EMU10K1_A_NREG_IN_LINE_1_LEFT EMU10K1_REG_NAMED(0x0112)
#define EMU10K1_A_NREG_IN_LINE_1_RIGHT EMU10K1_REG_NAMED(0x0113)
#define EMU10K1_A_NREG_IN_LINE_2_LEFT EMU10K1_REG_NAMED(0x0114)
#define EMU10K1_A_NREG_IN_LINE_2_RIGHT EMU10K1_REG_NAMED(0x0115)
#define EMU10K1_A_NREG_IN_LINE_3_LEFT EMU10K1_REG_NAMED(0x0116)
#define EMU10K1_A_NREG_IN_LINE_3_RIGHT EMU10K1_REG_NAMED(0x0117)
/* outputs */
#define EMU10K1_NREG_OUT_FRONT_LEFT EMU10K1_REG_NAMED(0x0200)
#define EMU10K1_NREG_OUT_FRONT_RIGHT EMU10K1_REG_NAMED(0x0201)
#define EMU10K1_NREG_OUT_REAR_LEFT EMU10K1_REG_NAMED(0x0202)
#define EMU10K1_NREG_OUT_REAR_RIGHT EMU10K1_REG_NAMED(0x0203)
#define EMU10K1_NREG_OUT_CENTER EMU10K1_REG_NAMED(0x0204)
#define EMU10K1_NREG_OUT_LFE EMU10K1_REG_NAMED(0x0205)
#define EMU10K1_NREG_OUT_AC97_LEFT EMU10K1_REG_NAMED(0x0206)
#define EMU10K1_NREG_OUT_AC97_RIGHT EMU10K1_REG_NAMED(0x0207)
#define EMU10K1_NREG_OUT_ADC_LEFT EMU10K1_REG_NAMED(0x0208)
#define EMU10K1_NREG_OUT_ADC_RIGHT EMU10K1_REG_NAMED(0x0209)
#define EMU10K1_NREG_OUT_MIC EMU10K1_REG_NAMED(0x020A)
#define EMU10K1_NREG_OUT_HEADPHONE_LEFT EMU10K1_REG_NAMED(0x020B)
#define EMU10K1_NREG_OUT_HEADPHONE_RIGHT EMU10K1_REG_NAMED(0x020C)
#define EMU10K1_L_NREG_OUT_OPT_LEFT EMU10K1_REG_NAMED(0x020D)
#define EMU10K1_L_NREG_OUT_OPT_RIGHT EMU10K1_REG_NAMED(0x020E)
#define EMU10K1_A_NREG_OUT_D_FRONT_LEFT EMU10K1_REG_NAMED(0x020F)
#define EMU10K1_A_NREG_OUT_D_FRONT_RIGHT EMU10K1_REG_NAMED(0x0210)
#define EMU10K1_A_NREG_OUT_D_REAR_LEFT EMU10K1_REG_NAMED(0x0211)
#define EMU10K1_A_NREG_OUT_D_REAR_RIGHT EMU10K1_REG_NAMED(0x0212)
#define EMU10K1_A_NREG_OUT_D_CENTER EMU10K1_REG_NAMED(0x0213)
#define EMU10K1_A_NREG_OUT_D_LFE EMU10K1_REG_NAMED(0x0214)
/* hardware */
#define EMU10K1_NREG_CONST_00000000 EMU10K1_REG_NAMED(0x0300)
#define EMU10K1_NREG_CONST_00000001 EMU10K1_REG_NAMED(0x0301)
#define EMU10K1_NREG_CONST_00000002 EMU10K1_REG_NAMED(0x0302)
#define EMU10K1_NREG_CONST_00000003 EMU10K1_REG_NAMED(0x0303)
#define EMU10K1_NREG_CONST_00000004 EMU10K1_REG_NAMED(0x0304)
#define EMU10K1_NREG_CONST_00000008 EMU10K1_REG_NAMED(0x0305)
#define EMU10K1_NREG_CONST_00000010 EMU10K1_REG_NAMED(0x0306)
#define EMU10K1_NREG_CONST_00000020 EMU10K1_REG_NAMED(0x0307)
#define EMU10K1_NREG_CONST_00000100 EMU10K1_REG_NAMED(0x0308)
#define EMU10K1_NREG_CONST_00010000 EMU10K1_REG_NAMED(0x0309)
#define EMU10K1_L_NREG_CONST_00080000 EMU10K1_REG_NAMED(0x030A)
#define EMU10K1_A_NREG_CONST_00000800 EMU10K1_REG_NAMED(0x030B)
#define EMU10K1_NREG_CONST_10000000 EMU10K1_REG_NAMED(0x030C)
#define EMU10K1_NREG_CONST_20000000 EMU10K1_REG_NAMED(0x030D)
#define EMU10K1_NREG_CONST_40000000 EMU10K1_REG_NAMED(0x030E)
#define EMU10K1_NREG_CONST_80000000 EMU10K1_REG_NAMED(0x030F)
#define EMU10K1_NREG_CONST_7FFFFFFF EMU10K1_REG_NAMED(0x0310)
#define EMU10K1_NREG_CONST_FFFFFFFF EMU10K1_REG_NAMED(0x0311)
#define EMU10K1_NREG_CONST_FFFFFFFE EMU10K1_REG_NAMED(0x0312)
#define EMU10K1_NREG_CONST_C0000000 EMU10K1_REG_NAMED(0x0313)
#define EMU10K1_NREG_CONST_4F1BBCDC EMU10K1_REG_NAMED(0x0314)
#define EMU10K1_NREG_CONST_5A7EF9DB EMU10K1_REG_NAMED(0x0315)
#define EMU10K1_NREG_CONST_00100000 EMU10K1_REG_NAMED(0x0316)
#define EMU10K1_NREG_HW_ACCUM EMU10K1_REG_NAMED(0x0317)
#define EMU10K1_NREG_HW_CCR EMU10K1_REG_NAMED(0x0318)
#define EMU10K1_NREG_HW_NOISE1 EMU10K1_REG_NAMED(0x0319)
#define EMU10K1_NREG_HW_NOISE2 EMU10K1_REG_NAMED(0x031A)
#define EMU10K1_NREG_HW_IRQ EMU10K1_REG_NAMED(0x031B)
#define EMU10K1_NREG_HW_DBAC EMU10K1_REG_NAMED(0x031C)
#define EMU10K1_A_NREG_HW_DBACE EMU10K1_REG_NAMED(0x031D)
/* patch registers */
#define EMU10K1_PREG_TYPE_IN 1
#define EMU10K1_PREG_TYPE_OUT 2
#define EMU10K1_PREG_TYPE_CONST 3
#define EMU10K1_PREG_TYPE_STA 4
#define EMU10K1_PREG_TYPE_DYN 5
#define EMU10K1_PREG_TYPE_HW 6
#define EMU10K1_PREG_TYPE_CTL 7
#define EMU10K1_PREG_TYPE_TRAM_DATA 8
#define EMU10K1_PREG_TYPE_TRAM_ADDR 9
#define EMU10K1_PREG_TYPE_MASK 0xF0000000
/* access macros */
#define EMU10K1_PREG_TYPE(type) (((type) << 28) & EMU10K1_PREG_TYPE_MASK)
#define EMU10K1_PREG_TYPE_B(type) (((type) & EMU10K1_PREG_TYPE_MASK) >> 28)
#define EMU10K1_PREG_IN(num) (EMU10K1_REG_TYPE(EMU10K1_PREG_TYPE_IN) | ((num) & 0x1F))
#define EMU10K1_PREG_OUT(num) (EMU10K1_REG_TYPE(EMU10K1_PREG_TYPE_OUT) | ((num) & 0x1F))
#define EMU10K1_PREG_CONST(num) (EMU10K1_REG_TYPE(EMU10K1_PREG_TYPE_CONST) | ((num) & 0xFF))
#define EMU10K1_PREG_STA(num) (EMU10K1_REG_TYPE(EMU10K1_PREG_TYPE_STA) | ((num) & 0xFF))
#define EMU10K1_PREG_DYN(num) (EMU10K1_REG_TYPE(EMU10K1_PREG_TYPE_DYN) | ((num) & 0xFF))
#define EMU10K1_PREG_HW(num) (EMU10K1_REG_TYPE(EMU10K1_PREG_TYPE_HW) | ((num) & 0xFF))
#define EMU10K1_PREG_CTL(ctlnum, num) (EMU10K1_REG_TYPE(EMU10K1_PREG_TYPE_CTL) | (((ctlnum) & 0xFF) << 8) | ((num) & 0xFF))
#define EMU10K1_PREG_TRAM_DATA(num) (EMU10K1_REG_TYPE(EMU10K1_PREG_TYPE_TRAM_DATA) | ((num) & 0xFF))
#define EMU10K1_PREG_TRAM_ADDR(num) (EMU10K1_REG_TYPE(EMU10K1_PREG_TYPE_TRAM_ADDR) | ((num) & 0xFF))
typedef struct {
char name[MAX_NAME_LEN];
} ld10k1_dsp_p_in_out_t;
typedef struct {
unsigned int const_val;
} ld10k1_dsp_p_const_static_t;
typedef struct {
unsigned int hw_val;
} ld10k1_dsp_p_hw_t;
#define EMU10K1_GPR_TRANSLATION_NONE 0
#define EMU10K1_GPR_TRANSLATION_TABLE100 1
#define EMU10K1_GPR_TRANSLATION_BASS 2
#define EMU10K1_GPR_TRANSLATION_TREBLE 3
#define EMU10K1_GPR_TRANSLATION_ONOFF 4
typedef struct {
char name[44];
int index; /* -1 - auto choose index */
unsigned int vcount; /* count of GPR (1..32) */
unsigned int count; /* count of GPR (1..32) */
unsigned int value[MAX_CTL_GPR_COUNT];
unsigned int min; /* minimum range */
unsigned int max; /* maximum range */
unsigned int translation;
} ld10k1_dsp_ctl_t;
typedef struct {
unsigned int op_code;
unsigned int arg[4];
} ld10k1_dsp_instr_t;
#define TRAM_GRP_DELAY 1
#define TRAM_GRP_TABLE 2
#define TRAM_POS_NONE 0
#define TRAM_POS_AUTO 1
#define TRAM_POS_INTERNAL 2
#define TRAM_POS_EXTERNAL 3
typedef struct {
unsigned int grp_type;
unsigned int grp_size;
unsigned int grp_pos;
} ld10k1_dsp_tram_grp_t;
#define TRAM_ACC_READ 1
#define TRAM_ACC_WRITE 2
#define TRAM_ACC_ZERO 4
typedef struct {
unsigned int acc_type;
unsigned int acc_offset;
unsigned int grp;
} ld10k1_dsp_tram_acc_t;
typedef struct {
char patch_name[MAX_NAME_LEN];
int id;
unsigned int in_count;
unsigned int out_count;
unsigned int const_count;
unsigned int static_count;
unsigned int dynamic_count;
unsigned int hw_count;
unsigned int tram_count;
unsigned int tram_acc_count;
unsigned int ctl_count;
unsigned int instr_count;
} ld10k1_dsp_patch_t;
#define CON_IO_FX 'F'
#define CON_IO_IN 'I'
#define CON_IO_OUT 'O'
#define CON_IO_PIN 'A'
#define CON_IO_POUT 'B'
#define CON_IO_NORMAL '\0'
/* must be changed in ld10k1.h too */
#define POINT_MAX_CONN_PER_POINT 15
typedef struct {
int id;
int type;
int io_idx;
int simple;
int multi;
unsigned int conn_count;
int io_type[POINT_MAX_CONN_PER_POINT];
int patch[POINT_MAX_CONN_PER_POINT];
int io[POINT_MAX_CONN_PER_POINT];
} ld10k1_dsp_point_t;
typedef struct {
int where;
ld10k1_dsp_patch_t patch;
} ld10k1_fnc_patch_add_t;
typedef struct {
int where;
} ld10k1_fnc_patch_del_t;
typedef struct {
int what;
int multi;
int simple;
int from_type;
int from_patch;
int from_io;
int to_type;
int to_patch;
int to_io;
} ld10k1_fnc_connection_t;
typedef struct {
int patch_num;
int gpr;
char name[MAX_NAME_LEN];
} ld10k1_fnc_name_t;
typedef struct {
char name[MAX_NAME_LEN];
} ld10k1_fnc_get_io_t;
typedef struct {
int patch_num;
int id;
char patch_name[MAX_NAME_LEN];
} ld10k1_fnc_patches_info_t;
typedef struct {
char ld10k1_version[MAX_NAME_LEN];
} ld10k1_fnc_version_t;
#define CHIP_LIVE 0
#define CHIP_AUDIGY 1
typedef struct {
unsigned int chip_type;
} ld10k1_fnc_dsp_info_t;
#define FNC_PATCH_ADD 1
#define FNC_PATCH_DEL 2
#define FNC_CONNECTION_ADD 3
#define FNC_CONNECTION_DEL 4
#define FNC_PATCH_RENAME 5
#define FNC_PATCH_FIND 6
#define FNC_GET_FX 11
#define FNC_GET_IN 12
#define FNC_GET_OUT 13
#define FNC_GET_PIN 14
#define FNC_GET_POUT 15
#define FNC_GET_FX_COUNT 21
#define FNC_GET_IN_COUNT 22
#define FNC_GET_OUT_COUNT 23
#define FNC_GET_PIN_COUNT 24
#define FNC_GET_POUT_COUNT 25
#define FNC_FX_RENAME 30
#define FNC_IN_RENAME 31
#define FNC_OUT_RENAME 32
#define FNC_PATCH_IN_RENAME 33
#define FNC_PATCH_OUT_RENAME 34
#define FNC_GET_PATCHES_INFO 40
#define FNC_GET_PATCH 41
#define FNC_FX_FIND 50
#define FNC_IN_FIND 51
#define FNC_OUT_FIND 52
#define FNC_PATCH_IN_FIND 53
#define FNC_PATCH_OUT_FIND 54
#define FNC_DUMP 60
#define FNC_GET_POINTS_INFO 70
#define FNC_GET_POINT_INFO 71
#define FNC_GET_DSP_INFO 97
#define FNC_VERSION 98
#define FNC_DSP_INIT 99
#define FNC_OK 100
#define FNC_ERR 101
#define FNC_CONTINUE 102
#define FNC_CLOSE_CONN 103
#define FNC_DEBUG 200
#endif /* __LD10K1_FNC_H */

142
ld10k1/include/liblo10k1.h Normal file
View file

@ -0,0 +1,142 @@
/*
* EMU10k1 loader lib
* Copyright (c) 2003,2004 by Peter Zubaj
*
*
* This library 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __LIBLO10K1_H
#define __LIBLO10K1_H
#ifdef __cplusplus
extern "C" {
#endif
#define LIBLO10K1_ERR_DEBUG -10000
typedef ld10k1_dsp_p_in_out_t liblo10k1_dsp_pio_t;
typedef ld10k1_dsp_p_const_static_t liblo10k1_dsp_cs_t;
typedef ld10k1_dsp_p_hw_t liblo10k1_dsp_hw_t;
typedef ld10k1_dsp_ctl_t liblo10k1_dsp_ctl_t;
typedef ld10k1_dsp_instr_t liblo10k1_dsp_instr_t;
typedef ld10k1_dsp_tram_grp_t liblo10k1_dsp_tram_grp_t;
typedef ld10k1_dsp_tram_acc_t liblo10k1_dsp_tram_acc_t;
typedef ld10k1_fnc_get_io_t liblo10k1_get_io_t;
typedef struct {
char patch_name[MAX_NAME_LEN];
unsigned int in_count;
liblo10k1_dsp_pio_t *ins;
unsigned int out_count;
liblo10k1_dsp_pio_t *outs;
unsigned int const_count;
liblo10k1_dsp_cs_t *consts;
unsigned int sta_count;
liblo10k1_dsp_cs_t *stas;
unsigned int dyn_count;
unsigned int hw_count;
liblo10k1_dsp_hw_t *hws;
unsigned int tram_count;
liblo10k1_dsp_tram_grp_t *tram;
unsigned int tram_acc_count;
liblo10k1_dsp_tram_acc_t *tram_acc;
unsigned int ctl_count;
liblo10k1_dsp_ctl_t *ctl;
unsigned int instr_count;
liblo10k1_dsp_instr_t *instr;
} liblo10k1_dsp_patch_t;
typedef int liblo10k1_connection_t;
typedef ld10k1_fnc_patches_info_t liblo10k1_patches_info_t;
typedef ld10k1_fnc_dsp_info_t liblo10k1_dsp_info_t;
typedef ld10k1_dsp_point_t liblo10k1_point_info_t;
typedef comm_param liblo10k1_param;
void liblo10k1_connection_init(liblo10k1_connection_t *conn);
int liblo10k1_connect(liblo10k1_param *param, liblo10k1_connection_t *conn);
int liblo10k1_is_open(liblo10k1_connection_t *conn);
int liblo10k1_disconnect(liblo10k1_connection_t *conn);
liblo10k1_dsp_patch_t *liblo10k1_patch_alloc(int in_count, int out_count, int const_count, int sta_count, int dyn_count, int hw_count, int tram_count, int tram_acc_count, int ctl_count, int instr_count);
void liblo10k1_patch_free(liblo10k1_dsp_patch_t *patch);
int liblo10k1_patch_set_in_count(liblo10k1_dsp_patch_t *p, int count);
int liblo10k1_patch_set_out_count(liblo10k1_dsp_patch_t *p, int count);
int liblo10k1_patch_set_const_count(liblo10k1_dsp_patch_t *p, int count);
int liblo10k1_patch_set_sta_count(liblo10k1_dsp_patch_t *p, int count);
int liblo10k1_patch_set_dyn_count(liblo10k1_dsp_patch_t *p, int count);
int liblo10k1_patch_set_hw_count(liblo10k1_dsp_patch_t *p, int count);
int liblo10k1_patch_set_tram_count(liblo10k1_dsp_patch_t *p, int count);
int liblo10k1_patch_set_tram_acc_count(liblo10k1_dsp_patch_t *p, int count);
int liblo10k1_patch_set_ctl_count(liblo10k1_dsp_patch_t *p, int count);
int liblo10k1_patch_set_instr_count(liblo10k1_dsp_patch_t *p, int count);
int liblo10k1_patch_load(liblo10k1_connection_t *conn, liblo10k1_dsp_patch_t *patch, int before, int *loaded, int *loaded_id);
int liblo10k1_patch_unload(liblo10k1_connection_t *conn, int patch_num);
int liblo10k1_patch_get(liblo10k1_connection_t *conn, int patch_num, liblo10k1_dsp_patch_t **patch);
int liblo10k1_debug(liblo10k1_connection_t *conn, int deb, void (*prn_fnc)(char *));
int liblo10k1_dsp_init(liblo10k1_connection_t *conn);
int liblo10k1_find_patch(liblo10k1_connection_t *conn, char *patch_name, int *out);
int liblo10k1_find_fx(liblo10k1_connection_t *conn, char *fx_name, int *out);
int liblo10k1_find_in(liblo10k1_connection_t *conn, char *in_name, int *out);
int liblo10k1_find_out(liblo10k1_connection_t *conn, char *out_name, int *out);
int liblo10k1_find_patch_in(liblo10k1_connection_t *conn, int patch_num, char *patch_in_name, int *out);
int liblo10k1_find_patch_out(liblo10k1_connection_t *conn, int patch_num, char *patch_in_name, int *out);
int liblo10k1_rename_patch(liblo10k1_connection_t *conn, int patch_num, char *patch_name);
int liblo10k1_rename_fx(liblo10k1_connection_t *conn, int fx, char *fx_name);
int liblo10k1_rename_in(liblo10k1_connection_t *conn, int in, char *in_name);
int liblo10k1_rename_out(liblo10k1_connection_t *conn, int out, char *out_name);
int liblo10k1_rename_patch_in(liblo10k1_connection_t *conn, int patch_num, int in, char *patch_in_name);
int liblo10k1_rename_patch_out(liblo10k1_connection_t *conn, int patch_num, int out, char *patch_out_name);
int liblo10k1_con_add(liblo10k1_connection_t *conn, int multi, int simple, int from_type, int from_patch, int from_io, int to_type, int to_patch, int to_io, int *ci);
int liblo10k1_con_del(liblo10k1_connection_t *conn, int type, int patch, int io, int *ci);
int liblo10k1_get_fx(liblo10k1_connection_t *conn, int fx_num, liblo10k1_get_io_t *out);
int liblo10k1_get_in(liblo10k1_connection_t *conn, int in_num, liblo10k1_get_io_t *out);
int liblo10k1_get_out(liblo10k1_connection_t *conn, int out_num, liblo10k1_get_io_t *out);
int liblo10k1_get_pin(liblo10k1_connection_t *conn, int patch_num, int in_num, liblo10k1_get_io_t *out);
int liblo10k1_get_pout(liblo10k1_connection_t *conn, int patch_num, int out_num, liblo10k1_get_io_t *out);
int liblo10k1_get_fx_count(liblo10k1_connection_t *conn, int *count);
int liblo10k1_get_in_count(liblo10k1_connection_t *conn, int *count);
int liblo10k1_get_out_count(liblo10k1_connection_t *conn, int *count);
int liblo10k1_get_pin_count(liblo10k1_connection_t *conn, int patch_num, int *count);
int liblo10k1_get_pout_count(liblo10k1_connection_t *conn, int patch_num, int *count);
int liblo10k1_get_patches_info(liblo10k1_connection_t *conn, liblo10k1_patches_info_t **out, int *count);
int liblo10k1_get_points_info(liblo10k1_connection_t *conn, int **out, int *count);
int liblo10k1_get_point_info(liblo10k1_connection_t *conn, int point_id, liblo10k1_point_info_t *out);
int liblo10k1_dump(liblo10k1_connection_t *conn, void **out, int *size);
int liblo10k1_check_version(liblo10k1_connection_t *conn);
int liblo10k1_get_dsp_info(liblo10k1_connection_t *conn, liblo10k1_dsp_info_t *info);
char *liblo10k1_error_str(int error);
#ifdef __cplusplus
}
#endif
#endif /* __LIBLO10K1_H */

View file

@ -0,0 +1,128 @@
/*
* EMU10k1 loader lib
* Copyright (c) 2003,2004 by Peter Zubaj
*
*
* This library 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __LIBLO10K1EF_H
#define __LIBLO10K1EF_H
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
unsigned int sc;
unsigned int sc_val;
} liblo10k1_emu_sc_t;
typedef struct {
unsigned int ctl;
unsigned int ctl_val;
unsigned int ctl_val_min;
unsigned int ctl_val_max;
char ctl_name[32];
} liblo10k1_emu_ctl_t;
typedef struct {
unsigned int line;
unsigned int line_size;
} liblo10k1_emu_tram_line_t;
typedef struct {
unsigned int size;
unsigned int read_line_count;
liblo10k1_emu_tram_line_t *read_lines;
unsigned int write_line_count;
liblo10k1_emu_tram_line_t *write_lines;
} liblo10k1_emu_tram_t;
typedef struct {
unsigned int op;
unsigned int arg[4];
} liblo10k1_emu_instr_t;
typedef struct {
char patch_name[32];
unsigned int in_count;
unsigned int *ins;
unsigned int out_count;
unsigned int *outs;
unsigned int dyn_count;
unsigned int *dyns;
unsigned int sta_count;
liblo10k1_emu_sc_t *stas;
unsigned int ctl_count;
liblo10k1_emu_ctl_t *ctls;
unsigned int con_count;
liblo10k1_emu_sc_t *cons;
unsigned int tram_lookup_count;
liblo10k1_emu_tram_t *tram_lookups;
unsigned int tram_delay_count;
liblo10k1_emu_tram_t *tram_delays;
unsigned int instr_count;
liblo10k1_emu_instr_t *instrs;
} liblo10k1_emu_patch_t;
liblo10k1_emu_patch_t *liblo10k1_emu_new_patch();
void liblo10k1_emu_free_patch(liblo10k1_emu_patch_t *p);
int liblo10k1_emu_patch_set_in_count(liblo10k1_emu_patch_t *p, int count);
int liblo10k1_emu_patch_set_out_count(liblo10k1_emu_patch_t *p, int count);
int liblo10k1_emu_patch_set_dyn_count(liblo10k1_emu_patch_t *p, int count);
int liblo10k1_emu_patch_set_sta_count(liblo10k1_emu_patch_t *p, int count);
int liblo10k1_emu_patch_set_ctl_count(liblo10k1_emu_patch_t *p, int count);
int liblo10k1_emu_patch_set_con_count(liblo10k1_emu_patch_t *p, int count);
int liblo10k1_emu_patch_set_lookup_count(liblo10k1_emu_patch_t *p, int count);
int liblo10k1_emu_patch_set_delay_count(liblo10k1_emu_patch_t *p, int count);
int liblo10k1_emu_patch_set_instr_count(liblo10k1_emu_patch_t *p, int count);
int liblo10k1_emu_patch_set_line_count(liblo10k1_emu_tram_t *t, int write, int count);
int liblo10k1_emu_load_patch(char *file_name, liblo10k1_emu_patch_t **p);
typedef struct
{
int emu_ctls[32];
int emu_ctl_count;
char ctl_name[44];
} liblo10k1_ctl_transform_t;
int liblo10k1_emu_transform_patch(liblo10k1_emu_patch_t *ep, liblo10k1_ctl_transform_t *tctl, int tctl_count, liblo10k1_dsp_patch_t **lp);
int liblo10k1_patch_find_ctl_by_name(liblo10k1_dsp_patch_t *p, char *ctl_name);
int liblo10k1_patch_ctl_set_trans(liblo10k1_dsp_patch_t *p, int idx, int trans);
int liblo10k1_patch_ctl_set_vcount(liblo10k1_dsp_patch_t *p, int idx, int vc);
int liblo10k1_patch_ctl_set_index(liblo10k1_dsp_patch_t *p, int idx, int i);
int liblo10k1_patch_ctl_set_value(liblo10k1_dsp_patch_t *p, int idx, int vi, int val);
#define LD10K1_EF_ERR_OPEN -1000 /* error at file open */
#define LD10K1_EF_ERR_STAT -1001 /* error at file stat */
#define LD10K1_EF_ERR_SIZE -1002 /* wrong file size */
#define LD10K1_EF_ERR_READ -1003 /* error at file read */
#define LD10K1_EF_ERR_SIGNATURE -1004 /* wrong file signature */
#define LD10K1_EF_ERR_FORMAT -1005 /* wrong file format */
#define LD10K1_EF_ERR_TRANSFORM_CTL -1100 /* wrong ctl transformation */
#define LD10K1_EF_ERR_TRANSFORM -1101 /* wrong transformation */
#define LD10K1_EF_ERR_TRANSFORM_TRANS -1102 /* wrong ctl translation */
#ifdef __cplusplus
}
#endif
#endif /* __LIBLO10K1EF_H */

View file

@ -0,0 +1,221 @@
/*
* EMU10k1 loader lib
* Copyright (c) 2003,2004 by Peter Zubaj
*
*
* This library 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __LIBLO10K1LF_H
#define __LIBLO10K1LF_H
#ifdef __cplusplus
extern "C" {
#endif
/* description of structures used in native ld10k1 files */
typedef struct {
/* asciz string with signature - have to be
"LD10K1 NATIVE EFFECT FILE "
01234567890123456789012345678901 */
char signature[32];
/* don't use this */
char reserved[32];
} liblo10k1_file_header_t;
/* don't use this */
#define LD10K1_FP_TYPE_RESERVED 0
/* normal part type, part_length is valid */
#define LD10K1_FP_TYPE_NORMAL 1
/* part start type, part_length have to be 0 */
#define LD10K1_FP_TYPE_START 2
/* part end type, part_length have to be 0 */
#define LD10K1_FP_TYPE_END 3
/* parts can be nested */
typedef struct {
/* don't use this */
unsigned int reserved : 2,
/* part type definition
- normal
- part content start
- part content end */
part_type : 6,
part_id : 24;
/* part data length */
unsigned int part_length;
} liblo10k1_file_part_t;
#define LD10K1_FP_INFO 0
#define LD10K1_FP_DSP_SETUP 1
#define LD10K1_FP_FX 2
#define LD10K1_FP_FX_LIST 3
#define LD10K1_FP_IN 4
#define LD10K1_FP_IN_LIST 5
#define LD10K1_FP_OUT 6
#define LD10K1_FP_OUT_LIST 7
#define LD10K1_FP_PATCH 8
#define LD10K1_FP_PATCH_LIST 9
#define LD10K1_FP_PATCH_INFO 10
#define LD10K1_FP_PIO 11
#define LD10K1_FP_PIN_LIST 12
#define LD10K1_FP_POUT_LIST 13
#define LD10K1_FP_CS 14
#define LD10K1_FP_CONST_LIST 15
#define LD10K1_FP_STA_LIST 16
#define LD10K1_FP_DYN_LIST 17
#define LD10K1_FP_HW 18
#define LD10K1_FP_HW_LIST 19
#define LD10K1_FP_TRAM 20
#define LD10K1_FP_TRAM_LIST 21
#define LD10K1_FP_TRAM_ACC 22
#define LD10K1_FP_TRAM_ACC_LIST 23
#define LD10K1_FP_CTL 24
#define LD10K1_FP_CTL_LIST 25
#define LD10K1_FP_INSTR 26
#define LD10K1_FP_INSTR_LIST 27
#define LD10K1_FP_POINT 28
#define LD10K1_FP_POINT_LIST 29
#define LD10K1_FP_FILE_INFO_NAME 30
#define LD10K1_FP_FILE_INFO_DESC 31
#define LD10K1_FP_FILE_INFO_CREATER 32
#define LD10K1_FP_FILE_INFO_AUTHOR 33
#define LD10K1_FP_FILE_INFO_COPYRIGHT 34
#define LD10K1_FP_FILE_INFO_LICENCE 35
/* file contains whole dsp config */
#define LD10K1_FP_INFO_FILE_TYPE_DSP_SETUP 0
/* file contains only 1 patch */
#define LD10K1_FP_INFO_FILE_TYPE_PATCH 1
typedef struct {
unsigned int file_type;
/* file version
application can ignore this version and read file,
but must be prepared to ignore unknown parts */
unsigned int file_version_major : 8,
file_version_minor : 8,
file_version_subminor : 8,
file_version_pad : 8;
/* minimal version of lo10k1/ld10k1 which will load file
application must be prepared to ignore unknown parts */
unsigned int minimal_reader_version_major : 8,
minimal_reader_version_minor : 8,
minimal_reader_version_subminor : 8,
minimal_reader_version_pad : 8;
/* version of lo10k1/ld10k1 which which created file */
unsigned int creater_version_major : 8,
creater_version_minor : 8,
creater_version_subminor : 8,
creater_version_pad : 8;
} liblo10k1_file_part_info_t;
#define LD10K1_FP_INFO_DSP_TYPE_EMU10K1 0
#define LD10K1_FP_INFO_DSP_TYPE_EMU10K2 1
typedef struct {
unsigned int dsp_type;
/* tram size to setup */
/* unsigned int externa_tram_size; */
/* used to restore io names */
unsigned int fx_count;
unsigned int in_count;
unsigned int out_count;
/* patch count contained in this file */
unsigned int patch_count;
/* point count contained in this file */
unsigned int point_count;
} liblo10k1_file_part_dsp_setup_t;
/* structure used to store and restore config */
typedef struct {
unsigned int dsp_type;
/* used to restore io names */
unsigned int fx_count;
liblo10k1_get_io_t *fxs;
unsigned int in_count;
liblo10k1_get_io_t *ins;
unsigned int out_count;
liblo10k1_get_io_t *outs;
/* patch count contained in this file */
unsigned int patch_count;
liblo10k1_dsp_patch_t **patches;
/* point count contained in this file */
unsigned int point_count;
liblo10k1_point_info_t *points;
} liblo10k1_file_dsp_setup_t;
typedef struct {
char patch_name[MAX_NAME_LEN];
unsigned int in_count;
unsigned int out_count;
unsigned int const_count;
unsigned int sta_count;
unsigned int dyn_count;
unsigned int hw_count;
unsigned int tram_count;
unsigned int tram_acc_count;
unsigned int ctl_count;
unsigned int instr_count;
} liblo10k1_file_patch_info_t;
int liblo10k1lf_get_dsp_config(liblo10k1_connection_t *conn, liblo10k1_file_dsp_setup_t **setup);
int liblo10k1lf_put_dsp_config(liblo10k1_connection_t *conn, liblo10k1_file_dsp_setup_t *setup);
liblo10k1_file_dsp_setup_t *liblo10k1lf_dsp_config_alloc();
void liblo10k1lf_dsp_config_free(liblo10k1_file_dsp_setup_t *c);
typedef struct {
/* file name */
char *name;
/* file description */
char *desc;
/* description of creater application - can be anything */
char *creater;
/* author */
char *author;
/* copyright string */
char *copyright;
/* licence use for this file */
char *license;
} liblo10k1_file_info_t;
liblo10k1_file_info_t *liblo10k1lf_file_info_alloc();
void liblo10k1lf_file_info_free(liblo10k1_file_info_t *fi);
int liblo10k1lf_save_dsp_config(liblo10k1_file_dsp_setup_t *c, char *file_name, liblo10k1_file_info_t *fi);
int liblo10k1lf_load_dsp_config(liblo10k1_file_dsp_setup_t **c, char *file_name, liblo10k1_file_info_t **fi);
int liblo10k1lf_save_dsp_patch(liblo10k1_dsp_patch_t *p, char *file_name, liblo10k1_file_info_t *fi);
int liblo10k1lf_load_dsp_patch(liblo10k1_dsp_patch_t **p, char *file_name, liblo10k1_file_info_t **fi);
#define LD10K1_LF_ERR_OPEN -2000
#define LD10K1_LF_ERR_WRITE -2001
#define LD10K1_LF_ERR_READ -2002
#define LD10K1_LF_ERR_SIGNATURE -2003
#define LD10K1_LF_ERR_PART_TYPE -2004
#define LD10K1_LF_ERR_PART_SIZE -2005
#define LD10K1_LF_ERR_VERSION -2006
#define LD10K1_LF_ERR_FILE_TYPE -2007
#ifdef __cplusplus
}
#endif
#endif /* __LIBLO10K1LF_H */

42
ld10k1/include/lo10k1.h Normal file
View file

@ -0,0 +1,42 @@
/*
* EMU10k1 loader
*
* Copyright (c) 2003,2004 by Peter Zubaj
*
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef __LO10K1_H
#define __LO10K1_H
#ifdef __cplusplus
extern "C" {
#endif
#include <lo10k1/version.h>
#include <lo10k1/ld10k1_error.h>
#include <lo10k1/ld10k1_fnc.h>
#include <lo10k1/comm.h>
#include <lo10k1/liblo10k1.h>
#include <lo10k1/liblo10k1ef.h>
#include <lo10k1/liblo10k1lf.h>
#ifdef __cplusplus
}
#endif
#endif /* __LO10K1_H */

14
ld10k1/include/version.h Normal file
View file

@ -0,0 +1,14 @@
/*
* version.h
*/
#define LD10K1_LIB_MAJOR 0 /**< major number of library version */
#define LD10K1_LIB_MINOR 1 /**< minor number of library version */
#define LD10K1_LIB_SUBMINOR 8 /**< subminor number of library version */
/** library version */
#define LD10K1_LIB_VERSION ((LD10K1_LIB_MAJOR<<16)|\
(LD10K1_LIB_MINOR<<8)|\
LD10K1_LIB_SUBMINOR)
/** library version (string) */
#define LD10K1_LIB_VERSION_STR "0.1.8"