PS2SDK
PS2 Homebrew Libraries
Loading...
Searching...
No Matches
Packet2 library
+ Collaboration diagram for Packet2 library:

Modules

 Chain
 
 Types
 
 Utils
 
 VIF
 

Functions

packet2_tpacket2_create (u16 qwords, enum Packet2Type type, enum Packet2Mode mode, u8 tte)
 
packet2_tpacket2_create_from (qword_t *base, qword_t *next, u16 qwords, enum Packet2Type type, enum Packet2Mode mode, u8 tte)
 
void packet2_free (packet2_t *packet2)
 
void packet2_reset (packet2_t *packet2, u8 clear_mem)
 
static void packet2_update (packet2_t *packet2, qword_t *qw)
 
static void packet2_advance_next (packet2_t *packet2, u32 i)
 
static void packet2_add_u128 (packet2_t *packet2, const u128 val)
 
static void packet2_add_s64 (packet2_t *packet2, const s64 val)
 
static void packet2_add_2x_s64 (packet2_t *packet2, const s64 v1, const s64 v2)
 
static void packet2_add_s128 (packet2_t *packet2, const s128 val)
 
static void packet2_add_u64 (packet2_t *packet2, const u64 val)
 
static void packet2_add_u32 (packet2_t *packet2, const u32 val)
 
static void packet2_add_s32 (packet2_t *packet2, const s32 val)
 
static void packet2_add_float (packet2_t *packet2, const float val)
 
static void packet2_add_data (packet2_t *packet2, void *t_data, u32 t_size)
 
static void packet2_pad96 (packet2_t *packet2, const u32 val)
 
static void packet2_pad128 (packet2_t *packet2, const u32 val)
 
void packet2_print (packet2_t *packet2, u32 qw_count)
 
void packet2_print_qw_count (packet2_t *packet2)
 
void packet2_add (packet2_t *a, packet2_t *b)
 
static u32 packet2_get_qw_count (packet2_t *packet2)
 
static u8 packet2_doesnt_have_even_number_of_quads (packet2_t *packet2)
 
static u8 packet2_is_dma_tag_opened (packet2_t *packet2)
 
static u8 packet2_is_vif_code_opened (packet2_t *packet2)
 

Detailed Description

Successor of packet_t. Main goal of this library is to create simple API for packet management. Library is splitted into several parts:

Function Documentation

◆ packet2_create()

packet2_t * packet2_create ( u16  qwords,
enum Packet2Type  type,
enum Packet2Mode  mode,
u8  tte 
)

#include <ee/packet2/include/packet2.h>

Allocate new packet2.

Parameters
qwordsMaximum data size in qwords (128bit).
typeMemory mapping type.
modePacket mode. Normal or chain.
tteTag transfer enable. Used only for CHAIN mode! If >0 transfer tag is set during packet sending and add_dma_tag() (so also every open_tag()) will move buffer by DWORD, so remember to align memory!
Returns
Pointer to packet2 on success or NULL if memory allocation fail.

Definition at line 25 of file packet2.c.

References packet2_t::max_qwords_count, packet2_t::mode, packet2_t::next, P2_TYPE_UNCACHED, P2_TYPE_UNCACHED_ACCL, packet2_t::tag_opened_at, packet2_t::tte, packet2_t::type, and packet2_t::vif_code_opened_at.

◆ packet2_create_from()

packet2_t * packet2_create_from ( qword_t *  base,
qword_t *  next,
u16  qwords,
enum Packet2Type  type,
enum Packet2Mode  mode,
u8  tte 
)

#include <ee/packet2/include/packet2.h>

Create new packet2 with given data pointer.

Parameters
basePointer to base (start of buffer).
nextPointer to next (current position of buffer).
qwordsMaximum data size in qwords (128bit).
typeMemory mapping type.
modePacket mode. Normal or chain (so also vif/vu).
tteTag transfer enable. Used only for CHAIN mode! If >0 transfer tag is set during packet sending and add_dma_tag() (so also every open_tag()) will move buffer by DWORD, so remember to align memory!
Returns
Pointer to packet2 on success or NULL if memory allocation fail.

Definition at line 60 of file packet2.c.

References packet2_t::max_qwords_count, packet2_t::mode, packet2_t::next, P2_TYPE_UNCACHED, P2_TYPE_UNCACHED_ACCL, packet2_t::tte, and packet2_t::type.

◆ packet2_free()

void packet2_free ( packet2_t packet2)

#include <ee/packet2/include/packet2.h>

Free packet2 memory.

Parameters
packet2Pointer to packet2.

Definition at line 81 of file packet2.c.

◆ packet2_reset()

void packet2_reset ( packet2_t packet2,
u8  clear_mem 
)

#include <ee/packet2/include/packet2.h>

Reset packet. Move next pointer back to base pointer, Make all "openedAt" vars to NULL Do memset on data if required.

Parameters
packet2Pointer to packet.
clear_memIf >0, data is cleared via memset(). SLOW!

Definition at line 88 of file packet2.c.

References packet2_t::max_qwords_count, packet2_t::next, packet2_t::tag_opened_at, and packet2_t::vif_code_opened_at.

◆ packet2_update()

static void packet2_update ( packet2_t packet2,
qword_t *  qw 
)
inlinestatic

#include <ee/packet2/include/packet2.h>

Update current position of packet buffer. Useful with drawlib functions.

Definition at line 89 of file packet2.h.

References packet2_t::next.

◆ packet2_advance_next()

