Skip to content
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

Implementation of SPEED UART driver #596

Merged
merged 2 commits into from
Apr 18, 2024
Merged
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
1 change: 1 addition & 0 deletions iop/network/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ SUBDIRS = \
smap-none \
smap-ps2ip \
smbman \
spduart \
udptty

include $(PS2SDKSRC)/Defs.make
Expand Down
15 changes: 15 additions & 0 deletions iop/network/spduart/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.

IOP_INCS += -I$(PS2SDKSRC)/iop/dev9/dev9/include
IOP_OBJS = spduart.o imports.o exports.o

include $(PS2SDKSRC)/Defs.make
include $(PS2SDKSRC)/iop/Rules.bin.make
include $(PS2SDKSRC)/iop/Rules.make
include $(PS2SDKSRC)/iop/Rules.release
55 changes: 55 additions & 0 deletions iop/network/spduart/include/modem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
*/

/**
* @file
* Modem interface.
* Intended for network stacks (PPP) to implement.
*/

#ifndef __MODEM_H__
#define __MODEM_H__

#include <types.h>
#include <irx.h>

typedef struct sceModemOps
{
struct sceModemOps *forw;
struct sceModemOps *back;
char *module_name;
char *vendor_name;
char *device_name;
u8 bus_type;
u8 bus_loc[31];
u16 prot_ver;
u16 impl_ver;
void *priv;
int evfid;
int rcv_len;
int snd_len;
int (*start)(void *priv, int flags);
int (*stop)(void *priv, int flags);
int (*recv)(void *priv, void *ptr, int len);
int (*send)(void *priv, void *ptr, int len);
int (*control)(void *priv, int code, void *ptr, int len);
void *reserved[4];
} sceModemOps_t;

extern int sceModemRegisterDevice(sceModemOps_t *ops);
extern int sceModemUnregisterDevice(sceModemOps_t *ops);

#define modem_IMPORTS_start DECLARE_IMPORT_TABLE(modem, 1, 1)
#define modem_IMPORTS_end END_IMPORT_TABLE

#define I_sceModemRegisterDevice DECLARE_IMPORT(4, sceModemRegisterDevice)
#define I_sceModemUnregisterDevice DECLARE_IMPORT(5, sceModemUnregisterDevice)

#endif
9 changes: 9 additions & 0 deletions iop/network/spduart/src/exports.tab
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

DECLARE_EXPORT_TABLE(spduart, 1, 1)
DECLARE_EXPORT(_start)
DECLARE_EXPORT(_retonly)
DECLARE_EXPORT(spduart_2_deinit)
DECLARE_EXPORT(_retonly)
END_EXPORT_TABLE

void _retonly() {}
66 changes: 66 additions & 0 deletions iop/network/spduart/src/imports.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@

modem_IMPORTS_start
I_sceModemRegisterDevice
I_sceModemUnregisterDevice
modem_IMPORTS_end

dev9_IMPORTS_start
I_dev9RegisterIntrCb
I_dev9IntrEnable
I_dev9IntrDisable
I_dev9RegisterShutdownCb
dev9_IMPORTS_end

intrman_IMPORTS_start
I_CpuSuspendIntr
I_CpuResumeIntr
intrman_IMPORTS_end

loadcore_IMPORTS_start
I_RegisterLibraryEntries
I_ReleaseLibraryEntries
loadcore_IMPORTS_end

stdio_IMPORTS_start
I_printf
stdio_IMPORTS_end

sysclib_IMPORTS_start
I_look_ctype_table
I_bcopy
I_bzero
I_sprintf
I_strcmp
I_strcpy
I_strlen
I_strncmp
I_strtol
I_memset
sysclib_IMPORTS_end

thbase_IMPORTS_start
I_CreateThread
I_DeleteThread
I_StartThread
I_TerminateThread
I_ChangeThreadPriority
I_SleepThread
I_DelayThread
I_SetAlarm
I_CancelAlarm
I_USec2SysClock
thbase_IMPORTS_end

thevent_IMPORTS_start
I_CreateEventFlag
I_DeleteEventFlag
I_SetEventFlag
I_iSetEventFlag
I_WaitEventFlag
thevent_IMPORTS_end

ioman_IMPORTS_start
I_open
I_close
I_read
ioman_IMPORTS_end
27 changes: 27 additions & 0 deletions iop/network/spduart/src/irx_imports.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
*/

#ifndef IOP_IRX_IMPORTS_H
#define IOP_IRX_IMPORTS_H

#include "irx.h"

/* Please keep these in alphabetical order! */
#include <dev9.h>
#include <intrman.h>
#include <ioman.h>
#include <loadcore.h>
#include <modem.h>
#include <stdio.h>
#include <sysclib.h>
#include <thbase.h>
#include <thevent.h>

#endif /* IOP_IRX_IMPORTS_H */
Loading