Subversion Repositories svn.mios32

Compare Revisions

Ignore whitespace Rev 1823 → Rev 1824

/trunk/apps/examples/mbnet/app.c
New file
0,0 → 1,126
// $Id$
/*
*
* See README.txt for details
*
* ==========================================================================
*
* Copyright (C) 2009 Thorsten Klose (tk@midibox.org)
* Licensed for personal non-commercial use only.
* All other rights reserved.
*
* ==========================================================================
*/
 
/////////////////////////////////////////////////////////////////////////////
// Include files
/////////////////////////////////////////////////////////////////////////////
 
#include <mios32.h>
#include <string.h>
 
#include <FreeRTOS.h>
#include <portmacro.h>
 
#include "app.h"
#include "terminal.h"
#include "mbnet.h"
#include "mbnet_task.h"
 
 
/////////////////////////////////////////////////////////////////////////////
// for optional debugging messages via MIOS32_MIDI_SendDebug*
/////////////////////////////////////////////////////////////////////////////
 
#define DEBUG_VERBOSE_LEVEL 0
 
 
/////////////////////////////////////////////////////////////////////////////
// Global Variables
/////////////////////////////////////////////////////////////////////////////
 
 
 
/////////////////////////////////////////////////////////////////////////////
// Local variables
/////////////////////////////////////////////////////////////////////////////
 
 
/////////////////////////////////////////////////////////////////////////////
// This hook is called after startup to initialize the application
/////////////////////////////////////////////////////////////////////////////
void APP_Init(void)
{
// initialize all LEDs
MIOS32_BOARD_LED_Init(0xffffffff);
MIOS32_BOARD_LED_Set(0xffffffff, 0);
 
// increase default verbose level (for this demo app...)
MBNET_VerboseLevelSet(3);
 
// start MBNet Task
MBNET_TASK_Init(0);
 
// start terminal
TERMINAL_Init(0);
}
 
 
/////////////////////////////////////////////////////////////////////////////
// This task is running endless in background
/////////////////////////////////////////////////////////////////////////////
void APP_Background(void)
{
}
 
 
 
/////////////////////////////////////////////////////////////////////////////
// This hook is called when a MIDI package has been received
/////////////////////////////////////////////////////////////////////////////
void APP_MIDI_NotifyPackage(mios32_midi_port_t port, mios32_midi_package_t midi_package)
{
}
 
 
/////////////////////////////////////////////////////////////////////////////
// This hook is called before the shift register chain is scanned
/////////////////////////////////////////////////////////////////////////////
void APP_SRIO_ServicePrepare(void)
{
}
 
 
/////////////////////////////////////////////////////////////////////////////
// This hook is called after the shift register chain has been scanned
/////////////////////////////////////////////////////////////////////////////
void APP_SRIO_ServiceFinish(void)
{
}
 
 
/////////////////////////////////////////////////////////////////////////////
// This hook is called when a button has been toggled
// pin_value is 1 when button released, and 0 when button pressed
/////////////////////////////////////////////////////////////////////////////
void APP_DIN_NotifyToggle(u32 pin, u32 pin_value)
{
}
 
 
/////////////////////////////////////////////////////////////////////////////
// This hook is called when an encoder has been moved
// incrementer is positive when encoder has been turned clockwise, else
// it is negative
/////////////////////////////////////////////////////////////////////////////
void APP_ENC_NotifyChange(u32 encoder, s32 incrementer)
{
}
 
 
/////////////////////////////////////////////////////////////////////////////
// This hook is called when a pot has been moved
/////////////////////////////////////////////////////////////////////////////
void APP_AIN_NotifyChange(u32 pin, u32 pin_value)
{
}
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mbnet/terminal.h
===================================================================
--- mbnet/terminal.h (revision 0)
+++ mbnet/terminal.h (revision 1824)
@@ -0,0 +1,42 @@
+// $Id$
+/*
+ * The command/configuration Terminal
+ *
+ * ==========================================================================
+ *
+ * Copyright (C) 2010 Thorsten Klose (tk@midibox.org)
+ * Licensed for personal non-commercial use only.
+ * All other rights reserved.
+ *
+ * ==========================================================================
+ */
+
+#ifndef _TERMINAL_H
+#define _TERMINAL_H
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Global definitions
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Global Types
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+extern s32 TERMINAL_Init(u32 mode);
+extern s32 TERMINAL_Parse(mios32_midi_port_t port, char byte);
+extern s32 TERMINAL_ParseLine(char *input, void *_output_function);
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Export global variables
+/////////////////////////////////////////////////////////////////////////////
+
+
+#endif /* _TERMINAL_H */
/mbnet/terminal.h
Property changes:
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mbnet/app.h
===================================================================
--- mbnet/app.h (revision 0)
+++ mbnet/app.h (revision 1824)
@@ -0,0 +1,47 @@
+// $Id$
+/*
+ * Header file of application
+ *
+ * ==========================================================================
+ *
+ * Copyright (C) 2008 Thorsten Klose (tk@midibox.org)
+ * Licensed for personal non-commercial use only.
+ * All other rights reserved.
+ *
+ * ==========================================================================
+ */
+
+#ifndef _APP_H
+#define _APP_H
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Global definitions
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Global Types
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+extern void APP_Init(void);
+extern void APP_Background(void);
+extern void APP_MIDI_NotifyPackage(mios32_midi_port_t port, mios32_midi_package_t midi_package);
+extern void APP_SRIO_ServicePrepare(void);
+extern void APP_SRIO_ServiceFinish(void);
+extern void APP_DIN_NotifyToggle(u32 pin, u32 pin_value);
+extern void APP_ENC_NotifyChange(u32 encoder, s32 incrementer);
+extern void APP_AIN_NotifyChange(u32 pin, u32 pin_value);
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Export global variables
+/////////////////////////////////////////////////////////////////////////////
+
+
+#endif /* _APP_H */
/mbnet/app.h
Property changes:
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mbnet/mios32_config.h
===================================================================
--- mbnet/mios32_config.h (revision 0)
+++ mbnet/mios32_config.h (revision 1824)
@@ -0,0 +1,38 @@
+// $Id$
+/*
+ * Local MIOS32 configuration file
+ *
+ * this file allows to disable (or re-configure) default functions of MIOS32
+ * available switches are listed in $MIOS32_PATH/modules/mios32/MIOS32_CONFIG.txt
+ *
+ */
+
+#ifndef _MIOS32_CONFIG_H
+#define _MIOS32_CONFIG_H
+
+// The boot message which is print during startup and returned on a SysEx query
+#define MIOS32_LCD_BOOT_MSG_LINE1 "MBNET Example"
+#define MIOS32_LCD_BOOT_MSG_LINE2 "(c) 2013 T.Klose"
+
+// function used to output debug messages (must be printf compatible!)
+#define DEBUG_MSG MIOS32_MIDI_SendDebugMessage
+
+
+#if defined(MIOS32_FAMILY_STM32F10x)
+// only for STM32: disable USB, enable CAN (it isn't possible to use both peripherals at the same time)
+# define MIOS32_DONT_USE_USB
+# define MIOS32_USE_CAN
+// forward debugging messages to UART based MIDI output (since USB is disabled)
+#define MIOS32_MIDI_DEBUG_PORT UART0
+#endif
+
+// relevant if configured as master: how many nodes should be scanned maximum
+#define MBNET_SLAVE_NODES_MAX 8
+
+// first node to be scanned
+#define MBNET_SLAVE_NODES_BEGIN 0x00
+
+// last node to be scanned
+#define MBNET_SLAVE_NODES_END 0x07
+
+#endif /* _MIOS32_CONFIG_H */
/mbnet/mios32_config.h
Property changes:
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mbnet/mbnet_task.c
===================================================================
--- mbnet/mbnet_task.c (revision 0)
+++ mbnet/mbnet_task.c (revision 1824)
@@ -0,0 +1,287 @@
+// $Id$
+/*
+ * MBNet handler as FreeRTOS task
+ *
+ * ==========================================================================
+ *
+ * Copyright (C) 2009 Thorsten Klose (tk@midibox.org)
+ * Licensed for personal non-commercial use only.
+ * All other rights reserved.
+ *
+ * ==========================================================================
+ */
+
+/////////////////////////////////////////////////////////////////////////////
+// Include files
+/////////////////////////////////////////////////////////////////////////////
+#include <mios32.h>
+
+#include <FreeRTOS.h>
+#include <task.h>
+#include <queue.h>
+
+#include <mbnet.h>
+
+#include "mbnet_task.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Task Priorities
+/////////////////////////////////////////////////////////////////////////////
+
+// same priority like MIOS32 hooks
+#define PRIORITY_TASK_UIP ( tskIDLE_PRIORITY + 3 )
+
+
+// for mutual exclusive access to MBNet functions
+// The mutex is handled with MUTEX_MBNET_TAKE and MUTEX_MBNET_GIVE macros
+xSemaphoreHandle xMBNETSemaphore;
+
+
+/////////////////////////////////////////////////////////////////////////////
+// for optional debugging messages via DEBUG_MSG (defined in mios32_config.h)
+/////////////////////////////////////////////////////////////////////////////
+
+#define DEBUG_VERBOSE_LEVEL 1
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Local defines
+/////////////////////////////////////////////////////////////////////////////
+
+#define PATCH_BUFFER_SIZE 512
+#define ENS_BUFFER_SIZE 64
+
+/////////////////////////////////////////////////////////////////////////////
+// local variables
+/////////////////////////////////////////////////////////////////////////////
+
+static u8 patch_buffer[PATCH_BUFFER_SIZE];
+static u8 ens_buffer[ENS_BUFFER_SIZE];
+
+/////////////////////////////////////////////////////////////////////////////
+// Local prototypes
+/////////////////////////////////////////////////////////////////////////////
+static void MBNET_TASK_Handler(void *pvParameters);
+static void MBNET_TASK_Service(u8 master_id, mbnet_tos_req_t tos, u16 control, mbnet_msg_t req_msg, u8 dlc);
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Initialize the MBNet task
+/////////////////////////////////////////////////////////////////////////////
+s32 MBNET_TASK_Init(u32 mode)
+{
+ if( mode > 0 )
+ return -1; // only mode 0 supported yet
+
+ xMBNETSemaphore = xSemaphoreCreateMutex();
+
+ // start task
+ xTaskCreate(MBNET_TASK_Handler, (signed portCHAR *)"MBNet", configMINIMAL_STACK_SIZE, NULL, PRIORITY_TASK_UIP, NULL);
+
+ return 0; // no error
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// The MBNet Task is executed each mS
+/////////////////////////////////////////////////////////////////////////////
+static void MBNET_TASK_Handler(void *pvParameters)
+{
+ // Initialise the xLastExecutionTime variable on task entry
+ portTickType xLastExecutionTime = xTaskGetTickCount();
+
+ // initialize MBNet
+ MUTEX_MBNET_TAKE;
+ MBNET_Init(0);
+ MBNET_NodeIDSet(0x10);
+ MUTEX_MBNET_GIVE;
+
+ // endless loop
+ while( 1 ) {
+ vTaskDelayUntil(&xLastExecutionTime, 1 / portTICK_RATE_MS);
+
+ MUTEX_MBNET_TAKE;
+ MBNET_Handler(MBNET_TASK_Service);
+ MUTEX_MBNET_GIVE;
+ }
+}
+
+
+// Application specific ETOS, READ, WRITE and PING requests are forwarded to
+// this callback function
+// In any case, the function has to send an acknowledge message back
+// to the master node!
+static void MBNET_TASK_Service(u8 master_id, mbnet_tos_req_t tos, u16 control, mbnet_msg_t req_msg, u8 dlc)
+{
+ mbnet_msg_t ack_msg;
+ ack_msg.data_l = 0;
+ ack_msg.data_h = 0;
+
+ // branch depending on TOS
+ switch( tos ) {
+ case MBNET_REQ_SPECIAL:
+ // no support for MBSID specific ETOS yet - just accept them all
+ MBNET_SendAck(master_id, MBNET_ACK_OK, ack_msg, 0); // master_id, tos, msg, dlc
+ break;
+
+ case MBNET_REQ_RAM_READ:
+ if( control >= 0xff00 ) { // ensemble buffer selected?
+ int i;
+ for(i=0; i<8; ++i) {
+ u32 addr = (control & 0xff) + i;
+ if( addr < ENS_BUFFER_SIZE ) // no error if address is greater than allowed, just ignore it
+ ack_msg.bytes[i] = ens_buffer[addr];
+ else
+ ack_msg.bytes[i] = 0;
+ }
+ } else { // patch buffer selected
+ int i;
+ for(i=0; i<8; ++i) {
+ u32 addr = control + i;
+ if( addr < PATCH_BUFFER_SIZE ) // no error if address is greater than allowed, just ignore it
+ ack_msg.bytes[i] = patch_buffer[addr];
+ else
+ ack_msg.bytes[i] = 0;
+ }
+ }
+ MBNET_SendAck(master_id, MBNET_ACK_READ, ack_msg, 8); // master_id, tos, msg, dlc
+ break;
+
+ case MBNET_REQ_RAM_WRITE:
+ if( dlc == 0 ) { // error of no byte has been received
+ MBNET_SendAck(master_id, MBNET_ACK_ERROR, ack_msg, 0); // master_id, tos, msg, dlc
+ } else {
+ if( control >= 0xff00 ) { // ensemble buffer selected?
+ int i;
+ for(i=0; i<dlc; ++i) {
+ u32 addr = (control & 0xff) + i;
+ if( addr < ENS_BUFFER_SIZE ) // no error if address is greater than allowed, just ignore it
+ ens_buffer[addr] = req_msg.bytes[i];
+ }
+ } else { // patch buffer selected
+ int i;
+ for(i=0; i<dlc; ++i) {
+ u32 addr = control + i;
+ if( addr < PATCH_BUFFER_SIZE ) // no error if address is greater than allowed, just ignore it
+ patch_buffer[addr] = req_msg.bytes[i];
+ }
+ }
+ MBNET_SendAck(master_id, MBNET_ACK_OK, ack_msg, 0); // master_id, tos, msg, dlc
+ }
+ break;
+
+ case MBNET_REQ_PING:
+#if 0
+ ack_msg.protocol_version = 1; // should be 1
+ ack_msg.node_type[0] = 'S'; // 4 characters which identify the node type
+ ack_msg.node_type[1] = 'I';
+ ack_msg.node_type[2] = 'D';
+ ack_msg.node_type[3] = ' ';
+ ack_msg.node_version = 2; // version number (0..255)
+ ack_msg.node_subversion = 0; // subversion number (0..65535)
+#else
+ // for demo app
+ ack_msg.protocol_version = 1; // should be 1
+ ack_msg.node_type[0] = 'A'; // 4 characters which identify the node type
+ ack_msg.node_type[1] = 'B';
+ ack_msg.node_type[2] = 'C';
+ ack_msg.node_type[3] = 'D';
+ ack_msg.node_version = 1; // version number (0..255)
+ ack_msg.node_subversion = 0; // subversion number (0..65535)
+#endif
+ MBNET_SendAck(master_id, MBNET_ACK_OK, ack_msg, 8); // master_id, tos, msg, dlc
+ break;
+
+ default:
+ // unexpected TOS
+ MBNET_SendAck(master_id, MBNET_ACK_ERROR, ack_msg, 0); // master_id, tos, msg, dlc
+ }
+}
+
+
+
+/////////////////////////////////////////////////////////////////////////////
+// This function transfers a 8bit value into patch memory
+/////////////////////////////////////////////////////////////////////////////
+s32 MBNET_TASK_PatchWrite8(u8 sid, u16 addr, u8 value)
+{
+ s32 status;
+
+#if 1
+ MIOS32_BOARD_LED_Set(1, 1); // flicker LED for debugging
+#endif
+
+ MUTEX_MBNET_TAKE;
+
+ mbnet_msg_t msg;
+ msg.bytes[0] = value;
+ u8 dlc = 1;
+
+ if( (status=MBNET_SendReq(sid, MBNET_REQ_RAM_WRITE, addr, msg, dlc)) < 0 ) {
+#if DEBUG_VERBOSE_LEVEL >= 1
+ DEBUG_MSG("[MBNET_TASK_WritePatch8] MBNET_SendReq failed with status %d\n", status);
+#endif
+ } else {
+ mbnet_msg_t ack_msg;
+ if( (status=MBNET_WaitAck(sid, &ack_msg, &dlc)) < 0 ) {
+#if DEBUG_VERBOSE_LEVEL >= 1
+ DEBUG_MSG("[MBNET_TASK_WritePatch8] MBNET_WaitAck failed with status %d\n", status);
+#endif
+ }
+ }
+
+ MUTEX_MBNET_GIVE;
+
+#if 1
+ MIOS32_BOARD_LED_Set(1, 0); // flicker LED for debugging
+#endif
+
+ return status;
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// This function transfers a 16bit value into patch memory
+/////////////////////////////////////////////////////////////////////////////
+s32 MBNET_TASK_PatchWrite16(u8 sid, u16 addr, u16 value)
+{
+ s32 status;
+
+#if 1
+ MIOS32_BOARD_LED_Set(1, 1); // flicker LED for debugging
+#endif
+
+ MUTEX_MBNET_TAKE;
+
+ mbnet_msg_t msg;
+ msg.bytes[0] = value & 0xff;
+ msg.bytes[1] = value >> 8;
+ u8 dlc = 2;
+
+ if( (status=MBNET_SendReq(sid, MBNET_REQ_RAM_WRITE, addr, msg, dlc)) < 0 ) {
+#if DEBUG_VERBOSE_LEVEL >= 1
+ DEBUG_MSG("[MBNET_TASK_WritePatch16] MBNET_SendReq failed with status %d\n", status);
+#endif
+ } else {
+ mbnet_msg_t ack_msg;
+ if( (status=MBNET_WaitAck(sid, &ack_msg, &dlc)) < 0 ) {
+#if DEBUG_VERBOSE_LEVEL >= 1
+ DEBUG_MSG("[MBNET_TASK_WritePatch16] MBNET_WaitAck failed with status %d\n", status);
+#endif
+ }
+ }
+
+ MUTEX_MBNET_GIVE;
+
+#if 1
+ MIOS32_BOARD_LED_Set(1, 0); // flicker LED for debugging
+#endif
+
+
+ return status;
+}
+
+
+
+
/mbnet/mbnet_task.c
Property changes:
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mbnet/README.txt
===================================================================
--- mbnet/README.txt (revision 0)
+++ mbnet/README.txt (revision 1824)
@@ -0,0 +1,23 @@
+$Id$
+
+MIDIbox SID OSC->MBNet Proxy
+===============================================================================
+Copyright (C) 2013 Thorsten Klose (tk@midibox.org)
+Licensed for personal non-commercial use only.
+All other rights reserved.
+===============================================================================
+
+Required tools:
+ -> http://svnmios.midibox.org/filedetails.php?repname=svn.mios32&path=%2Ftrunk%2Fdoc%2FMEMO
+
+===============================================================================
+
+Required hardware:
+ o 2 x MBHP_CORE_STM32 or MBHP_CORE_LPC17, connected together via J18
+
+===============================================================================
+
+For background informations see:
+http://midibox.org/forums/topic/18245-mbnet-issues-custom-build
+
+===============================================================================
/mbnet/README.txt
Property changes:
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mbnet/terminal.c
===================================================================
--- mbnet/terminal.c (revision 0)
+++ mbnet/terminal.c (revision 1824)
@@ -0,0 +1,120 @@
+// $Id$
+/*
+ * The command/configuration Terminal
+ *
+ * ==========================================================================
+ *
+ * Copyright (C) 2010 Thorsten Klose (tk@midibox.org)
+ * Licensed for personal non-commercial use only.
+ * All other rights reserved.
+ *
+ * ==========================================================================
+ */
+
+/////////////////////////////////////////////////////////////////////////////
+// Include files
+/////////////////////////////////////////////////////////////////////////////
+
+#include <mios32.h>
+#include <string.h>
+
+#include "app.h"
+#include "terminal.h"
+#include "mbnet.h"
+#include "mbnet_task.h"
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Local defines
+/////////////////////////////////////////////////////////////////////////////
+
+#define STRING_MAX 100 // recommended size for file transfers via FILE_BrowserHandler()
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Local variables
+/////////////////////////////////////////////////////////////////////////////
+
+static char line_buffer[STRING_MAX];
+static u16 line_ix;
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Local prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Initialisation
+/////////////////////////////////////////////////////////////////////////////
+s32 TERMINAL_Init(u32 mode)
+{
+ // install the callback function which is called on incoming characters from MIOS Terminal
+ MIOS32_MIDI_DebugCommandCallback_Init(TERMINAL_Parse);
+
+ // clear line buffer
+ line_buffer[0] = 0;
+ line_ix = 0;
+
+ return 0; // no error
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Parser
+/////////////////////////////////////////////////////////////////////////////
+s32 TERMINAL_Parse(mios32_midi_port_t port, char byte)
+{
+ // temporary change debug port (will be restored at the end of this function)
+ mios32_midi_port_t prev_debug_port = MIOS32_MIDI_DebugPortGet();
+ MIOS32_MIDI_DebugPortSet(port);
+
+ if( byte == '\r' ) {
+ // ignore
+ } else if( byte == '\n' ) {
+ //MUTEX_MIDIOUT_TAKE;
+ TERMINAL_ParseLine(line_buffer, MIOS32_MIDI_SendDebugMessage);
+ //MUTEX_MIDIOUT_GIVE;
+ line_ix = 0;
+ line_buffer[line_ix] = 0;
+ } else if( line_ix < (STRING_MAX-1) ) {
+ line_buffer[line_ix++] = byte;
+ line_buffer[line_ix] = 0;
+ }
+
+ // restore debug port
+ MIOS32_MIDI_DebugPortSet(prev_debug_port);
+
+ return 0; // no error
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Parser for a complete line - also used by shell.c for telnet
+/////////////////////////////////////////////////////////////////////////////
+s32 TERMINAL_ParseLine(char *input, void *_output_function)
+{
+ void (*out)(char *format, ...) = _output_function;
+ char *separators = " \t";
+ char *brkt;
+ char *parameter;
+
+ if( MBNET_TerminalParseLine(input, _output_function) > 0 )
+ return 0; // command parsed
+
+ if( (parameter = strtok_r(input, separators, &brkt)) ) {
+ if( strcmp(parameter, "help") == 0 ) {
+ out("Welcome to " MIOS32_LCD_BOOT_MSG_LINE1 "!");
+ out("Following commands are available:");
+ MBNET_TerminalHelp(_output_function);
+ out(" reset: resets the MIDIbox (!)\n");
+ out(" help: this page");
+ } else if( strcmp(parameter, "reset") == 0 ) {
+ MIOS32_SYS_Reset();
+ } else {
+ out("Unknown command - type 'help' to list available commands!");
+ }
+ }
+
+ return 0; // no error
+}
/mbnet/terminal.c
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mbnet/Makefile
===================================================================
--- mbnet/Makefile (revision 0)
+++ mbnet/Makefile (revision 1824)
@@ -0,0 +1,61 @@
+# $Id$
+
+################################################################################
+# following setup taken from environment variables
+################################################################################
+
+PROCESSOR = $(MIOS32_PROCESSOR)
+FAMILY = $(MIOS32_FAMILY)
+BOARD = $(MIOS32_BOARD)
+LCD = $(MIOS32_LCD)
+
+
+################################################################################
+# Source Files, include paths and libraries
+################################################################################
+
+THUMB_SOURCE = app.c \
+ mbnet_task.c \
+ terminal.c
+
+
+# (following source stubs not relevant for Cortex M3 derivatives)
+THUMB_AS_SOURCE =
+ARM_SOURCE =
+ARM_AS_SOURCE =
+
+C_INCLUDE = -I .
+A_INCLUDE = -I .
+
+LIBS =
+
+
+################################################################################
+# Remaining variables
+################################################################################
+
+LD_FILE = $(MIOS32_PATH)/etc/ld/$(FAMILY)/$(PROCESSOR).ld
+PROJECT = project
+
+DEBUG = -g
+OPTIMIZE = -Os
+
+CFLAGS = $(DEBUG) $(OPTIMIZE)
+
+
+################################################################################
+# Include source modules via additional makefiles
+################################################################################
+
+# sources of programming model
+include $(MIOS32_PATH)/programming_models/traditional/programming_model.mk
+
+# application specific LCD driver (selected via makefile variable)
+include $(MIOS32_PATH)/modules/app_lcd/$(LCD)/app_lcd.mk
+
+# MBNet module
+include $(MIOS32_PATH)/modules/mbnet/mbnet.mk
+
+# common make rules
+# Please keep this include statement at the end of this Makefile. Add new modules above.
+include $(MIOS32_PATH)/include/makefile/common.mk
/mbnet/Makefile
Property changes:
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mbnet/mbnet_task.h
===================================================================
--- mbnet/mbnet_task.h (revision 0)
+++ mbnet/mbnet_task.h (revision 1824)
@@ -0,0 +1,51 @@
+// $Id$
+/*
+ * Header file for MBNet Task
+ *
+ * ==========================================================================
+ *
+ * Copyright (C) 2009 Thorsten Klose (tk@midibox.org)
+ * Licensed for personal non-commercial use only.
+ * All other rights reserved.
+ *
+ * ==========================================================================
+ */
+
+#ifndef _MBNET_TASK_H
+#define _MBNET_TASK_H
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Global definitions
+/////////////////////////////////////////////////////////////////////////////
+
+
+#include <FreeRTOS.h>
+#include <semphr.h>
+
+extern xSemaphoreHandle xMBNETSemaphore;
+# define MUTEX_MBNET_TAKE { while( xSemaphoreTake(xMBNETSemaphore, (portTickType)1) != pdTRUE ); }
+# define MUTEX_MBNET_GIVE { xSemaphoreGive(xMBNETSemaphore); }
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Global Types
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Prototypes
+/////////////////////////////////////////////////////////////////////////////
+
+extern s32 MBNET_TASK_Init(u32 mode);
+
+extern s32 MBNET_TASK_PatchWrite8(u8 sid, u16 addr, u8 value);
+extern s32 MBNET_TASK_PatchWrite16(u8 sid, u16 addr, u16 value);
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Export global variables
+/////////////////////////////////////////////////////////////////////////////
+
+
+#endif /* _MBNET_TASK_H */
/mbnet/mbnet_task.h
Property changes:
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: mbnet/mbnet_debug.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Index: mbnet/mbnet_debug.png
===================================================================
--- mbnet/mbnet_debug.png (revision 0)
+++ mbnet/mbnet_debug.png (revision 1824)
/mbnet/mbnet_debug.png
Property changes:
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property