Skip to content

Commit

Permalink
Removing cursed assembly from LinkSPI, as it wasn't needed - Fixes #18
Browse files Browse the repository at this point in the history
  • Loading branch information
afska committed Feb 7, 2024
1 parent 8ad0435 commit b8540e7
Show file tree
Hide file tree
Showing 21 changed files with 25 additions and 39 deletions.
2 changes: 1 addition & 1 deletion examples/LinkCableMultiboot_demo/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ int main() {
// Sender options
if (isSenderMode) {
if (result != LinkCableMultiboot::Result::SUCCESS)
log("LinkCableMultiboot_demo\n (v6.2.0)\n\nPress START to send the "
log("LinkCableMultiboot_demo\n (v6.2.1)\n\nPress START to send the "
"ROM...\nPress B to set client mode...");

if (keys & KEY_START) {
Expand Down
2 changes: 1 addition & 1 deletion examples/LinkCable_basic/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ int main() {
u16 keys = ~REG_KEYS & KEY_ANY;
linkCable->send(keys + 1); // (avoid using 0)

std::string output = "LinkCable_basic (v6.2.0)\n\n";
std::string output = "LinkCable_basic (v6.2.1)\n\n";
if (linkCable->isConnected()) {
u8 playerCount = linkCable->playerCount();
u8 currentPlayerId = linkCable->currentPlayerId();
Expand Down
4 changes: 2 additions & 2 deletions examples/LinkCable_full/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ inline void setUpInterrupts() {

void printTutorial() {
#ifndef USE_LINK_UNIVERSAL
DEBULOG("LinkCable_full (v6.2.0)");
DEBULOG("LinkCable_full (v6.2.1)");
#endif
#ifdef USE_LINK_UNIVERSAL
DEBULOG("LinkUniversal_full (v6.2.0)");
DEBULOG("LinkUniversal_full (v6.2.1)");
#endif

DEBULOG("");
Expand Down
4 changes: 2 additions & 2 deletions examples/LinkCable_stress/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ int main() {

while (true) {
#ifndef USE_LINK_UNIVERSAL
std::string output = "LinkCable_stress (v6.2.0)\n\n";
std::string output = "LinkCable_stress (v6.2.1)\n\n";
#endif
#ifdef USE_LINK_UNIVERSAL
std::string output = "LinkUniversal_stress (v6.2.0)\n\n";
std::string output = "LinkUniversal_stress (v6.2.1)\n\n";
#endif

linkConnection->deactivate();
Expand Down
2 changes: 1 addition & 1 deletion examples/LinkGPIO_demo/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main() {

while (true) {
// (3) Use the pins
std::string output = "LinkGPIO_demo (v6.2.0)\n\n";
std::string output = "LinkGPIO_demo (v6.2.1)\n\n";

// Commands
u16 keys = ~REG_KEYS & KEY_ANY;
Expand Down
2 changes: 1 addition & 1 deletion examples/LinkRawCable_demo/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int main() {
u16 prevKeys = 0;

while (true) {
std::string output = "LinkRawCable_demo (v6.2.0)\n\n";
std::string output = "LinkRawCable_demo (v6.2.1)\n\n";
u16 keys = ~REG_KEYS & KEY_ANY;

if (!linkRawCable->isActive()) {
Expand Down
2 changes: 1 addition & 1 deletion examples/LinkRawWireless_demo/src/scenes/DebugScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void DebugScene::load() {

log("---");
log("LinkRawWireless demo");
log(" (v6.2.0)");
log(" (v6.2.1)");
log("");
log("START: reset wireless adapter");
log("A: send command");
Expand Down
2 changes: 1 addition & 1 deletion examples/LinkSPI_demo/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ int main() {
u32 counter = 0;

while (true) {
std::string output = "LinkSPI_demo (v6.2.0)\n\n";
std::string output = "LinkSPI_demo (v6.2.1)\n\n";
u16 keys = ~REG_KEYS & KEY_ANY;

if (!linkSPI->isActive()) {
Expand Down
2 changes: 1 addition & 1 deletion examples/LinkUniversal_basic/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void init() {
int main() {
init();

log("LinkUniversal_basic (v6.2.0)\n\n\nPress A to start\n\n\nhold LEFT on "
log("LinkUniversal_basic (v6.2.1)\n\n\nPress A to start\n\n\nhold LEFT on "
"start:\n -> force cable\n\nhold RIGHT on start:\n -> force "
"wireless\n\nhold UP on start:\n -> force wireless server\n\nhold DOWN "
"on start:\n -> force wireless client\n\nhold B on start:\n -> set 2 "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ void MultibootScene::load() {

log("---");
log("LinkWirelessMultiboot demo");
log(" (v6.2.0)");
log(" (v6.2.1)");
log("");
if (fs == NULL) {
log("! GBFS file not found");
Expand Down
2 changes: 1 addition & 1 deletion examples/LinkWireless_demo/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ int main() {

start:
// Options
log("LinkWireless_demo (v6.2.0)\n\n\n\nPress A to start\n\n\n\n\nhold LEFT "
log("LinkWireless_demo (v6.2.1)\n\n\n\nPress A to start\n\n\n\n\nhold LEFT "
"on start:\n -> disable forwarding\n\nhold UP on start:\n -> disable "
"retransmission\n\nhold B on start:\n -> set 2 players\n\nhold START on "
"start:\n -> async ACK");
Expand Down
2 changes: 1 addition & 1 deletion lib/LinkCable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
#define LINK_CABLE_BIT_GENERAL_PURPOSE_HIGH 15
#define LINK_CABLE_BARRIER asm volatile("" ::: "memory")

static volatile char LINK_CABLE_VERSION[] = "LinkCable/v6.2.0";
static volatile char LINK_CABLE_VERSION[] = "LinkCable/v6.2.1";

void LINK_CABLE_ISR_VBLANK();
void LINK_CABLE_ISR_SERIAL();
Expand Down
2 changes: 1 addition & 1 deletion lib/LinkCableMultiboot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
return error(FAILURE_DURING_HANDSHAKE);

static volatile char LINK_CABLE_MULTIBOOT_VERSION[] =
"LinkCableMultiboot/v6.2.0";
"LinkCableMultiboot/v6.2.1";

const u8 LINK_CABLE_MULTIBOOT_CLIENT_IDS[] = {0b0010, 0b0100, 0b1000};

Expand Down
2 changes: 1 addition & 1 deletion lib/LinkGPIO.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
else \
REG &= ~(1 << BIT);

static volatile char LINK_GPIO_VERSION[] = "LinkGPIO/v6.2.0";
static volatile char LINK_GPIO_VERSION[] = "LinkGPIO/v6.2.1";

const u8 LINK_GPIO_DATA_BITS[] = {2, 3, 1, 0};
const u8 LINK_GPIO_DIRECTION_BITS[] = {6, 7, 5, 4};
Expand Down
2 changes: 1 addition & 1 deletion lib/LinkRawCable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
} \
}

static volatile char LINK_RAW_CABLE_VERSION[] = "LinkRawCable/v6.2.0";
static volatile char LINK_RAW_CABLE_VERSION[] = "LinkRawCable/v6.2.1";

class LinkRawCable {
public:
Expand Down
2 changes: 1 addition & 1 deletion lib/LinkRawWireless.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
#define LINK_RAW_WIRELESS_COMMAND_WAIT 0x27
#define LINK_RAW_WIRELESS_COMMAND_BYE 0x3d

static volatile char LINK_RAW_WIRELESS_VERSION[] = "LinkRawWireless/v6.2.0";
static volatile char LINK_RAW_WIRELESS_VERSION[] = "LinkRawWireless/v6.2.1";

const u16 LINK_RAW_WIRELESS_LOGIN_PARTS[] = {
0x494e, 0x494e, 0x544e, 0x544e, 0x4e45, 0x4e45, 0x4f44, 0x4f44, 0x8001};
Expand Down
20 changes: 3 additions & 17 deletions lib/LinkSPI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
#define LINK_SPI_BIT_GENERAL_PURPOSE_LOW 14
#define LINK_SPI_BIT_GENERAL_PURPOSE_HIGH 15

static volatile char LINK_SPI_VERSION[] = "LinkSPI/v6.2.0";
static volatile char LINK_SPI_VERSION[] = "LinkSPI/v6.2.1";

const u32 LINK_SPI_MASK_CLEAR_SO_BIT = ~(1 << LINK_SPI_BIT_SO);
const u32 LINK_SPI_MASK_SET_START_BIT = (1 << LINK_SPI_BIT_START);
Expand Down Expand Up @@ -150,22 +150,8 @@ class LinkSPI {
return LINK_SPI_NO_DATA;
}

asm volatile(
// enableTransfer();
// startTransfer();
"MOV R2, %[reg_siocnt]\n\t" // Move &REG_SIOCNT to R2
"LDR R0, [R2]\n\t" // Load SIOCNT into R0
"LDR R1, %[clear_so_bit_mask]\n\t" // Load mask value to clear SO bit
"AND R0, R0, R1\n\t" // Clear SO bit
"STR R0, [R2]\n\t" // Store back to SIOCNT
"LDR R1, %[set_start_bit_mask]\n\t" // Load mask value to set START bit
"ORR R0, R0, R1\n\t" // Set START bit
"STR R0, [R2]\n\t" // Store back to SIOCNT
:
: [reg_siocnt] "r"(&REG_SIOCNT),
[clear_so_bit_mask] "m"(LINK_SPI_MASK_CLEAR_SO_BIT),
[set_start_bit_mask] "m"(LINK_SPI_MASK_SET_START_BIT)
: "r0", "r1", "r2");
enableTransfer();
startTransfer();

if (_async)
return LINK_SPI_NO_DATA;
Expand Down
2 changes: 1 addition & 1 deletion lib/LinkUniversal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
#define LINK_UNIVERSAL_SERVE_WAIT_FRAMES 60
#define LINK_UNIVERSAL_SERVE_WAIT_FRAMES_RANDOM 30

static volatile char LINK_UNIVERSAL_VERSION[] = "LinkUniversal/v6.2.0";
static volatile char LINK_UNIVERSAL_VERSION[] = "LinkUniversal/v6.2.1";

void LINK_UNIVERSAL_ISR_VBLANK();
void LINK_UNIVERSAL_ISR_SERIAL();
Expand Down
2 changes: 1 addition & 1 deletion lib/LinkWireless.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
if (!reset()) \
return false;

static volatile char LINK_WIRELESS_VERSION[] = "LinkWireless/v6.2.0";
static volatile char LINK_WIRELESS_VERSION[] = "LinkWireless/v6.2.1";

void LINK_WIRELESS_ISR_VBLANK();
void LINK_WIRELESS_ISR_SERIAL();
Expand Down
2 changes: 1 addition & 1 deletion lib/LinkWirelessMultiboot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const u8 LINK_WIRELESS_MULTIBOOT_ROM_HEADER_PATCH_OFFSET = 4;
const u8 LINK_WIRELESS_MULTIBOOT_ROM_HEADER_PATCH_SIZE = 12;

static volatile char LINK_WIRELESS_MULTIBOOT_VERSION[] =
"LinkWirelessMultiboot/v6.2.0";
"LinkWirelessMultiboot/v6.2.1";

class LinkWirelessMultiboot {
public:
Expand Down
2 changes: 1 addition & 1 deletion lib/LinkWirelessOpenSDK.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
LINK_WIRELESS_OPEN_SDK_HEADER_SIZE_CLIENT)

static volatile char LINK_WIRELESS_OPEN_SDK_VERSION[] =
"LinkWirelessOpenSDK/v6.2.0";
"LinkWirelessOpenSDK/v6.2.1";

class LinkWirelessOpenSDK {
public:
Expand Down

0 comments on commit b8540e7

Please sign in to comment.