initrdb.c 1.21 KB
#include "os.h"
#include "os_internal.h"
#include "rdb.h"
#include "R4300.h"

#ifndef _FINALROM
rdbPacket * __osRdb_IP6_Data;
u32    __osRdb_IP6_Size;
u32    __osRdb_IP6_Ct;
u32    __osRdb_IP6_CurWrite;
u32    __osRdb_IP6_CurSend;
#ifdef BBPLAYER
u32    __osRdb_IP6_Empty = 1;
#endif

void osInitRdb(u8 *sendBuf, u32 sendSize)
{
    u32         mask;

    sendSize /= 4;  /* convert the number of bytes to number of packets */
    if((u32)sendBuf & 0x00000003) /* not 4 byte aligned */
    {
	sendBuf = (char*)((u32)sendBuf & ~0x00000003) + 4;  /* round up to 4 byte alignment */
	sendSize--;                            /* decrement number of packets */
    }

    mask = __osDisableInt();

    __osRdb_IP6_Data = (rdbPacket*)sendBuf;
    __osRdb_IP6_Size = sendSize;
    __osRdb_IP6_Ct = 0;
    __osRdb_IP6_CurWrite = 0;
    __osRdb_IP6_CurSend = 0;
#ifdef BBPLAYER
    __osRdb_IP6_Empty = 1;
#endif
    
    __osRestoreInt(mask);
}

#ifdef BBPLAYER
/* Resets the Rdb protocol */
void osResetRdb()
{
    u32         mask;

    mask = __osDisableInt();
    __osRdb_IP6_Empty = 1;
    __osRdb_IP6_Ct = 0;
    __osRdb_IP6_CurWrite = 0;
    __osRdb_IP6_CurSend = 0;
    
    __osRestoreInt(mask);
}
#endif

#endif    /* #ifndef _FINALROM */