Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Jake Read
atkrouter
Commits
62a8ce29
Commit
62a8ce29
authored
May 18, 2018
by
Jake Read
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
router feels solid
parent
db68f1c0
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
47 additions
and
48 deletions
+47
-48
embedded/mkrouter-v06/.vs/mkrouter-v06/v14/.atsuo
embedded/mkrouter-v06/.vs/mkrouter-v06/v14/.atsuo
+0
-0
embedded/mkrouter-v06/mkrouter-v06/Debug/Makefile
embedded/mkrouter-v06/mkrouter-v06/Debug/Makefile
+0
-7
embedded/mkrouter-v06/mkrouter-v06/Debug/makedep.mk
embedded/mkrouter-v06/mkrouter-v06/Debug/makedep.mk
+0
-2
embedded/mkrouter-v06/mkrouter-v06/apahandler.c
embedded/mkrouter-v06/mkrouter-v06/apahandler.c
+3
-0
embedded/mkrouter-v06/mkrouter-v06/apahandler.h
embedded/mkrouter-v06/mkrouter-v06/apahandler.h
+0
-24
embedded/mkrouter-v06/mkrouter-v06/apaport.c
embedded/mkrouter-v06/mkrouter-v06/apaport.c
+3
-1
embedded/mkrouter-v06/mkrouter-v06/apaport.h
embedded/mkrouter-v06/mkrouter-v06/apaport.h
+0
-1
embedded/mkrouter-v06/mkrouter-v06/hardware.h
embedded/mkrouter-v06/mkrouter-v06/hardware.h
+2
-0
embedded/mkrouter-v06/mkrouter-v06/mkrouter-v06.cproj
embedded/mkrouter-v06/mkrouter-v06/mkrouter-v06.cproj
+0
-6
embedded/mkrouter-v06/mkrouter-v06/sam_ba_monitor.c
embedded/mkrouter-v06/mkrouter-v06/sam_ba_monitor.c
+39
-7
No files found.
embedded/mkrouter-v06/.vs/mkrouter-v06/v14/.atsuo
View file @
62a8ce29
No preview for this file type
embedded/mkrouter-v06/mkrouter-v06/Debug/Makefile
View file @
62a8ce29
...
...
@@ -38,7 +38,6 @@ SUBDIRS := \
# Add inputs and outputs from these tool invocations to the build variables
C_SRCS
+=
\
../apahandler.c
\
../apaport.c
\
../board_driver_serial.c
\
../board_driver_usb.c
\
...
...
@@ -62,7 +61,6 @@ ASM_SRCS +=
OBJS
+=
\
apahandler.o
\
apaport.o
\
board_driver_serial.o
\
board_driver_usb.o
\
...
...
@@ -79,7 +77,6 @@ sam_ba_usb.o \
uartport.o
OBJS_AS_ARGS
+=
\
apahandler.o
\
apaport.o
\
board_driver_serial.o
\
board_driver_usb.o
\
...
...
@@ -96,7 +93,6 @@ sam_ba_usb.o \
uartport.o
C_DEPS
+=
\
apahandler.d
\
apaport.d
\
board_driver_serial.d
\
board_driver_usb.d
\
...
...
@@ -113,7 +109,6 @@ sam_ba_usb.d \
uartport.d
C_DEPS_AS_ARGS
+=
\
apahandler.d
\
apaport.d
\
board_driver_serial.d
\
board_driver_usb.d
\
...
...
@@ -171,8 +166,6 @@ LINKER_SCRIPT_DEP+= \
...
...
embedded/mkrouter-v06/mkrouter-v06/Debug/makedep.mk
View file @
62a8ce29
...
...
@@ -2,8 +2,6 @@
# Automatically-generated file. Do not edit or delete the file
################################################################################
apahandler.c
apaport.c
board_driver_serial.c
...
...
embedded/mkrouter-v06/mkrouter-v06/apahandler.c
View file @
62a8ce29
...
...
@@ -11,7 +11,10 @@
void
apa_handle_packet
(
uint8_t
*
packet
,
uint8_t
length
){
// dirty debug reply
//sam_ba_port_put_data(packet, packet[0]);
// through packet
int
i
=
0
;
int
apa_handler_state
=
APA_HANDLER_OUTSIDE
;
...
...
embedded/mkrouter-v06/mkrouter-v06/apahandler.h
deleted
100644 → 0
View file @
db68f1c0
/*
* apahandler.h
*
* Created: 3/12/2018 11:55:40 AM
* Author: Jake
*/
#ifndef APAHANDLER_H_
#define APAHANDLER_H_
#include "sam.h"
#define APA_HANDLER_OUTSIDE 0
#define APA_HANDLER_INSIDE 1
#define DELIM_KEY_TEST 127 // toggles a light, to test network
#define DELIM_KEY_STEPS 128 // steps (steps) uint32_t, speed (steps/s) uint32_t, dir uint8_t
#define DELIM_KEY_BLOCK 129 // is 32 bit int
void
apa_handle_packet
(
uint8_t
*
packet
,
uint8_t
length
);
void
apa_return_packet
(
uint8_t
*
packet
,
uint8_t
length
);
#endif
/* APAHANDLER_H_ */
\ No newline at end of file
embedded/mkrouter-v06/mkrouter-v06/apaport.c
View file @
62a8ce29
...
...
@@ -64,7 +64,9 @@ void apaport_scan(apaport_t *apap, uint32_t maxpackets){
// now to handle
// [p][0] is length of packet
if
(
apap
->
packets
[
p
][
1
]
==
APA_ROUTE_POINTER
){
apa_handle_packet
(
apap
->
packets
[
p
],
apap
->
packets
[
p
][
0
]);
pin_set
(
&
stlPacket
);
sam_ba_port_put_data
(
apap
->
packets
[
p
],
apap
->
packets
[
p
][
0
]);
//apa_handle_packet(apap->packets[p], apap->packets[p][0]);
}
else
if
(
apap
->
packets
[
p
][
1
]
==
APA_ROUTE_FLOOD
){
// loop through bytes to find pointer and increment
// now ship it out on all ports
...
...
embedded/mkrouter-v06/mkrouter-v06/apaport.h
View file @
62a8ce29
...
...
@@ -9,7 +9,6 @@
#ifndef APAPORT_H_
#define APAPORT_H_
#include "apahandler.h"
#include "uartport.h"
#include "pin.h"
...
...
embedded/mkrouter-v06/mkrouter-v06/hardware.h
View file @
62a8ce29
...
...
@@ -16,6 +16,8 @@
#include "uartport.h"
#include "apaport.h"
#include "sam_ba_monitor.h"
// For if-case init
#define HARDWARE_IS_APBA 0
...
...
embedded/mkrouter-v06/mkrouter-v06/mkrouter-v06.cproj
View file @
62a8ce29
...
...
@@ -159,12 +159,6 @@
</ToolchainSettings>
</PropertyGroup>
<ItemGroup>
<Compile
Include=
"apahandler.c"
>
<SubType>
compile
</SubType>
</Compile>
<Compile
Include=
"apahandler.h"
>
<SubType>
compile
</SubType>
</Compile>
<Compile
Include=
"apaport.c"
>
<SubType>
compile
</SubType>
</Compile>
...
...
embedded/mkrouter-v06/mkrouter-v06/sam_ba_monitor.c
View file @
62a8ce29
...
...
@@ -273,26 +273,58 @@ static void put_uint32(uint32_t n)
}
uint32_t
tick
=
0
;
uint8_t
data_out
[
3
]
=
{
12
,
48
,
64
};
uint8_t
data_out
[
3
]
=
{
12
,
48
,
64
};
#define APA_CDC_NUM_STATIC_PACKETS 6
uint8_t
packCDC
[
APA_CDC_NUM_STATIC_PACKETS
][
256
];
// static memory buffer for packets
uint8_t
packCDC_num
=
0
;
uint8_t
packCDC_position
=
0
;
uint8_t
packCDC_readyNum
=
0
;
static
void
sam_ba_monitor_loop
(
void
)
{
// get bytes, handle..
length
=
sam_ba_getdata
(
ptr_monitor_if
,
data
,
SIZEBUFMAX
);
pin_clear
(
&
stlPacket
);
// this should be better: but before we send we have to make sure COM is open, else port locked
if
(
length
>
0
&&
!
usbComOpen
){
usbComOpen
=
1
;
pin_clear
(
&
stlUsb
);
uint8_t
hello
[
2
]
=
{
0
,
0
};
sam_ba_putdata
(
ptr_monitor_if
,
&
hello
,
2
);
return
;
}
// chunk packets into packCDC
if
(
length
>
0
&&
usbComOpen
){
pin_clear
(
&
stlPacket
);
for
(
int
i
=
0
;
i
<
length
;
i
++
){
packCDC
[
packCDC_num
][
packCDC_position
]
=
data
[
i
];
packCDC_position
++
;
if
(
packCDC_position
>=
packCDC
[
packCDC_num
][
0
]){
packCDC_num
=
(
packCDC_num
+
1
)
%
APA_CDC_NUM_STATIC_PACKETS
;
packCDC_readyNum
++
;
packCDC_position
=
0
;
}
}
}
// reply
sam_ba_putdata
(
ptr_monitor_if
,
data
,
length
);
// handle all of the ready packets
while
(
packCDC_readyNum
>
0
){
uint8_t
p
=
(
packCDC_num
+
APA_CDC_NUM_STATIC_PACKETS
-
packCDC_readyNum
)
%
APA_CDC_NUM_STATIC_PACKETS
;
// we're going to forward them all, 1st byte is port out
uint8_t
port
=
packCDC
[
p
][
1
];
if
(
port
>
NUM_UPS
){
port
=
NUM_UPS
-
1
;
// if overrun, go on last port
}
uart_sendchars_buffered
(
ups
[
port
],
packCDC
[
p
],
packCDC
[
p
][
0
]);
packCDC_readyNum
--
;
}
// reply USB direct to debug if USB coming thru
// sam_ba_putdata(ptr_monitor_if, data, length);
// have to implement APA code here? and watch for multipackets?
for
(
int
i
=
0
;
i
<
length
;
i
++
,
ptr
++
){
// apa
}
pin_set
(
&
stlPacket
);
// dirt nasty heartbeat
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment