Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add network support #744

Merged
merged 13 commits into from
Nov 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ sdcard
*.swp
*.swo

CMSIS_5/
Synth_Dexed/
circle-stdlib/
CMSIS_5/**
Synth_Dexed/**
circle-stdlib/**
.vscode/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
[submodule "circle-stdlib"]
path = circle-stdlib
url = https://github.com/smuehlst/circle-stdlib
ignore = all
[submodule "Synth_Dexed"]
path = Synth_Dexed
url = https://codeberg.org/dcoredump/Synth_Dexed.git
ignore = all
[submodule "CMSIS_5"]
path = CMSIS_5
url = https://github.com/ARM-software/CMSIS_5
ignore = all
10 changes: 10 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ if [ "${RPI}" -gt "1" ]; then
OPTIONS="${OPTIONS} -o ARM_ALLOW_MULTI_CORE"
fi

# For wireless access
if [ "${RPI}" == "3" ]; then
OPTIONS="${OPTIONS} -o USE_SDHOST"
fi

# USB Vendor and Device ID for use with USB Gadget Mode
source USBID.sh
if [ "${USB_VID}" ] ; then
Expand All @@ -39,6 +44,11 @@ make -j
cd libs/circle/addon/display/
make clean || true
make -j

cd ../wlan/
make clean || true
make -j

cd ../sensor/
make clean || true
make -j
Expand Down
6 changes: 4 additions & 2 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
CIRCLE_STDLIB_DIR = ../circle-stdlib
SYNTH_DEXED_DIR = ../Synth_Dexed/src
CMSIS_DIR = ../CMSIS_5/CMSIS
NET_DIR = ./net

OBJS = main.o kernel.o minidexed.o config.o userinterface.o uimenu.o \
mididevice.o midikeyboard.o serialmididevice.o pckeyboard.o \
mididevice.o udpmididevice.o midikeyboard.o serialmididevice.o pckeyboard.o \
sysexfileloader.o performanceconfig.o perftimer.o \
effect_compressor.o effect_platervbstereo.o uibuttons.o midipin.o
effect_compressor.o effect_platervbstereo.o uibuttons.o midipin.o \
net/ftpdaemon.o net/ftpworker.o net/applemidi.o net/udpmidi.o

OPTIMIZE = -O3

Expand Down
10 changes: 8 additions & 2 deletions src/Rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ include $(CIRCLEHOME)/Rules.mk

INCLUDE += \
-I $(CIRCLE_STDLIB_DIR)/include \
-I $(NEWLIBDIR)/include
-I $(NEWLIBDIR)/include \
-I $(NET_DIR)

LIBS += \
$(NEWLIBDIR)/lib/libm.a \
Expand All @@ -28,6 +29,11 @@ LIBS += \
$(CIRCLEHOME)/addon/fatfs/libfatfs.a \
$(CIRCLEHOME)/lib/fs/libfs.a \
$(CIRCLEHOME)/lib/sched/libsched.a \
$(CIRCLEHOME)/lib/libcircle.a
$(CIRCLEHOME)/lib/libcircle.a \
$(CIRCLEHOME)/addon/wlan/hostap/wpa_supplicant/libwpa_supplicant.a \
$(CIRCLEHOME)/addon/wlan/libwlan.a \
$(CIRCLEHOME)/lib/net/libnet.a

EXTRACLEAN += $(NET_DIR)/*.d $(NET_DIR)/*.o

-include $(DEPS)
1 change: 1 addition & 0 deletions src/circle_stdlib_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ class CStdlibAppStdio: public CStdlibAppScreen
CEMMCDevice mEMMC;
FATFS mFileSystem;
CConsole mConsole;
CScheduler mScheduler;
};

/**
Expand Down
51 changes: 51 additions & 0 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,16 @@ void CConfig::Load (void)
m_bProfileEnabled = m_Properties.GetNumber ("ProfileEnabled", 0) != 0;
m_bPerformanceSelectToLoad = m_Properties.GetNumber ("PerformanceSelectToLoad", 1) != 0;
m_bPerformanceSelectChannel = m_Properties.GetNumber ("PerformanceSelectChannel", 0);

// Network
m_bNetworkEnabled = m_Properties.GetNumber ("NetworkEnabled", 0) != 0;
m_bNetworkDHCP = m_Properties.GetNumber ("NetworkDHCP", 0) != 0;
m_NetworkType = m_Properties.GetString ("NetworkType", "wifi");
m_NetworkHostname = m_Properties.GetString ("NetworkHostname", "minidexed");
m_INetworkIPAddress = m_Properties.GetIPAddress("NetworkIPAddress") != 0;
m_INetworkSubnetMask = m_Properties.GetIPAddress("NetworkSubnetMask") != 0;
m_INetworkDefaultGateway = m_Properties.GetIPAddress("NetworkDefaultGateway") != 0;
m_INetworkDNSServer = m_Properties.GetIPAddress("NetworkDNSServer") != 0;
}

bool CConfig::GetUSBGadgetMode (void) const
Expand Down Expand Up @@ -503,3 +513,44 @@ unsigned CConfig::GetPerformanceSelectChannel (void) const
{
return m_bPerformanceSelectChannel;
}

// Network
bool CConfig::GetNetworkEnabled (void) const
{
return m_bNetworkEnabled;
}

bool CConfig::GetNetworkDHCP (void) const
{
return m_bNetworkDHCP;
}

const char *CConfig::GetNetworkType (void) const
{
return m_NetworkType.c_str();
}

const char *CConfig::GetNetworkHostname (void) const
{
return m_NetworkHostname.c_str();
}

CIPAddress CConfig::GetNetworkIPAddress (void) const
{
return m_INetworkIPAddress;
}

CIPAddress CConfig::GetNetworkSubnetMask (void) const
{
return m_INetworkSubnetMask;
}

CIPAddress CConfig::GetNetworkDefaultGateway (void) const
{
return m_INetworkDefaultGateway;
}

CIPAddress CConfig::GetNetworkDNSServer (void) const
{
return m_INetworkDNSServer;
}
21 changes: 21 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#ifndef _config_h
#define _config_h

#include <circle/net/ipaddress.h>
#include <fatfs/ff.h>
#include <Properties/propertiesfatfsfile.h>
#include <circle/sysconfig.h>
Expand Down Expand Up @@ -168,6 +169,16 @@ class CConfig // Configuration for MiniDexed
bool GetPerformanceSelectToLoad (void) const;
unsigned GetPerformanceSelectChannel (void) const;

// Network
bool GetNetworkEnabled (void) const;
const char *GetNetworkType (void) const;
bool GetNetworkDHCP (void) const;
const char *GetNetworkHostname (void) const;
CIPAddress GetNetworkIPAddress (void) const;
CIPAddress GetNetworkSubnetMask (void) const;
CIPAddress GetNetworkDefaultGateway (void) const;
CIPAddress GetNetworkDNSServer (void) const;

private:
CPropertiesFatFsFile m_Properties;

Expand Down Expand Up @@ -252,6 +263,16 @@ class CConfig // Configuration for MiniDexed
bool m_bProfileEnabled;
bool m_bPerformanceSelectToLoad;
unsigned m_bPerformanceSelectChannel;

// Network
bool m_bNetworkEnabled;
bool m_bNetworkDHCP;
std::string m_NetworkType;
std::string m_NetworkHostname;
CIPAddress m_INetworkIPAddress;
CIPAddress m_INetworkSubnetMask;
CIPAddress m_INetworkDefaultGateway;
CIPAddress m_INetworkDNSServer;
};

#endif
5 changes: 4 additions & 1 deletion src/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@
#include <circle/usb/usbhcidevice.h>
#include "usbminidexedmidigadget.h"

#define NET_DEVICE_TYPE NetDeviceTypeWLAN // or: NetDeviceTypeWLAN

LOGMODULE ("kernel");

CKernel *CKernel::s_pThis = 0;

CKernel::CKernel (void)
: CStdlibAppStdio ("minidexed"),
:
CStdlibAppStdio ("minidexed"),
m_Config (&mFileSystem),
m_GPIOManager (&mInterrupt),
m_I2CMaster (CMachineInfo::Get ()->GetDevice (DeviceI2CMaster), TRUE),
Expand Down
1 change: 1 addition & 0 deletions src/kernel.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <circle/gpiomanager.h>
#include <circle/i2cmaster.h>
#include <circle/usb/usbcontroller.h>
#include <circle/sched/scheduler.h>
#include "config.h"
#include "minidexed.h"

Expand Down
2 changes: 0 additions & 2 deletions src/mididevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
{
if ((ucChannel == nPerfCh) || (nPerfCh == OmniMode))
{
//printf("Performance Select Channel %d\n", nPerfCh);
m_pSynthesizer->ProgramChangePerformance (pMessage[1]);
}
}
Expand Down Expand Up @@ -257,7 +256,6 @@ void CMIDIDevice::MIDIMessageHandler (const u8 *pMessage, size_t nLength, unsign
{
break;
}

m_pSynthesizer->keyup (pMessage[1], nTG);
break;

Expand Down
Loading
Loading