working on compiling bsp_q7s on amd64
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit

This commit is contained in:
Ulrich Mohr 2022-08-18 19:04:49 +02:00
parent 73971ad486
commit c0e896b371
10 changed files with 3073 additions and 28 deletions

View File

@ -15,6 +15,9 @@ set(OBSW_VERSION_REVISION_IF_GIT_FAILS 0)
# set(CMAKE_VERBOSE TRUE)
add_compile_definitions(FSFW_INTROSPECTION)
include_directories("bsp_mib/include")
option(
EIVE_HARDCODED_TOOLCHAIN_FILE
"\
@ -74,7 +77,7 @@ if(EIVE_Q7S_EM)
else()
set(OBSW_Q7S_EM
0
CACHE STRING "Q7S EM configuration")
CACHE STRING "Q7S FM configuration")
set(INIT_VAL 1)
endif()
set(OBSW_ADD_MGT

2160
bsp_mib/include/gps.h Normal file

File diff suppressed because it is too large Load Diff

350
bsp_mib/include/libmtd.h Normal file
View File

@ -0,0 +1,350 @@
/*
* Copyright (C) 2008, 2009 Nokia Corporation
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Author: Artem Bityutskiy
*
* MTD library.
*/
#ifndef __LIBMTD_H__
#define __LIBMTD_H__
#ifdef __cplusplus
extern "C" {
#endif
/* Maximum MTD device name length */
#define MTD_NAME_MAX 127
/* Maximum MTD device type string length */
#define MTD_TYPE_MAX 64
/* MTD library descriptor */
typedef void * libmtd_t;
/* Forward decls */
struct region_info_user;
/**
* @mtd_dev_cnt: count of MTD devices in system
* @lowest_mtd_num: lowest MTD device number in system
* @highest_mtd_num: highest MTD device number in system
* @sysfs_supported: non-zero if sysfs is supported by MTD
*/
struct mtd_info
{
int mtd_dev_cnt;
int lowest_mtd_num;
int highest_mtd_num;
unsigned int sysfs_supported:1;
};
/**
* struct mtd_dev_info - information about an MTD device.
* @mtd_num: MTD device number
* @major: major number of corresponding character device
* @minor: minor number of corresponding character device
* @type: flash type (constants like %MTD_NANDFLASH defined in mtd-abi.h)
* @type_str: static R/O flash type string
* @name: device name
* @size: device size in bytes
* @eb_cnt: count of eraseblocks
* @eb_size: eraseblock size
* @min_io_size: minimum input/output unit size
* @subpage_size: sub-page size
* @oob_size: OOB size (zero if the device does not have OOB area)
* @region_cnt: count of additional erase regions
* @writable: zero if the device is read-only
* @bb_allowed: non-zero if the MTD device may have bad eraseblocks
*/
struct mtd_dev_info
{
int mtd_num;
int major;
int minor;
int type;
const char type_str[MTD_TYPE_MAX + 1];
const char name[MTD_NAME_MAX + 1];
long long size;
int eb_cnt;
int eb_size;
int min_io_size;
int subpage_size;
int oob_size;
int region_cnt;
unsigned int writable:1;
unsigned int bb_allowed:1;
};
/**
* libmtd_open - open MTD library.
*
* This function initializes and opens the MTD library and returns MTD library
* descriptor in case of success and %NULL in case of failure. In case of
* failure, errno contains zero if MTD is not present in the system, or
* contains the error code if a real error happened.
*/
libmtd_t libmtd_open(void);
/**
* libmtd_close - close MTD library.
* @desc: MTD library descriptor
*/
void libmtd_close(libmtd_t desc);
/**
* mtd_dev_present - check whether a MTD device is present.
* @desc: MTD library descriptor
* @mtd_num: MTD device number to check
*
* This function returns %1 if MTD device is present and %0 if not.
*/
int mtd_dev_present(libmtd_t desc, int mtd_num);
/**
* mtd_get_info - get general MTD information.
* @desc: MTD library descriptor
* @info: the MTD device information is returned here
*
* This function fills the passed @info object with general MTD information and
* returns %0 in case of success and %-1 in case of failure.
*/
int mtd_get_info(libmtd_t desc, struct mtd_info *info);
/**
* mtd_get_dev_info - get information about an MTD device.
* @desc: MTD library descriptor
* @node: name of the MTD device node
* @mtd: the MTD device information is returned here
*
* This function gets information about MTD device defined by the @node device
* node file and saves this information in the @mtd object. Returns %0 in case
* of success and %-1 in case of failure. If MTD subsystem is not present in the
* system, or the MTD device does not exist, errno is set to @ENODEV.
*/
int mtd_get_dev_info(libmtd_t desc, const char *node, struct mtd_dev_info *mtd);
/**
* mtd_get_dev_info1 - get information about an MTD device.
* @desc: MTD library descriptor
* @mtd_num: MTD device number to fetch information about
* @mtd: the MTD device information is returned here
*
* This function is identical to 'mtd_get_dev_info()' except that it accepts
* MTD device number, not MTD character device.
*/
int mtd_get_dev_info1(libmtd_t desc, int mtd_num, struct mtd_dev_info *mtd);
/**
* mtd_lock - lock eraseblocks.
* @desc: MTD library descriptor
* @mtd: MTD device description object
* @fd: MTD device node file descriptor
* @eb: eraseblock to lock
*
* This function locks eraseblock @eb. Returns %0 in case of success and %-1
* in case of failure.
*/
int mtd_lock(const struct mtd_dev_info *mtd, int fd, int eb);
/**
* mtd_unlock - unlock eraseblocks.
* @desc: MTD library descriptor
* @mtd: MTD device description object
* @fd: MTD device node file descriptor
* @eb: eraseblock to lock
*
* This function unlocks eraseblock @eb. Returns %0 in case of success and %-1
* in case of failure.
*/
int mtd_unlock(const struct mtd_dev_info *mtd, int fd, int eb);
/**
* mtd_erase - erase multiple eraseblocks.
* @desc: MTD library descriptor
* @mtd: MTD device description object
* @fd: MTD device node file descriptor
* @eb: index of first eraseblock to erase
* @blocks: the number of eraseblocks to erase
*
* This function erases @blocks starting at eraseblock @eb of MTD device
* described by @fd. Returns %0 in case of success and %-1 in case of failure.
*/
int mtd_erase_multi(libmtd_t desc, const struct mtd_dev_info *mtd,
int fd, int eb, int blocks);
/**
* mtd_erase - erase an eraseblock.
* @desc: MTD library descriptor
* @mtd: MTD device description object
* @fd: MTD device node file descriptor
* @eb: eraseblock to erase
*
* This function erases eraseblock @eb of MTD device described by @fd. Returns
* %0 in case of success and %-1 in case of failure.
*/
int mtd_erase(libmtd_t desc, const struct mtd_dev_info *mtd, int fd, int eb);
/**
* mtd_regioninfo - get information about an erase region.
* @fd: MTD device node file descriptor
* @regidx: index of region to look up
* @reginfo: the region information is returned here
*
* This function gets information about an erase region defined by the
* @regidx index and saves this information in the @reginfo object.
* Returns %0 in case of success and %-1 in case of failure. If the
* @regidx is not valid or unavailable, errno is set to @ENODEV.
*/
int mtd_regioninfo(int fd, int regidx, struct region_info_user *reginfo);
/**
* mtd_is_locked - see if the specified eraseblock is locked.
* @mtd: MTD device description object
* @fd: MTD device node file descriptor
* @eb: eraseblock to check
*
* This function checks to see if eraseblock @eb of MTD device described
* by @fd is locked. Returns %0 if it is unlocked, %1 if it is locked, and
* %-1 in case of failure. If the ioctl is not supported (support was added in
* Linux kernel 2.6.36) or this particular device does not support it, errno is
* set to @ENOTSUPP.
*/
int mtd_is_locked(const struct mtd_dev_info *mtd, int fd, int eb);
/**
* mtd_torture - torture an eraseblock.
* @desc: MTD library descriptor
* @mtd: MTD device description object
* @fd: MTD device node file descriptor
* @eb: eraseblock to torture
*
* This function tortures eraseblock @eb. Returns %0 in case of success and %-1
* in case of failure.
*/
int mtd_torture(libmtd_t desc, const struct mtd_dev_info *mtd, int fd, int eb);
/**
* mtd_is_bad - check if eraseblock is bad.
* @mtd: MTD device description object
* @fd: MTD device node file descriptor
* @eb: eraseblock to check
*
* This function checks if eraseblock @eb is bad. Returns %0 if not, %1 if yes,
* and %-1 in case of failure.
*/
int mtd_is_bad(const struct mtd_dev_info *mtd, int fd, int eb);
/**
* mtd_mark_bad - mark an eraseblock as bad.
* @mtd: MTD device description object
* @fd: MTD device node file descriptor
* @eb: eraseblock to mark as bad
*
* This function marks eraseblock @eb as bad. Returns %0 in case of success and
* %-1 in case of failure.
*/
int mtd_mark_bad(const struct mtd_dev_info *mtd, int fd, int eb);
/**
* mtd_read - read data from an MTD device.
* @mtd: MTD device description object
* @fd: MTD device node file descriptor
* @eb: eraseblock to read from
* @offs: offset withing the eraseblock to read from
* @buf: buffer to read data to
* @len: how many bytes to read
*
* This function reads @len bytes of data from eraseblock @eb and offset @offs
* of the MTD device defined by @mtd and stores the read data at buffer @buf.
* Returns %0 in case of success and %-1 in case of failure.
*/
int mtd_read(const struct mtd_dev_info *mtd, int fd, int eb, int offs,
void *buf, int len);
/**
* mtd_write - write data to an MTD device.
* @desc: MTD library descriptor
* @mtd: MTD device description object
* @fd: MTD device node file descriptor
* @eb: eraseblock to write to
* @offs: offset withing the eraseblock to write to
* @data: data buffer to write
* @len: how many data bytes to write
* @oob: OOB buffer to write
* @ooblen: how many OOB bytes to write
* @mode: write mode (e.g., %MTD_OOB_PLACE, %MTD_OOB_RAW)
*
* This function writes @len bytes of data to eraseblock @eb and offset @offs
* of the MTD device defined by @mtd. Returns %0 in case of success and %-1 in
* case of failure.
*
* Can only write to a single page at a time if writing to OOB.
*/
int mtd_write(libmtd_t desc, const struct mtd_dev_info *mtd, int fd, int eb,
int offs, void *data, int len, void *oob, int ooblen,
uint8_t mode);
/**
* mtd_read_oob - read out-of-band area.
* @desc: MTD library descriptor
* @mtd: MTD device description object
* @fd: MTD device node file descriptor
* @start: page-aligned start address
* @length: number of OOB bytes to read
* @data: read buffer
*
* This function reads @length OOB bytes starting from address @start on
* MTD device described by @fd. The address is specified as page byte offset
* from the beginning of the MTD device. This function returns %0 in case of
* success and %-1 in case of failure.
*/
int mtd_read_oob(libmtd_t desc, const struct mtd_dev_info *mtd, int fd,
uint64_t start, uint64_t length, void *data);
/**
* mtd_write_oob - write out-of-band area.
* @desc: MTD library descriptor
* @mtd: MTD device description object
* @fd: MTD device node file descriptor
* @start: page-aligned start address
* @length: number of OOB bytes to write
* @data: write buffer
*
* This function writes @length OOB bytes starting from address @start on
* MTD device described by @fd. The address is specified as page byte offset
* from the beginning of the MTD device. Returns %0 in case of success and %-1
* in case of failure.
*/
int mtd_write_oob(libmtd_t desc, const struct mtd_dev_info *mtd, int fd,
uint64_t start, uint64_t length, void *data);
/**
* mtd_probe_node - test MTD node.
* @desc: MTD library descriptor
* @node: the node to test
*
* This function tests whether @node is an MTD device node and returns %1 if it
* is, and %-1 if it is not (errno is %ENODEV in this case) or if an error
* occurred.
*/
int mtd_probe_node(libmtd_t desc, const char *node);
#ifdef __cplusplus
}
#endif
#endif /* __LIBMTD_H__ */

532
bsp_mib/include/libxiphos.h Normal file
View File

@ -0,0 +1,532 @@
#ifndef __LIBXIPHOS_H__
#define __LIBXIPHOS_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <inttypes.h> /* required by libmtd.h */
#include <libmtd.h> /* required for libmtd_t */
#include <stddef.h>
/* String identifying this library's version */
extern const char *xsc_libxiphos_version;
/** Type for boolean values */
typedef int xsc_bool_t;
/** Type for the LibNOR instance descriptor */
typedef void * xsc_libnor_t;
/** Type for identifying the nominal or the gold (redundant) flash copy */
typedef enum {
XSC_LIBNOR_COPY_NOMINAL,
XSC_LIBNOR_COPY_GOLD,
XSC_LIBNOR_COPY_TOTAL_NUMBER
} xsc_libnor_copy_t;
/** Type for identifying one of the two NOR flash chips */
typedef enum {
XSC_LIBNOR_CHIP_0, /* First NOR flash chip */
#if (!defined(CONFIG_Q7AE))
XSC_LIBNOR_CHIP_1, /* Second NOR flash chip */
#endif
XSC_LIBNOR_CHIP_TOTAL_NUMBER
} xsc_libnor_chip_t;
/* Type for identifying the boot stage */
typedef enum {
XSC_BOOT_STAGE_INITRAMFS, /* Booted from initramfs */
XSC_BOOT_STAGE_ROOTFS, /* Booted from rootfs flash partition */
XSC_BOOT_STAGE_TOTAL_NUMBER
} xsc_boot_stage_t;
typedef enum {
XSC_POWER_OFF, /* Power disabled */
XSC_POWER_ON /* Power enabled */
} xsc_power_t;
/** Type for identifying the partitions of a NOR flash copy */
typedef enum {
XSC_LIBNOR_PART_NA = 0,
XSC_LIBNOR_PART_FW,
XSC_LIBNOR_PART_XSCINFO,
XSC_LIBNOR_PART_ROOTFS,
XSC_LIBNOR_PART_UENV,
XSC_LIBNOR_PART_DTB,
XSC_LIBNOR_PART_KERNEL,
XSC_LIBNOR_PART_INITRAMFS,
XSC_LIBNOR_PART_BCH,
XSC_LIBNOR_PART_RWINFO,
XSC_LIBNOR_PART_ROINFO,
XSC_LIBNOR_PART_SYSTEM,
XSC_LIBNOR_PART_ALL
} xsc_libnor_partitions_t;
typedef enum {
XSC_LIBNOR_SYSFILE_NA = 0,
XSC_LIBNOR_SYSFILE_KERNEL,
XSC_LIBNOR_SYSFILE_DTB,
XSC_LIBNOR_SYSFILE_LOGIC,
} xsc_libnor_system_files_t;
/** Type for identifying the action on the scratch buffer */
typedef enum {
SCRATCH_READ = 0,
SCRATCH_WRITE,
SCRATCH_CLEAR
} xsc_scratch_action_t;
struct xsc_scratch_op {
xsc_scratch_action_t action;
char *var_name;
char *var_value;
};
/** Type for specifying an error or status code */
typedef int xsc_status_t;
#define XSC_SUCCESS (0) /* No Error */
#define XSC_ERROR (-1) /* Error */
#define XSC_EINVAL (-2) /* Invalid inputs */
#define XSC_EBUSY (-3) /* Device is busy */
/** Returns the copy name */
const char *get_copy_name(xsc_libnor_t desc);
/** Returns the chip and copy for the given partition name */
xsc_status_t parse_copy_name(const char* name, xsc_libnor_chip_t *chip,
xsc_libnor_copy_t *copy);
/* In the following structure, sizes of the memory and swap fields
* are given as multiples of mem_unit bytes. */
struct xsc_proc_info {
long uptime; /* Seconds since boot */
unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
unsigned long totalram; /* Total usable main memory size */
unsigned long freeram; /* Available memory size */
unsigned long sharedram; /* Amount of shared memory */
unsigned long bufferram; /* Memory used by buffers */
unsigned short procs; /* Number of current processes */
unsigned long totalhigh; /* Total high memory size */
unsigned long freehigh; /* Available high memory size */
unsigned int mem_unit; /* Memory unit size in bytes */
};
/* Retrieve the system information */
xsc_status_t xsc_info_proc(struct xsc_proc_info *info);
/**
* xsc_info_pa3_status
*
* Returns the ProASIC3 Logic status register.
*/
xsc_status_t xsc_info_pa3_status(uint32_t *status);
/** Libsensors */
/** The user application is expected to use libsensors for reading ADCs
* Refer to libsensor documentation.
* */
xsc_status_t xsc_ubi_get_mountinfo(int ubi_dev, int *mounted, int *rw, char
*tgt, char *src, size_t bufsize);
xsc_status_t xsc_get_mountinfo(const char *source, int *mounted, char
*target, size_t bufsize);
/**
* xsc_info_pa3_logicrev
*/
xsc_status_t xsc_info_pa3_logicrev(uint32_t *status);
/**
* xsc_boot_get_chip_copy
*
* Gets the currently booted NOR flash chip and copy
*
*/
xsc_status_t xsc_boot_get_chip_copy(xsc_libnor_chip_t *boot_chip, xsc_libnor_copy_t *boot_copy);
/**
* xsc_boot_copy
*
* Reboot on the chip copy specified
*
*/
void xsc_boot_copy(xsc_libnor_chip_t boot_chip, xsc_libnor_copy_t boot_copy);
#if (defined(CONFIG_Q8_REVA) || defined(CONFIG_Q8S_REVA) || defined(CONFIG_Q8_REVB) || defined(CONFIG_Q8S_REVB))
/**
* xsc_get_cur_lim_pwm
*
* Get the current limit PWM
* Restricted to Q8 devices
*
*/
xsc_status_t xsc_get_cur_lim_pwm(uint32_t *pwm);
/**
* xsc_set_cur_lim_pwm
*
* Set the current limit PWM (range:0..15)
* Restricted to Q8 devices
*
*/
xsc_status_t xsc_set_cur_lim_pwm(uint32_t pwm);
#endif
/* # LibNOR: Q-card NOR flash management */
/**
* xsc_libnor_open - open the Xiphos NOR library to use the given copy and chip
*
**/
xsc_status_t xsc_libnor_open(xsc_libnor_t *desc, xsc_libnor_chip_t chip, xsc_libnor_copy_t copy);
/**
* xsc_libnor_open - open the Xiphos NOR library
*
**/
xsc_status_t xsc_libnor_open_any(xsc_libnor_t *desc);
/**
* xsc_libnor_close - close the Xiphos NOR library
*
**/
void xsc_libnor_close(xsc_libnor_t desc);
/**
* xsc_libnor_getmtd
*
* Return the MTD number for the specified name
* */
xsc_status_t xsc_libnor_getmtd(xsc_libnor_t desc, const char *name,
int *mtd_num);
/**
* xsc_libnor_mtd_getsize
*
* Return the size of the specified MTD partition
*/
xsc_status_t xsc_libnor_mtd_getsize(xsc_libnor_t desc, const int mtd_num,
size_t *mtd_size);
/**
* xsc_libnor_copy_getmtd
*
* Return the MTD number for the specified copy (nom0, nom1, gold0, gold1)
* */
xsc_status_t xsc_libnor_copy_getmtd(xsc_libnor_t desc, int *mtd_num);
/**
* xsc_libnor_part_getmtd
*
* Return the MTD number for the specified partition (e.g. rootfs)
* */
xsc_status_t xsc_libnor_part_getmtd(xsc_libnor_t desc, const char *part_name, int *mtd_num);
/**
* xsc_erase_mtdn
*
* Erase the MTD blocks of the specified partition
*
* progress(int block_num, int erase_block_cnt, void* user_data): prototype for
* the user function that is called before each block erasure.
* If NULL the MTD section is wiped in one operation.
* user_data: pointer to the data that will be feed to the progress function.
*
* */
xsc_status_t xsc_erase_mtdn(xsc_libnor_t desc, int mtdn, void (*progress)(int, int, void *), void *user_data);
/**
* xsc_libnor_mtd_write
*
* Erase the MTD blocks of the specified partition then write the content of
* the buffer to the partition
*
* bufsize should equal MTD size
*/
xsc_status_t xsc_libnor_mtd_write(xsc_libnor_t desc, int mtdn, int fd,
char* buf, size_t bufsize);
/**
* xsc_remount_rw
*
* Remount specified filesystem
* */
xsc_status_t xsc_remount_rw(const char *name);
/**
* xsc_umount
*
* Umount specified filesystem
* */
xsc_status_t xsc_umount(const char *name);
/**
* xsc_mtd_is_attached
*
* Check wether MTD section is attached to the current UBI filesystem
*
* mtdn: MTD number
* Return the UBI device number
* */
int xsc_mtd_is_attached(int mtdn, int *dev_num);
/**
* xsc_mtd_ubi_attach
*
* Attach MTD section to a new UBI filesystem. If the MTD section is
* already attached to a UBI filesystem, do nothing.
*
* mtdn: MTD number
* Return UBI device number
* */
xsc_status_t xsc_mtd_ubi_attach(int mtdn, int *dev_num);
/**
* xsc_mtd_ubi_detach
*
* Remove specified UBI filesystem.
*
* dev_num: UBI device number
* */
xsc_status_t xsc_mtd_ubi_detach(int dev_num);
/**
* xsc_libnor_set_writeprotect
*
* Lock or unlock a whole (all partitions) NOR chip copy, resets hashes on lock
* User can provide a callback function for the long operation of reading
* the whole partition and computing the MD5SUM: md5progress
* */
typedef void (*cb_md5_progress_t)(size_t n, size_t total_size, void *user_data);
xsc_status_t xsc_libnor_set_writeprotect(xsc_libnor_t desc,
xsc_bool_t lock, xsc_bool_t auto_lock,
cb_md5_progress_t md5progress, void *md5progress_user_data);
/**
* xsc_libnor_get_writeprotect
*
* Returns the state of the writeprotection on a NOR chip copy.
*
* lock: set to 'True' if completely locked, 'False' otherwise
*
* */
xsc_status_t xsc_libnor_get_writeprotect(xsc_libnor_t desc,
xsc_bool_t *lock);
int xsc_mtd_lock_copy(xsc_libnor_t desc, int mtdn, int lock, int check);
/*
* xsc_mtd_lock_copy_q7ae - Get the locked status of a copy on the Q7AE.
*
* On Q7AE, one copy is on 2 chips. This function sets status to TRUE only if both chips are locked.
*/
xsc_status_t xsc_mtd_lock_copy_q7ae(xsc_libnor_t desc, int lock, int check, xsc_bool_t *status);
/**
* xsc_part_getinfo
*
* Return the MTD number, the size and the lock status of the specified partition
*/
xsc_status_t xsc_part_getinfo(xsc_libnor_t libnor, const char *part,
int *mtdn, size_t *size, xsc_bool_t *lock);
/**
*
* To further manipulate the nor flash, one can use the libmtd_t descriptor
* along with the mtd_num of a partition and <libmtd.h>. See documentation
* of libmtd.
*
* */
/* ## Watchdog */
struct watchdog_s;
/**
* \brief Take control of the watchdog and activate it
* \param handle Returned handle
* \return 0 on success, != 0 on failure
* */
int xsc_watchdog_init(struct watchdog_s **handle);
/**
* \brief Release the watchdog handle: only stops the watchdog if
* magic close is set to 1
*
* \param handle The handle to release
* \param magic_close set to 1 to also stop the watchdog
* \return 0 on success, -1 otherwise
**/
int xsc_watchdog_close(struct watchdog_s *handle, int magic_close);
/**
* \brief Keep the watchdog alive
*
* \param handle The handle to the initialized watchdog
* \return 0 on success, -1 otherwise
* */
int xsc_watchdog_keepalive(struct watchdog_s *handle);
/**
* \brief Disable the watchdog
*
* \param handle The handle to the initialized watchdog
* \return 0 on success, -1 otherwise
* */
int xsc_watchdog_disable(struct watchdog_s *handle);
/**
* \brief Enable the watchdog
*
* \param handle The handle to the initialized watchdog
* \return 0 on success, -1 otherwise
* */
int xsc_watchdog_enable(struct watchdog_s *handle);
/**
* \brief Set watchdog timeout after which the ProASIC will
* reset the SoC
*
* \param handle The handle to the initialized watchdog
* \param timeout_seconds The number of seconds after which the
* watchdog will reset
* \return 0 on success, -1 otherwise
* */
int xsc_watchdog_set_timeout(struct watchdog_s *handle, int timeout_seconds);
/**
* \brief Get watchdog timeout after which the ProASIC will
* reset the SoC
*
* \param handle The handle to the initialized watchdog
* \param timeout_seconds The number of seconds after which the
* watchdog will reset
* \return 0 on success, -1 otherwise
* */
int xsc_watchdog_get_timeout(struct watchdog_s *handle, int *timeout_seconds);
/**
* \brief Set the no-way-out flag which will prohibit disabling the
* watchdog
*
* \return 0 on success, -1 otherwise
* */
int xsc_watchdog_set_nowayout();
/**
* \brief Get the status (enabled or disabled) and nowayout flag (set or not)
*
* \param nowayout The nowayout flag status (0 = not set, 1 = set)
* \param status The status flag (0 = watchdog disabled, 1 = watchdog active)
* \return 0 on success, -1 otherwise
* */
int xsc_watchdog_get_status(int *nowayout, int *status);
/** Devices management */
typedef enum {
XSC_DEV_MMC0 = 0,
XSC_DEV_MMC1,
XSC_DEV_MMC_BOTH,
XSC_DEV_USB,
} xsc_device_t;
/**
* xsc_device_get_paths - scans the /dev directory, recognize the device entries
* and return the corresponding devices paths.
* Paths are stored in strings allocated via malloc() and shall be freed by
* xsc_device_free_paths.
*
* return count
* */
int xsc_device_get_paths(xsc_device_t dev, char ***list);
void xsc_device_free_paths(int count, char **list);
/** USB external storage */
xsc_status_t xsc_usb_enable_power(xsc_power_t power);
xsc_status_t xsc_usb_get_power_status(xsc_power_t *power);
/**
* xsc_usb_remove_all - disconnect and lock-down all USB devices
* */
void xsc_usb_remove_all(void);
/**
* xsc_usb_authorize_all - authorize the USB devices to connect to the system
* */
void xsc_usb_authorize_all(void);
/** SD external storage */
/**
* Check if any partition of the given slot is mounted.
*/
xsc_status_t xsc_sd_ismounted(xsc_device_t slot, int *mounted);
/**
* xsc_sd_umount - umount all partitions of the given sd
* supports XSC_DEV_MMC0, XSC_DEV_MMC1 and XSC_DEV_MMC_BOTH
*/
xsc_status_t xsc_sd_umount(xsc_device_t slot);
/**
* xsc_sd_enable_power - enable power on selected devices
* If force is true, the power off will be done even if partitions are mounted
* supports XSC_DEV_MMC0, XSC_DEV_MMC1 and XSC_DEV_MMC_BOTH
*/
xsc_status_t xsc_sd_set_power(xsc_device_t slot, xsc_power_t power, int force);
/**
* xsc_sd_get_power_status - Get the power status
* supports XSC_DEV_MMC0 and XSC_DEV_MMC1 only
*/
xsc_status_t xsc_sd_get_power_status(xsc_device_t slot, xsc_power_t *power);
/**
* xsc_nor_status - get the current status of the NOR chips.
* copy is the current selected copy and power is the current power state.
* If power is OFF, copy is undefined.
*/
xsc_status_t xsc_nor_status(xsc_libnor_copy_t *copy, xsc_power_t *power);
/**
* xsc_nor_select - Select the given NOR copy
*/
xsc_status_t xsc_nor_select(xsc_libnor_copy_t copy);
/**
* xsc_nor_set_power - Set the NOR power to ON or OFF
*/
xsc_status_t xsc_nor_set_power(xsc_power_t power);
/**
* Print the environment.
*/
void *xsc_fw_printenv(char *flashbuf, size_t flash_bufsize);
/**
* Search the environment for a variable.
* Return the value, if found, or NULL, if not found.
*/
char *xsc_fw_getenv(const char *name, char *flashbuf, size_t flash_bufsize);
/*
* Set/Clear a single variable in the environment.
* This is called in sequence to update the environment
* in RAM without updating the copy in flash after each set
*/
int xsc_fw_env_write(const char *name, const char *value, char *flashbuf, size_t flash_bufsize);
#ifdef __cplusplus
}
#endif
#endif // __LIBXIPHOS_H__

