Esempio n. 1
0
	void DataOutput::WriteFloat(float value)
	{
		union {
			uint32_t u;
			float v;
		} ptr;
		ptr.v = value;
		WriteU32(ptr.u);
	}
Esempio n. 2
0
void Info32(
    dw_client                   cli,
    uint_32                     value )
{
    char                        buf[ sizeof( uint_32 ) ];

    WriteU32( buf, value );
    CLIWrite( DW_DEBUG_INFO, &buf, sizeof( buf ) );
}
Esempio n. 3
0
void FiniDebugInfo(
    dw_client                   cli )
{
    char                        buf[ sizeof( uint_32 ) ];
    long                        size;

    /* patch in the length of the .debug_info section */
    size = CLITell( DW_DEBUG_INFO );
    size -= sizeof( uint_32 );
    size -= cli->section_base[ DW_DEBUG_INFO ];
    CLISeek( DW_DEBUG_INFO, cli->section_base[ DW_DEBUG_INFO ], DW_SEEK_SET );
    WriteU32( buf, size );
    CLIWrite( DW_DEBUG_INFO, buf, sizeof( uint_32 ) );
    CLISeek( DW_DEBUG_INFO, 0, DW_SEEK_END );
}
Esempio n. 4
0
STATIC void putUnsigned( type_rec *tr, uint_32 num ) {

    uint_8  *p;

    if( num < 0x80 ) {
        p = getTrData( tr, 1 );
        p[0] =   num & 0x000000ff;
    } else if( num < 0x10000 ) {
        p = getTrData( tr, 3 );
        p[0] = MS_BCL_UINT_16;
        WriteU16( p+1, num );
    } else {
        p = getTrData( tr, 5 );
        p[0] = MS_BCL_UINT_32;
        WriteU32( p+1, num );
    }
}
Esempio n. 5
0
void FiniDebugLine(
    dw_client                   cli )
{
    char                        buf[ sizeof( uint_32 ) ];
    long                        size;

    buf[ 0 ] = 0;
    buf[ 1 ] = 1;
    buf[ 2 ] = DW_LNE_end_sequence;
    CLIWrite( DW_DEBUG_LINE, buf, 3 );
    size = CLITell( DW_DEBUG_LINE ) - sizeof( uint_32 )
        - cli->section_base[ DW_DEBUG_LINE ];
    WriteU32( buf, size );
    CLISeek( DW_DEBUG_LINE, cli->section_base[ DW_DEBUG_LINE ], DW_SEEK_SET );
    CLIWrite( DW_DEBUG_LINE, buf, sizeof(uint_32) );
    CLISeek( DW_DEBUG_LINE, 0, DW_SEEK_END );
    FreeChain( cli, cli->debug_line.files );
}
Esempio n. 6
0
static void bus_simple_send(u32 adapterId, u32 desId,u8 functionId  ,u8 sessionId, u32 data_len, u8 *data)
{
	//BUS_LOG("simple func=%d ses=%d len=%d \r\n", functionId,sessionId,data_len);
	int frame_count = (data_len + 5) / 6;

	bus_os_pend_sem(&tx_mutex_sem, 0);
	for (int i = 0; i < frame_count + 1; i++)
	{
		bus_frame frame;
		frame.adapterId = adapterId;
		frame.desId = desId;
		frame.srcId = bus_local_id;
		frame.functionId = functionId;
		frame.sessionId = sessionId;
		WriteU16(frame.data, i);

		if (i == 0)
		{
			frame.data_len = 6;
			WriteU32(frame.data + 2, data_len);
		}
		else
		{
			int frame_data_len = (i == frame_count) ? ((data_len % 6) == 0 ? 6 : (data_len % 6)) : 6;
			frame.data_len = frame_data_len + 2;
			//把数据复制过去
			memmove(frame.data + 2, data + (i - 1) * 6, frame_data_len);
		}

		//查找网卡 发送数据
		for (bus_adapter *adp = adapterList; adp != NULL; adp = adp->next)
		{
			if (adp->adatperId == adapterId)
			{
				adp->adapter_send(adp,frame.desId, frame.functionId, frame.sessionId, 0, frame.data_len, frame.data);
			}
		}
	}
	bus_os_post_sem(&tx_mutex_sem);
}