Skip to content

Initial attempt at serial port support. #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ message("that you are resting well.")
message(" -- Your friend, Stephanie")
message("******************************")

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_definitions(EMU_DEBUG=1)
endif()

# Main project sources
add_subdirectory(src)

Expand Down
1 change: 1 addition & 0 deletions include/dbvzRegisterAccessors.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ static void setUstcnt2(uint16_t value){

registerArrayWrite16(USTCNT2, value);
updateUart2Interrupt();
updateUart2PortState();
}

static void setTstat1(uint16_t value){
Expand Down
3 changes: 3 additions & 0 deletions include/dbvzTiming.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ static void dbvzEndClk32(void){
updateUart1Interrupt();
updateUart2Interrupt();

updateUart1PortState();
updateUart2PortState();

checkInterrupts();
}

Expand Down
8 changes: 6 additions & 2 deletions include/emulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ enum{
};

//types
typedef struct{
typedef struct {
bool enable;
bool enableParity;
bool oddParity;
Expand Down Expand Up @@ -215,7 +215,11 @@ extern void (*palmSerialDataFlush)(void);//called by the emulator to delete
extern void (*palmGetRtcFromHost)(uint8_t* writeBack);//[0] = hours, [1] = minutes, [2] = seconds

//functions
uint32_t emulatorInit(uint8_t emulatedDevice, uint8_t* palmRomData, uint32_t palmRomSize, uint8_t* palmBootloaderData, uint32_t palmBootloaderSize, bool syncRtc, bool allowInvalidBehavior);
uint32_t emulatorInit(uint8_t emulatedDevice, uint8_t *palmRomData,
uint32_t palmRomSize, uint8_t *palmBootloaderData,
uint32_t palmBootloaderSize, bool syncRtc,
bool allowInvalidBehavior, const char *serialPortDev);

void emulatorDeinit(void);
void emulatorHardReset(void);
void emulatorSoftReset(void);
Expand Down
18 changes: 18 additions & 0 deletions include/serial.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// Created by stephanie on 6/14/24.
//

#ifndef MU_SERIAL_H
#define MU_SERIAL_H

#include "emulator.h"

/**
* Opens and initializes the serial port.
*
* @param path The path of the serial port.
* @since 2024/06/14
*/
void mu_serial_open_and_init(const char* path);

#endif // MU_SERIAL_H
4 changes: 4 additions & 0 deletions libretroBuildSystem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ add_library(mu_libretro SHARED
# Remove the "lib" prefix always, RetroArch does not name in this way
set_target_properties(mu_libretro PROPERTIES PREFIX "")

# Define these
target_compile_definitions(mu_libretro PUBLIC
__LIBRETRO__=1)

# Bring all the sub-modules as needed
target_link_libraries(mu_libretro
MuCore)
Expand Down
Loading