View File

@ -9,7 +9,7 @@ add_subdirectory(simple)
target_sources(${OBSW_NAME} PUBLIC main.cpp obsw.cpp)
add_subdirectory(boardtest)
#add_subdirectory(boardtest)
add_subdirectory(boardconfig)
add_subdirectory(comIF)

View File

@ -92,7 +92,7 @@ ReturnValue_t readToFile(std::string name, std::ifstream& file, std::string& fil
} // End of anonymous namespace
template <typename T, class = typename std::enable_if<std::is_integral<T>::value>::type>
template <typename T, class>
inline ReturnValue_t writeNumber(std::string key, T num) noexcept {
std::ostringstream oss;
oss << "xsc_scratch write " << key << " " << std::to_string(num);
@ -104,7 +104,7 @@ inline ReturnValue_t writeNumber(std::string key, T num) noexcept {
return HasReturnvaluesIF::RETURN_OK;
}
template <typename T, class = typename std::enable_if<std::is_integral<T>::value>::type>
template <typename T, class>
inline ReturnValue_t readNumber(std::string key, T& num) noexcept {
using namespace std;
ifstream file;

View File

@ -14,7 +14,7 @@ else()
endif()
if(NOT DEFINED ENV{CROSS_COMPILE})
set(CROSS_COMPILE "arm-linux-gnueabihf")
set(CROSS_COMPILE "")
message(STATUS
"No CROSS_COMPILE environmental variable set, using default ARM linux "
"cross compiler name ${CROSS_COMPILE}"
@ -29,15 +29,15 @@ endif()
message(STATUS "Using sysroot path: ${SYSROOT_PATH}")
set(CROSS_COMPILE_CC "${CROSS_COMPILE}-gcc")
set(CROSS_COMPILE_CXX "${CROSS_COMPILE}-g++")
set(CROSS_COMPILE_LD "${CROSS_COMPILE}-ld")
set(CROSS_COMPILE_AR "${CROSS_COMPILE}-ar")
set(CROSS_COMPILE_RANLIB "${CROSS_COMPILE}-ranlib")
set(CROSS_COMPILE_STRIP "${CROSS_COMPILE}-strip")
set(CROSS_COMPILE_NM "${CROSS_COMPILE}-nm")
set(CROSS_COMPILE_OBJCOPY "${CROSS_COMPILE}-objcopy")
set(CROSS_COMPILE_SIZE "${CROSS_COMPILE}-size")
set(CROSS_COMPILE_CC "${CROSS_COMPILE}gcc")
set(CROSS_COMPILE_CXX "${CROSS_COMPILE}g++")
set(CROSS_COMPILE_LD "${CROSS_COMPILE}ld")
set(CROSS_COMPILE_AR "${CROSS_COMPILE}ar")
set(CROSS_COMPILE_RANLIB "${CROSS_COMPILE}ranlib")
set(CROSS_COMPILE_STRIP "${CROSS_COMPILE}strip")
set(CROSS_COMPILE_NM "${CROSS_COMPILE}nm")
set(CROSS_COMPILE_OBJCOPY "${CROSS_COMPILE}objcopy")
set(CROSS_COMPILE_SIZE "${CROSS_COMPILE}size")
# At the very least, cross compile gcc and g++ have to be set!
find_program (CMAKE_C_COMPILER ${CROSS_COMPILE_CC} REQUIRED)
@ -47,12 +47,12 @@ find_program(CMAKE_SIZE ${CROSS_COMPILE_SIZE})
find_program(CMAKE_OBJCOPY ${CROSS_COMPILE_OBJCOPY})
find_program(CMAKE_STRIP ${CROSS_COMPILE_STRIP})
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSROOT "${SYSROOT_PATH}")
#set(CMAKE_CROSSCOMPILING TRUE)
#set(CMAKE_SYSROOT "${SYSROOT_PATH}")
# Define name of the target system
set(CMAKE_SYSTEM_NAME "Linux")
set(CMAKE_SYSTEM_PROCESSOR "armv7")
#set(CMAKE_SYSTEM_PROCESSOR "armv7")
# Define the compiler
set(CMAKE_C_COMPILER ${CROSS_COMPILE_CC})
@ -76,21 +76,21 @@ if(EIVE_SYSROOT_MAGIC)
endforeach()
endif()
set(CMAKE_PREFIX_PATH
"${CMAKE_PREFIX_PATH}"
# "${SYSROOT_PATH}/usr/lib/${CROSS_COMPILE}"
)
#set(CMAKE_PREFIX_PATH
# "${CMAKE_PREFIX_PATH}"
# # "${SYSROOT_PATH}/usr/lib/${CROSS_COMPILE}"
#)
set(C_FLAGS
-mcpu=cortex-a9
-mfpu=neon-vfpv3
-mfloat-abi=hard
# -mcpu=cortex-a9
# -mfpu=neon-vfpv3
# -mfloat-abi=hard
${COMMON_FLAGS}
-lgpiod
)
if (TGT_BSP MATCHES "arm/q7s")
set(C_FLAGS ${C_FLAGS} -lxiphos)
# set(C_FLAGS ${C_FLAGS} -lxiphos)
endif()
string (REPLACE ";" " " C_FLAGS "${C_FLAGS}")

View File

@ -1,7 +1,7 @@
add_subdirectory(csp)
add_subdirectory(utility)
add_subdirectory(callbacks)
add_subdirectory(boardtest)
#add_subdirectory(boardtest)
add_subdirectory(devices)
add_subdirectory(fsfwconfig)
add_subdirectory(obc)

View File

@ -3,7 +3,7 @@
#include <cstring>
void max1227::prepareExternallyClockedSingleChannelRead(uint8_t *spiBuf, uint8_t channel,
size_t &sz) {
uint32_t &sz) {
spiBuf[0] = buildConvByte(ScanModes::N_ONCE, channel, false);
spiBuf[1] = 0x00;
spiBuf[2] = 0x00;

View File

@ -58,7 +58,7 @@ constexpr uint8_t buildSetupByte(ClkSel clkSel, RefSel refSel, DiffSel diffSel)
* @param n
* @param sz
*/
void prepareExternallyClockedSingleChannelRead(uint8_t* spiBuf, uint8_t channel, size_t& sz);
void prepareExternallyClockedSingleChannelRead(uint8_t* spiBuf, uint8_t channel, uint32_t& sz);
/**
* If there is a wakeup delay, there needs to be a 65 us delay between sending