Permalink
Browse files

Changed to use internal SPI for reading PSX bus

Receive appears to pass the flash check when receiving 0x80

It was discovered that 0x01 makes for 0x80, so it would appear the
byte order is reversed
  • Loading branch information...
kcuzner committed Aug 4, 2013
1 parent ab11bd4 commit 4d09663f24c7d2d3c95c2f8aff17db237f88ee8d
Showing with 250 additions and 217 deletions.
  1. +1 −1 Makefile
  2. +12 −13 include/buttons.h
  3. +0 −8 include/psx_pins.h
  4. +37 −1 kicad/popnmusic-cache.lib
  5. +181 −50 kicad/popnmusic.sch
  6. +2 −2 src/buttons.c
  7. +5 −4 src/main.c
  8. +12 −33 src/psx.c
  9. +0 −105 src/psx_fast.S
View
@@ -85,7 +85,7 @@ PROJECTNAME=popnmusic
# (list all files to compile, e.g. 'a.c b.cpp as.S'):
# Use .cc, .cpp or .C suffix for C++ files, use .S
# (NOT .s !!!) for assembly source code files.
-PRJSRC=src/main.c src/psx.c src/buttons.c src/psx_fast.S
+PRJSRC=src/main.c src/psx.c src/buttons.c
# additional includes (e.g. -I/path/to/mydir)
INC=-Iinclude
View
@@ -22,32 +22,31 @@
#define BTN_PB_TRIANGLE 0x01
#define BTN_PB_CIRCLE 0x02
-#define BTN_PB_R1 0x04
-#define BTN_B_MASK BTN_PB_TRIANGLE | BTN_PB_CIRCLE | BTN_PB_R1
+#define BTN_B_MASK BTN_PB_TRIANGLE | BTN_PB_CIRCLE
/******
* PORTC buttons
******/
-#define BTN_PC_X 0x01
-#define BTN_PC_L1 0x02
-#define BTN_PC_SQUARE 0x04
-#define BTN_PC_R2 0x08
-#define BTN_PC_UP 0x10
-#define BTN_PC_L2 0x20
+#define BTN_PC_R1 (1 << PC0)
+#define BTN_PC_X (1 << PC1)
+#define BTN_PC_L1 (1 << PC2)
+#define BTN_PC_SQUARE (1 << PC3)
+#define BTN_PC_R2 (1 << PC4)
+#define BTN_PC_UP (1 << PC5)
-#define BTN_C_MASK BTN_PC_X | BTN_PC_L1 | BTN_PC_SQUARE | BTN_PC_R2 | \
- BTN_PC_UP | BTN_PC_L2
+#define BTN_C_MASK BTN_PC_R1 | BTN_PC_X | BTN_PC_L1 | BTN_PC_SQUARE | BTN_PC_R2 | BTN_PC_UP
/******
* PORTD buttons
******/
-#define BTN_PD_START 0x40
-#define BTN_PD_SELECT 0x80
+#define BTN_PD_L2 (1 << PD5)
+#define BTN_PD_START (1 << PD6)
+#define BTN_PD_SELECT (1 << PD7)
-#define BTN_D_MASK BTN_PD_START | BTN_PD_SELECT
+#define BTN_D_MASK BTN_PD_L2 | BTN_PD_START | BTN_PD_SELECT
/**
* Button setup function
View
@@ -9,16 +9,8 @@
#define PSX_PIN PIND
#define PSX_DDR DDRD
-#define PSX_ATT PD3
-#define PSX_CLK PD2
-#define PSX_DATA PD1
-#define PSX_CMD PD0
#define PSX_ACK PD4
-#define PSX_ATT_MASK 1 << PD3
-#define PSX_CLK_MASK 1 << PD2
-#define PSX_DATA_MASK 1 << PD1
-#define PSX_CMD_MASK 1 << PD0
#define PSX_ACK_MASK 1 << PD4
#define PSX_FLAG_RECVD 0x01
View
@@ -1,4 +1,4 @@
-EESchema-LIBRARY Version 2.3 Date: Sat 03 Aug 2013 01:57:07 PM MDT
+EESchema-LIBRARY Version 2.3 Date: Sat 03 Aug 2013 10:48:33 PM MDT
#encoding utf-8
#
# ATMEGA168A-P
@@ -108,6 +108,22 @@ X P7 7 -350 -300 250 R 50 50 1 1 P I
ENDDRAW
ENDDEF
#
+# CRYSTAL
+#
+DEF CRYSTAL X 0 40 N N 1 F N
+F0 "X" 0 150 60 H V C CNN
+F1 "CRYSTAL" 0 -150 60 H V C CNN
+F2 "~" 0 0 60 H V C CNN
+F3 "~" 0 0 60 H V C CNN
+DRAW
+P 2 0 1 16 -100 100 -100 -100 N
+P 2 0 1 16 100 100 100 -100 N
+P 5 0 1 12 -50 50 50 50 50 -50 -50 -50 -50 50 f
+X 1 1 -300 0 200 R 40 40 1 1 P
+X 2 2 300 0 200 L 40 40 1 1 P
+ENDDRAW
+ENDDEF
+#
# GND
#
DEF ~GND #PWR 0 0 Y Y 1 F P
@@ -147,6 +163,26 @@ X K 2 200 0 150 L 40 40 1 1 P
ENDDRAW
ENDDEF
#
+# NPN
+#
+DEF NPN Q 0 0 Y Y 1 F N
+F0 "Q" 0 -150 50 H V R CNN
+F1 "NPN" 0 150 50 H V R CNN
+F2 "~" 0 0 60 H V C CNN
+F3 "~" 0 0 60 H V C CNN
+DRAW
+C 50 0 111 0 1 10 N
+P 2 0 1 0 0 0 100 100 N
+P 3 0 1 10 0 75 0 -75 0 -75 N
+P 3 0 1 0 50 -50 0 0 0 0 N
+P 3 0 1 0 90 -90 100 -100 100 -100 N
+P 5 0 1 0 90 -90 70 -30 30 -70 90 -90 90 -90 F
+X E 1 100 -200 100 U 40 40 1 1 P
+X B 2 -200 0 200 R 40 40 1 1 I
+X C 3 100 200 100 D 40 40 1 1 P
+ENDDRAW
+ENDDEF
+#
# PWR_FLAG
#
DEF PWR_FLAG #FLG 0 0 N N 1 F P
Oops, something went wrong.

0 comments on commit 4d09663

Please sign in to comment.