Commit e098ecc8 authored by Wesley W. Terpstra's avatar Wesley W. Terpstra

build: eliminate warnings from -pedantic

parent a7b93d44
......@@ -156,7 +156,7 @@ enum sdb_record_type {
sdb_record_device = 0x01,
sdb_record_bridge = 0x02,
sdb_record_integration = 0x80,
sdb_record_empty = 0xFF,
sdb_record_empty = 0xFF
};
/* The type of bus (specifies bus-specific fields) */
......@@ -764,7 +764,7 @@ class Cycle {
public:
Cycle();
// Start a cycle on the target device.
/* Start a cycle on the target device. */
template <typename T>
EB_STATUS_OR_VOID_T open(Device device, T* user, eb_callback_t);
EB_STATUS_OR_VOID_T open(Device device);
......
......@@ -154,6 +154,7 @@ int eb_device_slave(eb_socket_t socketp, eb_transport_t transportp, eb_device_t
/* Is this a probe response? */
if ((buffer[2] & EB_HEADER_PR) != 0) { /* probe response */
eb_device_t devp;
eb_address_t tag;
struct eb_device* dev;
if (len != 8) goto kill; /* > 8: haven't sent requests, passive should not send data */
......@@ -161,7 +162,6 @@ int eb_device_slave(eb_socket_t socketp, eb_transport_t transportp, eb_device_t
if (passive) goto kill; /* passive link not responded! */
/* Find device by probe id */
eb_address_t tag;
tag = be32toh(*(uint32_t*)&buffer[4]);
for (devp = socket->first_device; devp != EB_NULL; devp = dev->next) {
......
......@@ -121,9 +121,11 @@ eb_status_t eb_device_open(eb_socket_t socketp, const char* address, eb_width_t
/* Try to determine port width */
device->widths = 0;
do {
uint8_t buf[8] = { 0x4E, 0x6F, 0x11, proposed_widths, 0x0, 0x0, 0x0, 0x0 };
uint8_t buf[8] = { 0x4E, 0x6F, 0x11, 0, 0x0, 0x0, 0x0, 0x0 };
int timeout, got;
buf[3] = proposed_widths;
link = EB_LINK(device->link);
transport = EB_TRANSPORT(device->transport);
......
......@@ -137,7 +137,7 @@ eb_status_t eb_socket_attach(eb_socket_t socketp, const struct eb_handler* handl
break;
} else {
scan_last = address->device->sdb_component.addr_last+1;
scan_last = (scan_last+7) & ~(eb_address_t)7; // align upwards to 8-bytes
scan_last = (scan_last+7) & ~(eb_address_t)7; /* align upwards to 8-bytes */
}
}
......
......@@ -176,20 +176,31 @@ eb_data_t eb_socket_read_config(eb_socket_t socketp, eb_width_t widths, eb_addre
struct eb_socket* socket;
struct eb_socket_aux* aux;
eb_address_t sdb;
eb_data_t out;
int len;
uint8_t buf[16];
socket = EB_SOCKET(socketp);
aux = EB_SOCKET_AUX(socket->aux);
sdb = aux->sdb_offset;
/* We only support reading from the error shift register and SDB so far */
eb_data_t out;
int len;
uint8_t buf[16] = {
error >> 56, error >> 48, error >> 40, error >> 32,
error >> 24, error >> 16, error >> 8, error >> 0,
sdb >> 56, sdb >> 48, sdb >> 40, sdb >> 32,
sdb >> 24, sdb >> 16, sdb >> 8, sdb >> 0,
};
buf[0x0] = error >> 56;
buf[0x1] = error >> 48;
buf[0x2] = error >> 40;
buf[0x3] = error >> 32;
buf[0x4] = error >> 24;
buf[0x5] = error >> 16;
buf[0x6] = error >> 8;
buf[0x7] = error >> 0;
buf[0x8] = sdb >> 56;
buf[0x9] = sdb >> 48;
buf[0xa] = sdb >> 40;
buf[0xb] = sdb >> 32;
buf[0xc] = sdb >> 24;
buf[0xd] = sdb >> 16;
buf[0xe] = sdb >> 8;
buf[0xf] = sdb >> 0;
len = (widths & EB_DATAX);
......
......@@ -236,7 +236,7 @@ static void eb_sdb_decode(struct eb_sdb_scan* scan, eb_device_t device, uint8_t*
}
/* We allocate buffer on the stack to hack around missing alloca */
#define EB_SDB_DECODE(x) \
#define EB_SDB_DECODE(x) \
static void eb_sdb_decode##x(struct eb_sdb_scan* scan, eb_device_t device, eb_operation_t ops) { \
union { \
struct { \
......@@ -245,7 +245,7 @@ static void eb_sdb_decode##x(struct eb_sdb_scan* scan, eb_device_t device, eb_op
} s; \
uint8_t bytes[1]; \
} sdb; \
return eb_sdb_decode(scan, device, &sdb.bytes[0], sizeof(sdb), ops); \
eb_sdb_decode(scan, device, &sdb.bytes[0], sizeof(sdb), ops); \
}
EB_SDB_DECODE(4)
......
......@@ -69,4 +69,8 @@ int eb_expand_array(void) {
return 0;
}
#else
typedef int make_iso_compilers_happy; /* so the file is not empty */
#endif
......@@ -59,4 +59,8 @@ void eb_free_link (eb_link_t x) { free(x); }
void eb_free_sdb_scan (eb_sdb_scan_t x) { free(x); }
void eb_free_sdb_record (eb_sdb_record_t x) { free(x); }
#else
typedef int make_iso_compilers_happy; /* so the file is not empty */
#endif
......@@ -56,4 +56,8 @@ int eb_expand_array(void) {
}
}
#else
typedef int make_iso_compilers_happy; /* so the file is not empty */
#endif
......@@ -315,10 +315,11 @@ int main(int argc, char** argv) {
eb_width_address(line_width), eb_width_data(line_width));
if (probe) {
struct sdb_device info;
if (verbose)
fprintf(stdout, "Scanning remote bus for Wishbone devices...\n");
struct sdb_device info;
if ((status = eb_sdb_find_by_address(device, address, &info)) != EB_OK) {
fprintf(stderr, "%s: failed to find SDB record: %s\n", program, eb_status(status));
return 1;
......
......@@ -301,10 +301,11 @@ int main(int argc, char** argv) {
eb_width_address(line_width), eb_width_data(line_width));
if (probe) {
struct sdb_device info;
if (verbose)
fprintf(stdout, "Scanning remote bus for Wishbone devices...\n");
struct sdb_device info;
if ((status = eb_sdb_find_by_address(device, address, &info)) != EB_OK) {
fprintf(stderr, "%s: failed to find SDB record: %s\n", program, eb_status(status));
return 1;
......
......@@ -244,10 +244,11 @@ int main(int argc, char** argv) {
eb_width_address(line_width), eb_width_data(line_width));
if (probe) {
struct sdb_device info;
if (verbose)
fprintf(stdout, "Scanning remote bus for Wishbone devices...\n");
struct sdb_device info;
if ((status = eb_sdb_find_by_address(device, address, &info)) != EB_OK) {
fprintf(stderr, "%s: failed to find SDB record: %s\n", program, eb_status(status));
return 1;
......
......@@ -252,10 +252,11 @@ int main(int argc, char** argv) {
eb_width_address(line_width), eb_width_data(line_width));
if (probe) {
struct sdb_device info;
if (verbose)
fprintf(stdout, "Scanning remote bus for Wishbone devices...\n");
struct sdb_device info;
if ((status = eb_sdb_find_by_address(device, address, &info)) != EB_OK) {
fprintf(stderr, "%s: failed to find SDB record: %s\n", program, eb_status(status));
return 1;
......
......@@ -94,7 +94,7 @@ eb_status_t eb_dev_connect(struct eb_transport* transportp, struct eb_link* link
link->fdes = fdes;
link->flags = fcntl(fdes, F_GETFL, 0);
// If this is a serial device, enter raw mode
/* If this is a serial device, enter raw mode */
if (tcgetattr(fdes, &ios) == 0) {
cfmakeraw(&ios);
cfsetispeed(&ios, B115200);
......
......@@ -46,6 +46,7 @@ EB_PRIVATE void eb_dev_send_buffer(struct eb_transport* transportp, struct eb_li
struct eb_dev_transport {
/* Contents must fit in 9 bytes */
char reserved[9];
};
struct eb_dev_link {
......
......@@ -84,7 +84,7 @@ void eb_tunnel_disconnect(struct eb_transport* transportp, struct eb_link* linkp
void eb_tunnel_fdes(struct eb_transport* transportp, struct eb_link* linkp, eb_user_data_t data, eb_descriptor_callback_t cb) {
if (linkp == 0) return;
return eb_posix_tcp_fdes(0, linkp, data, cb);
eb_posix_tcp_fdes(0, linkp, data, cb);
}
int eb_tunnel_accept(struct eb_transport* transportp, struct eb_link* result_linkp, eb_user_data_t data, eb_descriptor_callback_t ready) {
......
Markdown is supported
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