PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
main.h
1
2#ifndef MAIN_H
3#define MAIN_H
4
5#include <thbase.h>
6
7#ifdef BUILDING_SMAP_NETMAN
8#include <netman.h>
9#endif
10#ifdef BUILDING_SMAP_PS2IP
11#include <ps2ip.h>
12#endif
13#ifdef BUILDING_SMAP_MODULAR
14#include <smap_modular.h>
15#endif
16
17// In the SONY original, all the calls to DEBUG_PRINTF() were to sceInetPrintf().
18#define DEBUG_PRINTF(args...) printf("SMAP: "args)
19
20// This struct needs to be the exact same layout as struct NetManEthRuntimeStats!
22{
23 u32 RxDroppedFrameCount;
24 u32 RxErrorCount;
25 u16 RxFrameOverrunCount;
26 u16 RxFrameBadLengthCount;
27 u16 RxFrameBadFCSCount;
28 u16 RxFrameBadAlignmentCount;
29 u32 TxDroppedFrameCount;
30 u32 TxErrorCount;
31 u16 TxFrameLOSSCRCount;
32 u16 TxFrameEDEFERCount;
33 u16 TxFrameCollisionCount;
34 u16 TxFrameUnderrunCount;
35 u16 RxAllocFail;
36};
37
39{
40 volatile u8 *smap_regbase;
41 volatile u8 *emac3_regbase;
42 unsigned int TxBufferSpaceAvailable;
43 unsigned char NumPacketsInTx;
44 unsigned char TxBDIndex;
45 unsigned char TxDNVBDIndex;
46 unsigned char RxBDIndex;
47 void *packetToSend;
48 int Dev9IntrEventFlag;
49 int IntrHandlerThreadID;
50 unsigned char SmapDriverStarted; // SMAP driver is started.
51 unsigned char SmapIsInitialized; // SMAP driver is initialized (software)
52 unsigned char NetDevStopFlag;
53 unsigned char EnableLinkCheckTimer;
54 unsigned char LinkStatus; // Ethernet link is initialized (hardware)
55 unsigned char LinkMode;
56 iop_sys_clock_t LinkCheckTimer;
57#ifdef SMAP_RX_PACKETS_POLLING_MODE
58 iop_sys_clock_t RxIntrPollingTimer;
59#endif
61#ifdef BUILDING_SMAP_NETMAN
62 int NetIFID;
63#endif
64#ifdef BUILDING_SMAP_MODULAR
65 const SmapModularHookTable_t *HookTable[1];
66#endif
67};
68
69/* Event flag bits */
70#define SMAP_EVENT_START 0x01
71#define SMAP_EVENT_STOP 0x02
72#define SMAP_EVENT_INTR 0x04
73#define SMAP_EVENT_XMIT 0x08
74#define SMAP_EVENT_LINK_CHECK 0x10
75
76/* Function prototypes */
77extern int DisplayBanner(void);
78extern int smap_init(int argc, char *argv[]);
79#ifdef BUILDING_SMAP_PS2IP
80extern int SMAPInitStart(void);
81#endif
82extern int SMAPStart(void);
83extern void SMAPStop(void);
84extern void SMAPXmit(void);
85extern int SMAPGetMACAddress(u8 *buffer);
86#ifdef BUILDING_SMAP_PS2IP
87extern void PS2IPLinkStateUp(void);
88extern void PS2IPLinkStateDown(void);
89
90extern void SMapLowLevelInput(struct pbuf *pBuf);
91extern int SMapTxPacketNext(void **payload);
92extern void SMapTxPacketDeQ(void);
93#endif
94
95/* Data prototypes */
96extern struct SmapDriverData SmapDriverData;
97
98#endif
Definition tcpip.h:200