static void packet2_advance_next ( packet2_t packet2,
u32  i 
)
inlinestatic

#include <ee/packet2/include/packet2.h>

Move "next" pointer forward.

Definition at line 96 of file packet2.h.

References packet2_t::next.

Referenced by packet2_add_float(), packet2_add_s32(), packet2_add_s64(), packet2_add_u32(), packet2_add_u64(), and packet2_chain_add_dma_tag().

◆ packet2_add_u128()

static void packet2_add_u128 ( packet2_t packet2,
const u128  val 
)
inlinestatic

#include <ee/packet2/include/packet2.h>

Definition at line 101 of file packet2.h.

◆ packet2_add_s64()

static void packet2_add_s64 ( packet2_t packet2,
const s64  val 
)
inlinestatic

#include <ee/packet2/include/packet2.h>

Note
Alignment alert. Size of dword (1/2)

Definition at line 108 of file packet2.h.

References packet2_t::next, and packet2_advance_next().

◆ packet2_add_2x_s64()

static void packet2_add_2x_s64 ( packet2_t packet2,
const s64  v1,
const s64  v2 
)
inlinestatic

#include <ee/packet2/include/packet2.h>

Definition at line 114 of file packet2.h.

◆ packet2_add_s128()

static void packet2_add_s128 ( packet2_t packet2,
const s128  val 
)
inlinestatic

#include <ee/packet2/include/packet2.h>

Definition at line 120 of file packet2.h.

◆ packet2_add_u64()

static void packet2_add_u64 ( packet2_t packet2,
const u64  val 
)
inlinestatic

#include <ee/packet2/include/packet2.h>

Note
Alignment alert. Size of dword (1/2)

Definition at line 127 of file packet2.h.

References packet2_t::next, and packet2_advance_next().

◆ packet2_add_u32()

◆ packet2_add_s32()

static void packet2_add_s32 ( packet2_t packet2,
const s32  val 
)
inlinestatic

#include <ee/packet2/include/packet2.h>

Note
Alignment alert. Size of word (1/4)

Definition at line 141 of file packet2.h.

References packet2_t::next, and packet2_advance_next().

◆ packet2_add_float()

static void packet2_add_float ( packet2_t packet2,
const float  val 
)
inlinestatic

#include <ee/packet2/include/packet2.h>

Note
Alignment alert. Size of word (1/4)

Definition at line 148 of file packet2.h.

References packet2_t::next, and packet2_advance_next().

◆ packet2_add_data()

static void packet2_add_data ( packet2_t packet2,
void *  t_data,
u32  t_size 
)
inlinestatic

#include <ee/packet2/include/packet2.h>

Definition at line 154 of file packet2.h.

◆ packet2_pad96()

static void packet2_pad96 ( packet2_t packet2,
const u32  val 
)
inlinestatic

#include <ee/packet2/include/packet2.h>

Fill to align to 96bits

Definition at line 164 of file packet2.h.

References packet2_t::next, and packet2_add_u32().

Referenced by packet2_vif_pad96().

◆ packet2_pad128()

static void packet2_pad128 ( packet2_t packet2,
const u32  val 
)
inlinestatic

#include <ee/packet2/include/packet2.h>

Fill to align to 128bits

Definition at line 173 of file packet2.h.

References packet2_t::next, and packet2_add_u32().

Referenced by packet2_vif_pad128().

◆ packet2_print()

void packet2_print ( packet2_t packet2,
u32  qw_count 
)

#include <ee/packet2/include/packet2.h>

Print data of packet.

Parameters
packet2Pointer to packet.
clear_memCount of qwords, type 0 for all.

Definition at line 108 of file packet2.c.

References packet2_t::next.

◆ packet2_print_qw_count()

void packet2_print_qw_count ( packet2_t packet2)

#include <ee/packet2/include/packet2.h>

Print amount of qwords of packet.

Parameters
packet2Pointer to packet.

Definition at line 127 of file packet2.c.

References packet2_get_qw_count().

◆ packet2_add()

void packet2_add ( packet2_t a,
packet2_t b 
)

#include <ee/packet2/include/packet2.h>

Copy data from b packet into a packet with memcpy()

Definition at line 101 of file packet2.c.

References packet2_t::max_qwords_count, packet2_t::next, and packet2_get_qw_count().

◆ packet2_get_qw_count()

static u32 packet2_get_qw_count ( packet2_t packet2)
inlinestatic

#include <ee/packet2/include/packet2.h>

Returns count of added qwords into packet.

Definition at line 200 of file packet2.h.

References packet2_t::next.

Referenced by packet2_add(), and packet2_print_qw_count().

◆ packet2_doesnt_have_even_number_of_quads()

static u8 packet2_doesnt_have_even_number_of_quads ( packet2_t packet2)
inlinestatic

#include <ee/packet2/include/packet2.h>

True if packet doesnt have even number of quads.

Definition at line 203 of file packet2.h.

References packet2_t::next.

◆ packet2_is_dma_tag_opened()

static u8 packet2_is_dma_tag_opened ( packet2_t packet2)
inlinestatic

#include <ee/packet2/include/packet2.h>

True if dma tag is opened.

Definition at line 206 of file packet2.h.

References packet2_t::tag_opened_at.

◆ packet2_is_vif_code_opened()

static u8 packet2_is_vif_code_opened ( packet2_t packet2)
inlinestatic

#include <ee/packet2/include/packet2.h>

True if DIRECT/UNPACK is opened.

Definition at line 209 of file packet2.h.

References packet2_t::vif_code_opened_at.