Skip to content
Snippets Groups Projects
Commit 5c3ae852 authored by Alessandro Rubini's avatar Alessandro Rubini
Browse files

Merge branch 'fix-warnings'

parents 14a84cc7 8f57a255
Branches
Tags
No related merge requests found
......@@ -63,7 +63,7 @@ include sockitowm/sockitowm.mk
include dev/dev.mk
CFLAGS = $(CFLAGS_PLATFORM) $(cflags-y) \
CFLAGS = $(CFLAGS_PLATFORM) $(cflags-y) -Wall \
-ffunction-sections -fdata-sections -Os \
-include include/trace.h
......
#include <string.h>
#include <wrc.h>
#include "types.h"
#include "i2c.h"
#include "eeprom.h"
......@@ -163,7 +166,7 @@ int32_t eeprom_get_sfp(uint8_t i2cif, uint8_t i2c_addr, struct s_sfpinfo * sfp,
chksum =
(uint8_t) ((uint16_t) chksum + *(ptr++)) & 0xff;
if (chksum != sfp->chksum)
EE_RET_CORRPT;
return EE_RET_CORRPT;
} else {
/*count checksum */
ptr = (uint8_t *) sfp;
......@@ -271,7 +274,7 @@ int8_t eeprom_init_purge(uint8_t i2cif, uint8_t i2c_addr)
int8_t eeprom_init_add(uint8_t i2cif, uint8_t i2c_addr, const char *args[])
{
uint8_t i = 1;
char separator = ' ';
uint8_t separator = ' ';
uint16_t used, readback;
if (eeprom_read(i2cif, i2c_addr, EE_BASE_INIT, (uint8_t *) & used,
......@@ -314,7 +317,7 @@ int8_t eeprom_init_add(uint8_t i2cif, uint8_t i2c_addr, const char *args[])
int32_t eeprom_init_show(uint8_t i2cif, uint8_t i2c_addr)
{
uint16_t used, i;
char byte;
uint8_t byte;
if (eeprom_read(i2cif, i2c_addr, EE_BASE_INIT, (uint8_t *) & used,
sizeof(used)) != sizeof(used))
......@@ -335,7 +338,7 @@ int32_t eeprom_init_show(uint8_t i2cif, uint8_t i2c_addr)
return 0;
}
int8_t eeprom_init_readcmd(uint8_t i2cif, uint8_t i2c_addr, char *buf,
int8_t eeprom_init_readcmd(uint8_t i2cif, uint8_t i2c_addr, uint8_t *buf,
uint8_t bufsize, uint8_t next)
{
static uint16_t ptr;
......
......@@ -9,6 +9,7 @@ LGPL 2.1
*/
#include <stdio.h>
#include <wrc.h>
#include "board.h"
#include "syscon.h"
......
......@@ -76,7 +76,7 @@
#define PFILTER_MAX_CODE_SIZE 32
#define pfilter_dbg
#define pfilter_dbg(x, ...) /* nothing */
extern volatile struct EP_WB *EP;
......@@ -87,7 +87,7 @@ static int code_pos;
static uint64_t code_buf[32];
/* begins assembling a new packet filter program */
void pfilter_new()
static void pfilter_new()
{
code_pos = 0;
}
......@@ -108,7 +108,8 @@ static void check_reg_range(int val, int minval, int maxval, char *name)
}
}
void pfilter_cmp(int offset, int value, int mask, pfilter_op_t op, int rd)
static void pfilter_cmp(int offset, int value, int mask, pfilter_op_t op,
int rd)
{
uint64_t ir;
......@@ -132,28 +133,7 @@ void pfilter_cmp(int offset, int value, int mask, pfilter_op_t op, int rd)
code_buf[code_pos++] = ir;
}
// rd = (packet[offset] & (1<<bit_index)) op rd
void pfilter_btst(int offset, int bit_index, pfilter_op_t op, int rd)
{
uint64_t ir;
check_size();
if (offset > code_pos)
pfilter_dbg
("microcode: comparison offset is bigger than current PC. Insert some nops before comparing");
check_reg_range(rd, 1, 15, "ra/rd");
check_reg_range(bit_index, 0, 15, "bit index");
ir = ((1ULL << 33) | PF_MODE_CMP | ((uint64_t) offset << 7) |
((uint64_t) bit_index << 29) | (uint64_t) op | ((uint64_t) rd <<
3));
code_buf[code_pos++] = ir;
}
void pfilter_nop()
static void pfilter_nop()
{
uint64_t ir;
check_size();
......@@ -162,7 +142,7 @@ void pfilter_nop()
}
// rd = ra op rb
void pfilter_logic2(int rd, int ra, pfilter_op_t op, int rb)
static void pfilter_logic2(int rd, int ra, pfilter_op_t op, int rb)
{
uint64_t ir;
check_size();
......@@ -194,7 +174,7 @@ static void pfilter_logic3(int rd, int ra, pfilter_op_t op, int rb,
}
/* Terminates the microcode, loads it to the endpoint and enables the pfilter */
void pfilter_load()
static void pfilter_load()
{
int i;
code_buf[code_pos++] = (1ULL << 35); // insert FIN instruction
......
#include <stdio.h>
#include <string.h>
#include <wrc.h>
#include "types.h"
#include "board.h"
......@@ -186,7 +187,7 @@ int minic_rx_frame(uint8_t * hdr, uint8_t * payload, uint32_t buf_size,
uint32_t payload_size, num_words;
uint32_t desc_hdr;
uint32_t raw_ts;
uint32_t rx_addr_cur, cur_avail;
uint32_t cur_avail;
int n_recvd;
if (!(minic_readl(MINIC_REG_EIC_ISR) & MINIC_EIC_ISR_RX))
......
#include <string.h>
#include <wrc.h>
#include "onewire.h"
#include "../sockitowm/ownet.h"
#include "../sockitowm/findtype.h"
#include "../sockitowm/eep43.h"
#include "../sockitowm/temp28.h"
#define DEBUG_PMAC 0
......@@ -72,7 +76,7 @@ int8_t get_persistent_mac(uint8_t portnum, uint8_t * mac)
if (FamilySN[i][0] == 0x43) {
owLevel(portnum, MODE_NORMAL);
if (ReadMem43(portnum, FamilySN[i], EEPROM_MAC_PAGE,
&read_buffer) == TRUE) {
read_buffer) == TRUE) {
if (read_buffer[0] == 0 && read_buffer[1] == 0
&& read_buffer[2] == 0) {
/* Skip the EEPROM since it has not been programmed! */
......@@ -116,7 +120,7 @@ int8_t set_persistent_mac(uint8_t portnum, uint8_t * mac)
/* Write the last EEPROM with the MAC */
owLevel(portnum, MODE_NORMAL);
if (Write43(portnum, FamilySN[0], EEPROM_MAC_PAGE, &write_buffer) ==
if (Write43(portnum, FamilySN[0], EEPROM_MAC_PAGE, write_buffer) ==
TRUE)
return 0;
......
#include <wrc.h>
#include "board.h"
#include "pps_gen.h"
......@@ -18,7 +19,7 @@
#define ppsg_read(reg) \
*(volatile uint32_t *) (BASE_PPS_GEN + (offsetof(struct PPSG_WB, reg)))
int pps_gen_init()
void pps_gen_init()
{
uint32_t cr;
......@@ -38,8 +39,6 @@ int pps_gen_init()
/* Adjusts the nanosecond (refclk cycle) counter by atomically adding (how_much) cycles. */
int pps_gen_adjust(int counter, int64_t how_much)
{
uint32_t cr;
TRACE_DEV("Adjust: counter = %s [%c%d]\n",
counter == PPSG_ADJUST_SEC ? "seconds" : "nanoseconds",
how_much < 0 ? '-' : '+', (int32_t) abs(how_much));
......@@ -61,10 +60,8 @@ int pps_gen_adjust(int counter, int64_t how_much)
}
/* Sets the current time */
int pps_gen_set_time(uint64_t seconds, uint32_t nanoseconds)
void pps_gen_set_time(uint64_t seconds, uint32_t nanoseconds)
{
uint32_t cr;
ppsg_write(ADJ_UTCLO, (uint32_t) (seconds & 0xffffffffLL));
ppsg_write(ADJ_UTCHI, (uint32_t) (seconds >> 32) & 0xff);
ppsg_write(ADJ_NSEC,
......@@ -72,7 +69,6 @@ int pps_gen_set_time(uint64_t seconds, uint32_t nanoseconds)
(int64_t) REF_CLOCK_PERIOD_PS));
ppsg_write(CR, (ppsg_read(CR) & 0xfffffffb) | PPSG_CR_CNT_SET);
return 0;
}
uint64_t pps_get_utc(void)
......
#include <string.h>
#include <wrc.h>
#include "hw/memlayout.h"
#define SDB_INTERCONNET 0x00
......@@ -117,7 +119,7 @@ static void print_devices_deep(unsigned int base, unsigned int sdb)
static unsigned char *find_device(unsigned int devid)
{
find_device_deep(0, SDB_ADDRESS, devid);
return find_device_deep(0, SDB_ADDRESS, devid);
}
void sdb_print_devices(void)
......
......@@ -44,7 +44,11 @@ int8_t eeprom_phtrans(uint8_t i2cif, uint8_t i2c_addr, uint32_t * val,
int8_t eeprom_init_erase(uint8_t i2cif, uint8_t i2c_addr);
int8_t eeprom_init_add(uint8_t i2cif, uint8_t i2c_addr, const char *args[]);
int32_t eeprom_init_show(uint8_t i2cif, uint8_t i2c_addr);
int8_t eeprom_init_readcmd(uint8_t i2cif, uint8_t i2c_addr, char *buf,
int8_t eeprom_init_readcmd(uint8_t i2cif, uint8_t i2c_addr, uint8_t *buf,
uint8_t bufsize, uint8_t next);
int32_t eeprom_get_sfp(uint8_t i2cif, uint8_t i2c_addr, struct s_sfpinfo * sfp,
uint8_t add, uint8_t pos);
int8_t eeprom_init_purge(uint8_t i2cif, uint8_t i2c_addr);
#endif
......@@ -27,14 +27,6 @@ int ep_get_psval(int32_t * psval);
int ep_cal_pattern_enable();
int ep_cal_pattern_disable();
void pfilter_new();
void pfilter_cmp(int offset, int value, int mask, pfilter_op_t op, int rd);
void pfilter_btst(int offset, int bit_index, pfilter_op_t op, int rd);
void pfilter_nop();
void pfilter_logic2(int rd, int ra, pfilter_op_t op, int rb);
static void pfilter_logic3(int rd, int ra, pfilter_op_t op, int rb,
pfilter_op_t op2, int rc);
void pfilter_load();
void pfilter_init_default();
uint16_t pcs_read(int location);
......
......@@ -7,21 +7,21 @@
#define PPSG_ADJUST_NSEC 0x2
/* Initializes the PPS Generator. 0 on success, negative on failure. */
int shw_pps_gen_init();
void pps_gen_init(void);
/* Adjusts the <counter> (PPSG_ADJUST_SEC/NSEC) by (how_much) seconds/nanoseconds */
int shw_pps_gen_adjust(int counter, int64_t how_much);
int pps_gen_adjust(int counter, int64_t how_much);
/* Returns 1 when the PPS is busy adjusting its time counters, 0 if PPS gen idle */
int shw_pps_gen_busy();
int pps_gen_busy(void);
/* Enables/disables PPS Generator PPS output */
int shw_pps_gen_enable_output(int enable);
int pps_gen_enable_output(int enable);
/* Reads the current time and stores at <seconds,nanoseconds>. */
void shw_pps_gen_get_time(uint64_t * seconds, uint32_t * nanoseconds);
void pps_gen_get_time(uint64_t * seconds, uint32_t * nanoseconds);
/* Sets the time to <seconds,nanoseconds>. */
void shw_pps_gen_set_time(uint64_t seconds, uint32_t nanoseconds);
void pps_gen_set_time(uint64_t seconds, uint32_t nanoseconds);
#endif
#ifndef __SOCKITOWM_H__
#define __SOCKITOWM_H__
#include "sockitowm/ownet.h"
#endif /* __SOCKITOWM_H__ */
#ifndef __UART_H
#define __UART_H
int mprintf(char const *format, ...);
void uart_init();
void uart_init(void);
void uart_write_byte(int b);
void uart_write_string(char *s);
int uart_read_byte(void);
#endif
#ifndef __WRC_H__
#define __WRC_H__
/*
* This header includes all generic prototypes that were missing
* in earlier implementations. For example, the monitor is only
* one function and doesn't deserve an header of its own.
* Also, this brings in very common and needed headers
*/
int mprintf(char const *format, ...)
__attribute__((format(printf,1,2)));
void wrc_mon_gui(void);
void shell_init(void);
int wrc_log_stats(uint8_t onetime);
/* This is in the library, somewhere */
extern int abs(int val);
/* The following from ptp-noposix */
extern void wr_servo_reset(void);
void update_rx_queues(void);
void spll_enable_ptracker(int ref_channel, int enable);
#endif /* __WRC_H__ */
#include <string.h>
#include "endpoint.h"
#include "ipv4.h"
#include "ptpd_netif.h"
......
#include <string.h>
#include <wrc.h>
#include "endpoint.h"
#include "ipv4.h"
......
......@@ -2,6 +2,7 @@
#include <stdint.h>
#include <stdarg.h>
#include <time.h>
#include <wrc.h>
#include "util.h"
......
#include <stdio.h>
#include <time.h>
#include <wrc.h>
#include "board.h"
#include "ptpd_exports.h"
#include "hal_exports.h"
#include "softpll_ng.h"
#include "minic.h"
#include "pps_gen.h"
#include "util.h"
#include "timer.h"
......@@ -15,12 +17,8 @@
extern ptpdexp_sync_state_t cur_servo_state;
extern int wrc_man_phase;
int wrc_mon_gui(void)
void wrc_mon_gui(void)
{
static char *slave_states[] = {
"Uninitialized", "SYNC_SEC", "SYNC_NSEC", "SYNC_PHASE",
"TRACK_PHASE"
};
static uint32_t last = 0;
hexp_port_state_t ps;
int tx, rx;
......@@ -29,7 +27,7 @@ int wrc_mon_gui(void)
uint32_t nsec;
if (timer_get_tics() - last < UI_REFRESH_PERIOD)
return 0;
return;
last = timer_get_tics();
......@@ -150,15 +148,11 @@ int wrc_mon_gui(void)
cprintf(C_GREY, "--");
return 0;
return;
}
int wrc_log_stats(uint8_t onetime)
{
static char *slave_states[] = {
"Uninitialized", "SYNC_SEC", "SYNC_NSEC", "SYNC_PHASE",
"TRACK_PHASE"
};
static uint32_t last = 0;
hexp_port_state_t ps;
int tx, rx;
......
......@@ -3,11 +3,13 @@
Description: launches the WR Core monitor GUI */
#include <string.h>
#include <wrc.h>
#include "shell.h"
#include "eeprom.h"
#include "syscon.h"
extern int measure_t24p(int *value);
extern int measure_t24p(uint32_t *value);
int cmd_calib(const char *args[])
{
......
#include <string.h>
#include <wrc.h>
#include "shell.h"
#include "eeprom.h"
#include "syscon.h"
#include "i2c.h"
int cmd_init(const char *args[])
{
......
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