freemyipod r28 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r27‎ | r28 | r29 >
Date:21:35, 5 August 2010
Author:theseven
Status:new
Tags:
Comment:
Change the "Get Information" monitor commands to match the description in the wiki
Modified paths:
  • /embios/trunk/Makefile (modified) (history)
  • /embios/trunk/global.h (modified) (history)
  • /embios/trunk/thread.h (modified) (history)
  • /embios/trunk/tools (added) (history)
  • /embios/trunk/usb/synopsysotg.c (modified) (history)
  • /embios/trunk/usb/usb.c (modified) (history)
  • /embios/trunk/usb/usbdrv.h (modified) (history)
  • /embios/trunk/version.h (added) (history)

Diff [purge]

Index: embios/trunk/Makefile
@@ -13,6 +13,9 @@
1414 preprocess = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#")
1515 preprocesspaths = $(shell $(CC) $(PPCFLAGS) $(2) -E -P -x c $(1) | grep -v "^\#" | sed -e "s:^..*:$(dir $(1))&:")
1616
 17+REVISION := $(shell svnversion .)
 18+REVISIONINT := $(shell echo $(REVISION) | sed -e "s/[^0-9].*$$//")
 19+
1720 TARGETS := $(call preprocess,TARGETS,-I.)
1821
1922 define TARGET_template
@@ -33,7 +36,7 @@
3437 build/$(1)/$(NAME).elf: target/$(1)/ls.x build/$(1)/target/$(1)/crt0.o $$(OBJ_$(1))
3538 $(LD) $(LDFLAGS) -o $$@ -T target/$(1)/ls.x $$(OBJ_$(1))
3639
37 -build/$(1)/%.o: %.c
 40+build/$(1)/%.o: %.c build/version.h
3841 ifeq ($(shell uname),WindowsNT)
3942 @-if not exist $$(subst /,\,$$(dir $$@)) md $$(subst /,\,$$(dir $$@))
4043 else
@@ -45,7 +48,7 @@
4649 @sed -e "s/.*://" -e "s/\\$$$$//" < $$@.dep.tmp | fmt -1 | sed -e "s/^ *//" -e "s/$$$$/:/" >> $$@.dep
4750 @rm -f $$@.dep.tmp
4851
49 -build/$(1)/%.o: %.S
 52+build/$(1)/%.o: %.S build/version.h
5053 ifeq ($(shell uname),WindowsNT)
5154 @-if not exist $$(subst /,\,$$(dir $$@)) md $$(subst /,\,$$(dir $$@))
5255 else
@@ -62,6 +65,12 @@
6366
6467 $(foreach target,$(TARGETS),$(eval $(call TARGET_template,$(target))))
6568
 69+build/version.h: version.h .svn/entries build
 70+ @sed -e "s/\$$REVISION\$$/$(REVISION)/" -e "s/\$$REVISIONINT\$$/$(REVISIONINT)/" < $< > $@
 71+
 72+build:
 73+ @mkdir build
 74+
6675 clean:
6776 rm -rf build
6877
Index: embios/trunk/global.h
@@ -29,7 +29,7 @@
3030 #include <stddef.h>
3131 #endif
3232
33 -#define VERSION "0.0.1pre"
 33+#include "build/version.h"
3434
3535 #define ICODE_ATTR __attribute__((section(".icode")))
3636 #define ICONST_ATTR __attribute__((section(".irodata")))
@@ -48,6 +48,14 @@
4949 #include "config.h"
5050 #include "target.h"
5151
 52+#ifndef SCHEDULER_TICK
 53+#define SCHEDULER_TICK 1048576
 54+#endif
 55+
 56+#ifndef SYSTEM_TICK
 57+#define SYSTEM_TICK 10000
 58+#endif
 59+
5260 #ifndef MAX_THREADS
5361 #define MAX_THREADS 32
5462 #endif
Index: embios/trunk/usb/synopsysotg.c
@@ -366,3 +366,13 @@
367367 /* reset the beast */
368368 usb_reset();
369369 }
 370+
 371+int usb_drv_get_max_out_size()
 372+{
 373+ return usb_drv_port_speed() ? 262144 : 32768;
 374+}
 375+
 376+int usb_drv_get_max_in_size()
 377+{
 378+ return usb_drv_port_speed() ? 262144 : 32768;
 379+}
Index: embios/trunk/usb/usb.c
@@ -304,12 +304,25 @@
305305 {
306306 switch (dbgrecvbuf[0])
307307 {
308 - case 1: // GET VERSION
 308+ case 1: // GET INFO
309309 dbgsendbuf[0] = 1;
310 - dbgsendbuf[1] = 0x01010000;
311 - dbgsendbuf[2] = PLATFORM_ID;
312 - dbgsendbuf[3] = 0x02000200;
313310 size = 16;
 311+ switch (dbgrecvbuf[1])
 312+ {
 313+ case 0: // GET VERSION INFO
 314+ dbgsendbuf[1] = VERSION_MAJOR | (VERSION_MINOR << 8)
 315+ | (VERSION_PATCH << 16) | (1 << 24);
 316+ dbgsendbuf[2] = PLATFORM_ID;
 317+ dbgsendbuf[3] = VERSION_SVN_INT;
 318+ break;
 319+ case 1: // GET PACKET SIZE INFO
 320+ dbgsendbuf[1] = 0x02000200;
 321+ dbgsendbuf[2] = usb_drv_get_max_out_size();
 322+ dbgsendbuf[3] = usb_drv_get_max_in_size();
 323+ break;
 324+ default:
 325+ dbgsendbuf[0] = 2;
 326+ }
314327 break;
315328 case 2: // RESET
316329 reset();
Index: embios/trunk/usb/usbdrv.h
@@ -39,6 +39,8 @@
4040 bool usb_drv_stalled(int endpoint, bool in);
4141 void usb_drv_stall(int endpoint, bool stall, bool in);
4242 void usb_drv_init(void);
 43+int usb_drv_get_max_out_size();
 44+int usb_drv_get_max_in_size();
4345
4446
4547 #endif
Index: embios/trunk/thread.h
@@ -29,14 +29,6 @@
3030 #include "contextswitch.h"
3131
3232
33 -#ifndef SCHEDULER_TICK
34 -#define SCHEDULER_TICK 1048576
35 -#endif
36 -
37 -#ifndef SYSTEM_TICK
38 -#define SYSTEM_TICK 10000
39 -#endif
40 -
4133 #define TIMEOUT_NONE 0
4234 #define TIMEOUT_BLOCK -1
4335
Index: embios/trunk/version.h
@@ -0,0 +1,36 @@
 2+//
 3+//
 4+// Copyright 2010 TheSeven
 5+//
 6+//
 7+// This file is part of emBIOS.
 8+//
 9+// emBIOS is free software: you can redistribute it and/or
 10+// modify it under the terms of the GNU General Public License as
 11+// published by the Free Software Foundation, either version 2 of the
 12+// License, or (at your option) any later version.
 13+//
 14+// emBIOS is distributed in the hope that it will be useful,
 15+// but WITHOUT ANY WARRANTY; without even the implied warranty of
 16+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 17+// See the GNU General Public License for more details.
 18+//
 19+// You should have received a copy of the GNU General Public License along
 20+// with emBIOS. If not, see <http://www.gnu.org/licenses/>.
 21+//
 22+//
 23+
 24+
 25+#ifndef __VERSION_H__
 26+#define __VERSIONs_H__
 27+
 28+
 29+#define VERSION "0.0.1pre"
 30+#define VERSION_MAJOR 0
 31+#define VERSION_MINOR 0
 32+#define VERSION_PATCH 1
 33+#define VERSION_SVN "$REVISION$"
 34+#define VERSION_SVN_INT $REVISIONINT$
 35+
 36+
 37+#endif
\ No newline at end of file