sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
main.h
Go to the documentation of this file.
1
5
6#ifndef MAIN_H
7#define MAIN_H
8
9#include <thbase.h>
10
11#ifdef BUILDING_SMAP_NETMAN
12#include <netman.h>
13#endif
14#ifdef BUILDING_SMAP_PS2IP
15#include <ps2ip.h>
16#endif
17#ifdef BUILDING_SMAP_NETDEV
18#include <netdev.h>
19#endif
20#ifdef BUILDING_SMAP_MODULAR
21#include <smap_modular.h>
22#endif
23
24#ifndef BUILDING_SMAP_NETDEV
25#define sceInetPrintf(...) printf(__VA_ARGS__)
26#endif
27
28#define DEBUG_PRINTF(args...) sceInetPrintf("SMAP: "args)
29
30#ifdef BUILDING_SMAP_NETDEV
31struct RuntimeStats_NetDev
32{
33 u32 m_RxErrorVarious[16];
34 u32 m_TxErrorVarious[16];
35 u32 m_Rx_Packets;
36 u32 m_Tx_Packets;
37 u32 m_Rx_Bytes;
38 u32 m_Tx_Bytes;
39 u32 m_Rx_Errors;
40 u32 m_Tx_Errors;
41 u32 m_Rx_Dropped;
42 u32 m_Tx_Dropped;
43 u32 m_Rx_Broadcast_Packets;
44 u32 m_Tx_Broadcast_Packets;
45 u32 m_Rx_Broadcast_Bytes;
46 u32 m_Tx_Broadcast_Bytes;
47 u32 m_Rx_Multicast_Packets;
48 u32 m_Tx_Multicast_Packets;
49 u32 m_Rx_Multicast_Bytes;
50 u32 m_Tx_Multicast_Bytes;
51 u32 m_Multicast;
52 u32 m_Collisions;
53 u32 m_Rx_Length_Er;
54 u32 m_Rx_Over_Er;
55 u32 m_Rx_Crc_Er;
56 u32 m_Rx_Frame_Er;
57 u32 m_Rx_Fifo_Er;
58 u32 m_Rx_Missed_Er;
59 u32 m_Tx_Aborted_Er;
60 u32 m_Tx_Carrier_Er;
61 u32 m_Tx_Fifo_Er;
62 u32 m_Tx_Heartbeat_Er;
63 u32 m_Tx_Window_Er;
64};
65#endif
66
67// This struct needs to be the exact same layout as struct NetManEthRuntimeStats!
69{
70 u32 RxDroppedFrameCount;
71 u32 RxErrorCount;
72 u16 RxFrameOverrunCount;
73 u16 RxFrameBadLengthCount;
74 u16 RxFrameBadFCSCount;
75 u16 RxFrameBadAlignmentCount;
76 u32 TxDroppedFrameCount;
77 u32 TxErrorCount;
78 u16 TxFrameLOSSCRCount;
79 u16 TxFrameEDEFERCount;
80 u16 TxFrameCollisionCount;
81 u16 TxFrameUnderrunCount;
82 u16 RxAllocFail;
83};
84
86{
87 volatile u8 *smap_regbase;
88 volatile u8 *emac3_regbase;
89 unsigned int TxBufferSpaceAvailable;
90 unsigned char NumPacketsInTx;
91 unsigned char TxBDIndex;
92 unsigned char TxDNVBDIndex;
93 unsigned char RxBDIndex;
94 void *packetToSend;
95 int Dev9IntrEventFlag;
96 int IntrHandlerThreadID;
97 unsigned char SmapDriverStarting; // SMAP driver is starting.
98 unsigned char SmapIsInitialized; // SMAP driver is initialized (software)
99 unsigned char NetDevStopFlag;
100 unsigned char EnableLinkCheckTimer;
101 unsigned char LinkStatus; // Ethernet link is initialized (hardware)
102 unsigned char LinkMode;
103 iop_sys_clock_t LinkCheckTimer;
104#ifdef SMAP_RX_PACKETS_POLLING_MODE
105 iop_sys_clock_t RxIntrPollingTimer;
106#endif
107 struct RuntimeStats RuntimeStats;
108#ifdef BUILDING_SMAP_NETDEV
109 struct RuntimeStats_NetDev RuntimeStats_NetDev;
110#endif
111#ifdef BUILDING_SMAP_NETMAN
112 int NetIFID;
113#endif
114#ifdef BUILDING_SMAP_NETDEV
115 sceInetDevOps_t m_devops;
116#endif
117#ifdef BUILDING_SMAP_MODULAR
118 const SmapModularHookTable_t *HookTable[1];
119#endif
120};
121
122/* Event flag bits */
123#define SMAP_EVENT_START 0x01
124#define SMAP_EVENT_STOP 0x02
125#define SMAP_EVENT_INTR 0x04
126#define SMAP_EVENT_XMIT 0x08
127#define SMAP_EVENT_LINK_CHECK 0x10
128
129/* Function prototypes */
130extern int DisplayBanner(void);
131extern int smap_init(int argc, char *argv[]);
132#ifdef BUILDING_SMAP_NETDEV
133extern int smap_deinit(void);
134#endif
135#ifdef BUILDING_SMAP_PS2IP
136extern int SMAPInitStart(void);
137#endif
138extern void SMAPXmit(void);
139extern int SMAPGetMACAddress(u8 *buffer);
140#ifdef BUILDING_SMAP_PS2IP
141extern void PS2IPLinkStateUp(void);
142extern void PS2IPLinkStateDown(void);
143
144extern void SMapLowLevelInput(struct pbuf *pBuf);
145extern int SMapTxPacketNext(void **payload);
146extern void SMapTxPacketDeQ(void);
147#endif
148
149/* Data prototypes */
150extern struct SmapDriverData SmapDriverData;
151
152#endif
Definition tcpip.h:234