Skip to content
Snippets Groups Projects
Commit e8ea1553 authored by Wesley W. Terpstra's avatar Wesley W. Terpstra
Browse files

Walk the cursors past useless records. Thus we can detect end of response!

Don't use 0 value flags. Just a recipe for confusion.
parent 334d86a1
No related merge requests found
......@@ -383,8 +383,8 @@ void eb_device_flush(eb_device_t devicep) {
/* Setup a response */
response->deadline = aux->time_cache + 5;
response->cycle = cyclep;
response->write_cursor = cycle->first;
response->status_cursor = needs_check ? cycle->first : EB_NULL;
response->write_cursor = eb_find_read(cycle->first);
response->status_cursor = needs_check ? eb_find_bus(cycle->first) : EB_NULL;
/* Claim response address */
response->address = aux->rba;
......
......@@ -170,8 +170,8 @@ void eb_cycle_read(eb_cycle_t cycle, eb_address_t address, eb_data_t* data) {
op->address = address;
op->read_destination = data;
if (data) op->flags = EB_OP_READ_PTR | EB_OP_BUS_SPACE;
else op->flags = EB_OP_READ_VAL | EB_OP_BUS_SPACE;
if (data) op->flags = EB_OP_READ_PTR;
else op->flags = EB_OP_READ_VAL;
}
void eb_cycle_read_config(eb_cycle_t cycle, eb_address_t address, eb_data_t* data) {
......@@ -191,7 +191,7 @@ void eb_cycle_write(eb_cycle_t cycle, eb_address_t address, eb_data_t data) {
op = eb_cycle_doop(cycle);
op->address = address;
op->write_value = data;
op->flags = EB_OP_WRITE | EB_OP_BUS_SPACE;
op->flags = EB_OP_WRITE;
}
void eb_cycle_write_config(eb_cycle_t cycle, eb_address_t address, eb_data_t data) {
......
......@@ -64,3 +64,23 @@ eb_data_t eb_operation_data(eb_operation_t opp) {
/* unreachable */
return 0;
}
eb_operation_t eb_find_bus(eb_operation_t opp) {
struct eb_operation* op;
for (; opp != EB_NULL; opp = op->next) {
op = EB_OPERATION(opp);
if ((op->flags & EB_OP_CFG_SPACE) == 0) break;
}
return opp;
}
eb_operation_t eb_find_read(eb_operation_t opp) {
struct eb_operation* op;
for (; opp != EB_NULL; opp = op->next) {
op = EB_OPERATION(opp);
if ((op->flags & EB_OP_MASK) != EB_OP_WRITE) break;
}
return opp;
}
......@@ -38,11 +38,8 @@ typedef uint8_t eb_operation_flags_t;
#define EB_OP_MASK 0x03
#define EB_OP_CFG_SPACE 0x04
#define EB_OP_BUS_SPACE 0x00
#define EB_OP_ERROR 0x08
#define EB_OP_OK 0x00
#define EB_OP_CHECKED 0x10
#define EB_OP_SILENT 0x00
struct eb_operation {
eb_address_t address;
......@@ -56,4 +53,7 @@ struct eb_operation {
eb_operation_t next;
};
eb_operation_t eb_find_bus(eb_operation_t op);
eb_operation_t eb_find_read(eb_operation_t op);
#endif
......@@ -69,13 +69,13 @@ void eb_socket_write_config(eb_socket_t socketp, eb_width_t widths, eb_address_t
operation = EB_OPERATION(response->write_cursor);
if ((operation->flags & EB_OP_READ_PTR) != 0) {
if ((operation->flags & EB_OP_MASK) == EB_OP_READ_PTR) {
*operation->read_destination = value;
} else {
operation->read_value = value;
}
response->write_cursor = operation->next;
response->write_cursor = eb_find_read(operation->next);
}
} else {
/* An error status update */
......@@ -88,7 +88,7 @@ void eb_socket_write_config(eb_socket_t socketp, eb_width_t widths, eb_address_t
ops = 0;
for (operationp = response->status_cursor; operationp != EB_NULL; operationp = operation->next) {
operation = EB_OPERATION(operationp);
if ((operation->flags & EB_OP_CFG_SPACE) != 0) continue;
if ((operation->flags & EB_OP_CFG_SPACE) != 0) continue; /* skip config ops */
if (++ops == maxops) break;
}
......@@ -103,11 +103,7 @@ void eb_socket_write_config(eb_socket_t socketp, eb_width_t widths, eb_address_t
}
/* Update the cursor... skipping cfg space operations */
for (; operationp != EB_NULL; operationp = operation->next) {
operation = EB_OPERATION(operationp);
if ((operation->flags & EB_OP_CFG_SPACE) != 0) break;
}
response->status_cursor = operationp;
response->status_cursor = eb_find_bus(operationp);
}
/* Check for response completion */
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment