Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions python/sim_server
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ def run_simulation(conn):
length, = struct.unpack('I', read(conn, 4))
data = read(conn, length * 4)
sim_registers.write_table(block, num, reg, data)
conn.sendall(struct.pack('I', 0))
elif command == b'Q':
conn.sendall(struct.pack('I', 0))
elif command == b'D':
# Retrieve increment of data stream
length, = struct.unpack('I', read(conn, 4))
Expand Down
2 changes: 1 addition & 1 deletion server/base64.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "base64.h"

/* Encoding lookup table. */
static const char encode[64] =
static const char encode[64] __attribute__((nonstring)) =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

/* Decode lookup table, setup during initialisation. */
Expand Down
29 changes: 17 additions & 12 deletions server/hardware.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,26 @@ static error__t hw_long_table_write(
};
return TEST_IO(ioctl(block_id, PANDA_BLOCK_SEND, &request));
}

static size_t hw_long_table_get_queued_words(int block_id)
{
size_t result = 0;
ioctl(block_id, PANDA_BLOCK_NWORDS, &result);
return result;
}
#endif


size_t hw_table_get_queued_words(struct hw_table *table, unsigned int number)
{
if (table->table_type == LONG_TABLE)
return hw_long_table_get_queued_words(
table->long_table.block_ids[number]);
else
return 0;
}


static error__t create_long_table(
struct hw_table *table, unsigned int order, unsigned int nbuffers,
size_t *block_length, unsigned int base_reg, unsigned int length_reg)
Expand Down Expand Up @@ -651,18 +668,6 @@ void hw_close_table(struct hw_table *table)
}


size_t hw_get_queued_words(struct hw_table *table, unsigned int number)
{
if (table->table_type == LONG_TABLE)
{
size_t result = 0;
ioctl(table->long_table.block_ids[number], PANDA_BLOCK_NWORDS, &result);
return result;
}
return 0;
}


/******************************************************************************/


Expand Down
2 changes: 1 addition & 1 deletion server/hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void hw_close_table(struct hw_table *table);

/* Returns the number of 4-byte words scheduled, it's valid for long tables
* only, otherwise 0 */
size_t hw_get_queued_words(struct hw_table *table, unsigned int number);
size_t hw_table_get_queued_words(struct hw_table *table, unsigned int number);

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* Streamed data capture. */
Expand Down
24 changes: 21 additions & 3 deletions server/sim_hardware.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,30 @@ error__t hw_long_table_write(

memcpy(block->data, data, nbytes);
ASSERT_OK(length == (uint32_t) length);
uint32_t length_with_flag = (uint32_t) length;
if (streaming_mode && !last_table)
length_with_flag |= 0x80000000;
uint32_t result = 0;
WITH_MUTEX(mutex)
handle_error(
write_command_int('T',
block->block_base, block->number, 0, (uint32_t) length) ?:
write_all(block->data, nbytes));
return ERROR_OK;
block->block_base, block->number, 0, length_with_flag) ?:
write_all(block->data, nbytes) ?:
read_all(&result, 4));
return TEST_OK_(result == 0, "Long table write failed");
}


size_t hw_long_table_get_queued_words(int block_id)
{
ASSERT_OK(0 <= block_id && block_id < (int) block_id_count);
struct table_block *block = &block_id_table[block_id];
uint32_t result = 0;
WITH_MUTEX(mutex)
handle_error(
write_command('Q', block->block_base, block->number, 0) ?:
read_all(&result, 4));
return (size_t) result;
}


Expand Down
2 changes: 2 additions & 0 deletions server/sim_hardware.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ void hw_long_table_release(int block_id, void *data);
error__t hw_long_table_write(
int block_id, const void *data, size_t length, bool streaming_mode,
bool last_table);

size_t hw_long_table_get_queued_words(int block_id);
3 changes: 2 additions & 1 deletion server/table.c
Original file line number Diff line number Diff line change
Expand Up @@ -721,9 +721,10 @@ static error__t table_queued_lines_format(
char result[], size_t length)
{
struct table_state *state = class_data;
size_t queued_words = hw_table_get_queued_words(state->table, number);
return format_string(
result, length, "%zu",
hw_get_queued_words(state->table, number) / state->field_set.row_words);
queued_words / state->field_set.row_words);
}


Expand Down
Loading