mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Cleanup stubs so that LTO can be used on Pinecil
This commit is contained in:
@@ -36,10 +36,21 @@ bool FRToSI2C::Mem_Read(uint16_t DevAddress, uint16_t read_address, uint8_t *p_b
|
|||||||
uint8_t state = I2C_START;
|
uint8_t state = I2C_START;
|
||||||
uint8_t in_rx_cycle = 0;
|
uint8_t in_rx_cycle = 0;
|
||||||
uint16_t timeout = 0;
|
uint16_t timeout = 0;
|
||||||
|
uint8_t tries = 0;
|
||||||
uint8_t i2c_timeout_flag = 0;
|
uint8_t i2c_timeout_flag = 0;
|
||||||
while (!(i2c_timeout_flag)) {
|
while (!(i2c_timeout_flag)) {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case I2C_START:
|
case I2C_START:
|
||||||
|
tries++;
|
||||||
|
if (tries > 64) {
|
||||||
|
i2c_stop_on_bus(I2C0);
|
||||||
|
/* i2c master sends STOP signal successfully */
|
||||||
|
while ((I2C_CTL0(I2C0) & 0x0200) && (timeout < I2C_TIME_OUT )) {
|
||||||
|
timeout++;
|
||||||
|
}
|
||||||
|
unlock();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (0 == in_rx_cycle) {
|
if (0 == in_rx_cycle) {
|
||||||
/* disable I2C0 */
|
/* disable I2C0 */
|
||||||
i2c_disable(I2C0);
|
i2c_disable(I2C0);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
#define TEMP_TMP36
|
#define TEMP_TMP36
|
||||||
#define ACCEL_BMA
|
#define ACCEL_BMA
|
||||||
#define HALL_SENSOR
|
#define HALL_SENSOR
|
||||||
//#define HALL_SI7210
|
#define HALL_SI7210
|
||||||
|
|
||||||
#define BATTFILTERDEPTH 32
|
#define BATTFILTERDEPTH 32
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "n200_func.h"
|
||||||
#include "riscv_encoding.h"
|
#include "riscv_encoding.h"
|
||||||
|
|
||||||
/*-----------------------------------------------------------
|
/*-----------------------------------------------------------
|
||||||
|
|||||||
13
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/clock_getres.c
vendored
Normal file
13
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/clock_getres.c
vendored
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <errno.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include "system_gd32vf103.h"
|
||||||
|
/* Get resolution of clock. */
|
||||||
|
int clock_getres(clockid_t clock_id, struct timespec *res)
|
||||||
|
{
|
||||||
|
res->tv_sec = 0;
|
||||||
|
res->tv_nsec = 1000000000 / SystemCoreClock;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
20
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/clock_gettime.c
vendored
Normal file
20
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/clock_gettime.c
vendored
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <errno.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
extern int _gettimeofday(struct timeval *tp, void *tzp);
|
||||||
|
|
||||||
|
/* Get current value of CLOCK and store it in tp. */
|
||||||
|
int clock_gettime(clockid_t clock_id, struct timespec *tp)
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
int retval = -1;
|
||||||
|
|
||||||
|
retval = _gettimeofday(&tv, NULL);
|
||||||
|
if (retval == 0) {
|
||||||
|
TIMEVAL_TO_TIMESPEC(&tv, tp);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
9
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/clock_settime.c
vendored
Normal file
9
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/clock_settime.c
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <errno.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
/* Set CLOCK to value TP. */
|
||||||
|
int clock_settime(clockid_t clock_id, const struct timespec *tp)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
11
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/close.c
vendored
Normal file
11
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/close.c
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#undef errno
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
|
int _close(int fd)
|
||||||
|
{
|
||||||
|
errno = EBADF;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
11
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/execve.c
vendored
Normal file
11
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/execve.c
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#undef errno
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
|
int _execve(char *name, char **argv, char **env)
|
||||||
|
{
|
||||||
|
errno = ENOMEM;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
9
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/exit.c
vendored
Normal file
9
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/exit.c
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
|
||||||
|
#include "n200_func.h"
|
||||||
|
void _exit(int fd)
|
||||||
|
{
|
||||||
|
while(1) {
|
||||||
|
__WFI();
|
||||||
|
}
|
||||||
|
}
|
||||||
11
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/fork.c
vendored
Normal file
11
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/fork.c
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#undef errno
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
|
int fork(void)
|
||||||
|
{
|
||||||
|
errno = EAGAIN;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
18
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/fstat.c
vendored
Normal file
18
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/fstat.c
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#undef errno
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
|
int _fstat(int file, struct stat *st)
|
||||||
|
{
|
||||||
|
if ((STDOUT_FILENO == file) || (STDERR_FILENO == file)) {
|
||||||
|
st->st_mode = S_IFCHR;
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
errno = EBADF;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
7
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/getpid.c
vendored
Normal file
7
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/getpid.c
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
int getpid(void)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
14
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/gettimeofday.c
vendored
Normal file
14
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/gettimeofday.c
vendored
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include "system_gd32vf103.h"
|
||||||
|
int _gettimeofday(struct timeval *tp, void *tzp)
|
||||||
|
{
|
||||||
|
uint64_t cycles;
|
||||||
|
|
||||||
|
cycles = __get_rv_cycle();
|
||||||
|
|
||||||
|
tp->tv_sec = cycles / SystemCoreClock;
|
||||||
|
tp->tv_usec = (cycles % SystemCoreClock) * 1000000 / SystemCoreClock;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
7
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/isatty.c
vendored
Normal file
7
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/isatty.c
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int _isatty(int fd)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
10
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/kill.c
vendored
Normal file
10
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/kill.c
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <errno.h>
|
||||||
|
#undef errno
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
|
int _kill(int pid, int sig)
|
||||||
|
{
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
11
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/link.c
vendored
Normal file
11
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/link.c
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#undef errno
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
|
int _link(char *old, char *new)
|
||||||
|
{
|
||||||
|
errno = EMLINK;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
10
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/lseek.c
vendored
Normal file
10
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/lseek.c
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#undef errno
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
|
int _lseek(int file, int offset, int whence)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
11
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/open.c
vendored
Normal file
11
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/open.c
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#undef errno
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
|
int _open(const char *name, int flags, int mode)
|
||||||
|
{
|
||||||
|
errno = ENOSYS;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
10
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/read.c
vendored
Normal file
10
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/read.c
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
|
||||||
|
ssize_t _read(int fd, void* ptr, size_t len) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
9
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/sbrk.c
vendored
Normal file
9
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/sbrk.c
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
void *_sbrk(ptrdiff_t incr)
|
||||||
|
{
|
||||||
|
return (void *)0;
|
||||||
|
}
|
||||||
8
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/stat.c
vendored
Normal file
8
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/stat.c
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
int _stat(char *file, struct stat *st)
|
||||||
|
{
|
||||||
|
st->st_mode = S_IFCHR;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
26
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/times.c
vendored
Normal file
26
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/times.c
vendored
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <sys/times.h>
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
extern int _gettimeofday(struct timeval *, void *);
|
||||||
|
|
||||||
|
clock_t _times(struct tms *buf)
|
||||||
|
{
|
||||||
|
static struct timeval t0;
|
||||||
|
struct timeval t;
|
||||||
|
long long utime;
|
||||||
|
|
||||||
|
/* When called for the first time, initialize t0. */
|
||||||
|
if (t0.tv_sec == 0 && t0.tv_usec == 0) {
|
||||||
|
_gettimeofday(&t0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
_gettimeofday(&t, 0);
|
||||||
|
|
||||||
|
utime = (t.tv_sec - t0.tv_sec) * 1000000 + (t.tv_usec - t0.tv_usec);
|
||||||
|
buf->tms_utime = utime * CLOCKS_PER_SEC / 1000000;
|
||||||
|
buf->tms_stime = buf->tms_cstime = buf->tms_cutime = 0;
|
||||||
|
|
||||||
|
return buf->tms_utime;
|
||||||
|
}
|
||||||
11
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/unlink.c
vendored
Normal file
11
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/unlink.c
vendored
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#undef errno
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
|
int _unlink(const char *name)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
12
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/wait.c
vendored
Normal file
12
workspace/TS100/Core/BSP/Pine64/Vendor/Lib/Stubs/wait.c
vendored
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
/* See LICENSE of license details. */
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
#undef errno
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
|
int _wait(int *status)
|
||||||
|
{
|
||||||
|
errno = ECHILD;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
/* See LICENSE of license details. */
|
/* See LICENSE of license details. */
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include "stub.h"
|
ssize_t _write(int fd, const void* ptr, size_t len)
|
||||||
|
|
||||||
ssize_t _read(int fd, void* ptr, size_t len)
|
|
||||||
{
|
{
|
||||||
return _stub(EBADF);
|
return -1;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,6 @@
|
|||||||
#include "n200_func.h"
|
#include "n200_func.h"
|
||||||
|
|
||||||
__attribute__((weak)) uintptr_t handle_nmi() {
|
__attribute__((weak)) uintptr_t handle_nmi() {
|
||||||
write(1, "nmi\n", 5);
|
|
||||||
_exit(1);
|
_exit(1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -15,10 +14,6 @@ __attribute__((weak)) uintptr_t handle_trap(uintptr_t mcause, uintptr_t sp) {
|
|||||||
if ((mcause & 0xFFF) == 0xFFF) {
|
if ((mcause & 0xFFF) == 0xFFF) {
|
||||||
handle_nmi();
|
handle_nmi();
|
||||||
}
|
}
|
||||||
write(1, "trap\n", 5);
|
|
||||||
printf("In trap handler, the mcause is %d\n", mcause);
|
|
||||||
printf("In trap handler, the mepc is 0x%x\n", read_csr(mepc));
|
|
||||||
printf("In trap handler, the mtval is 0x%x\n", read_csr(mbadaddr));
|
|
||||||
_exit(mcause);
|
_exit(mcause);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,3 +32,5 @@ void _init()
|
|||||||
void _fini()
|
void _fini()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ static inline int _stub(int err) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _exit(int code);
|
|
||||||
|
|
||||||
#endif /* _NUCLEI_SYS_STUB_H */
|
#endif /* _NUCLEI_SYS_STUB_H */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -1,47 +0,0 @@
|
|||||||
/* See LICENSE of license details. */
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <gd32vf103.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <sys/types.h>
|
|
||||||
|
|
||||||
#include "stub.h"
|
|
||||||
#include "gd32vf103.h"
|
|
||||||
|
|
||||||
typedef unsigned int size_t;
|
|
||||||
|
|
||||||
extern int _put_char(int ch) __attribute__((weak));
|
|
||||||
|
|
||||||
ssize_t _write(int fd, const void* ptr, size_t len) {
|
|
||||||
const uint8_t * current = (const uint8_t *) ptr;
|
|
||||||
|
|
||||||
// if (isatty(fd))
|
|
||||||
{
|
|
||||||
for (size_t jj = 0; jj < len; jj++) {
|
|
||||||
_put_char(current[jj]);
|
|
||||||
|
|
||||||
if (current[jj] == '\n') {
|
|
||||||
_put_char('\r');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
return _stub(EBADF);
|
|
||||||
}
|
|
||||||
|
|
||||||
int puts(const char* string) {
|
|
||||||
return _write(0, (const void *) string, strlen(string));
|
|
||||||
}
|
|
||||||
|
|
||||||
int _put_char(int ch)
|
|
||||||
{
|
|
||||||
usart_data_transmit(USART0, (uint8_t) ch );
|
|
||||||
while (usart_flag_get(USART0, USART_FLAG_TBE)== RESET){
|
|
||||||
}
|
|
||||||
|
|
||||||
return ch;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
#ifndef N200_FUNC_H
|
#ifndef N200_FUNC_H
|
||||||
#define N200_FUNC_H
|
#define N200_FUNC_H
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include "n200_timer.h"
|
#include "n200_timer.h"
|
||||||
#include "n200_eclic.h"
|
#include "n200_eclic.h"
|
||||||
|
|||||||
@@ -14,15 +14,16 @@
|
|||||||
bool hall_effect_present = false;
|
bool hall_effect_present = false;
|
||||||
void postRToSInit() {
|
void postRToSInit() {
|
||||||
// Any after RTos setup
|
// Any after RTos setup
|
||||||
#ifdef POW_PD
|
|
||||||
//Spawn all of the USB-C processors
|
|
||||||
fusb302_start_processing();
|
|
||||||
#endif
|
|
||||||
#ifdef HALL_SI7210
|
#ifdef HALL_SI7210
|
||||||
if (Si7210::detect()) {
|
if (Si7210::detect()) {
|
||||||
hall_effect_present = Si7210::init();
|
hall_effect_present = Si7210::init();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef POW_PD
|
||||||
|
//Spawn all of the USB-C processors
|
||||||
|
fusb302_start_processing();
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
int16_t getRawHallEffect() {
|
int16_t getRawHallEffect() {
|
||||||
if (hall_effect_present) {
|
if (hall_effect_present) {
|
||||||
|
|||||||
@@ -9,7 +9,9 @@
|
|||||||
#include "Si7210_defines.h"
|
#include "Si7210_defines.h"
|
||||||
#include "I2C_Wrapper.hpp"
|
#include "I2C_Wrapper.hpp"
|
||||||
bool Si7210::detect() {
|
bool Si7210::detect() {
|
||||||
return FRToSI2C::probe(SI7210_ADDRESS);
|
uint8_t temp;
|
||||||
|
return FRToSI2C::Mem_Read(SI7210_ADDRESS, SI7210_REG_ID, &temp, 1);
|
||||||
|
//Cant use normal probe as reg 0x00 is not used
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Si7210::init() {
|
bool Si7210::init() {
|
||||||
|
|||||||
@@ -8,16 +8,6 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
|
|
||||||
/* Variables */
|
|
||||||
//#undef errno
|
|
||||||
extern int errno;
|
|
||||||
extern int __io_putchar(int ch) __attribute__((weak));
|
|
||||||
extern int __io_getchar(void) __attribute__((weak));
|
|
||||||
|
|
||||||
register char *stack_ptr asm("sp");
|
|
||||||
|
|
||||||
char *__env[1] = { 0 };
|
|
||||||
char **environ = __env;
|
|
||||||
|
|
||||||
/* Functions */
|
/* Functions */
|
||||||
void initialise_monitor_handles() {
|
void initialise_monitor_handles() {
|
||||||
@@ -27,88 +17,3 @@ int _getpid(void) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _kill(int pid, int sig) {
|
|
||||||
errno = EINVAL;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void _exit(int status) {
|
|
||||||
_kill(status, -1);
|
|
||||||
while (1) {
|
|
||||||
} /* Make sure we hang here */
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((weak)) int _read(int file, char *ptr, int len) {
|
|
||||||
int DataIdx;
|
|
||||||
|
|
||||||
for (DataIdx = 0; DataIdx < len; DataIdx++) {
|
|
||||||
*ptr++ = __io_getchar();
|
|
||||||
}
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((weak)) int _write(int file, char *ptr, int len) {
|
|
||||||
int DataIdx;
|
|
||||||
|
|
||||||
for (DataIdx = 0; DataIdx < len; DataIdx++) {
|
|
||||||
__io_putchar(*ptr++);
|
|
||||||
}
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _close(int file) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _fstat(int file, struct stat *st) {
|
|
||||||
st->st_mode = S_IFCHR;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _isatty(int file) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _lseek(int file, int ptr, int dir) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _open(char *path, int flags, ...) {
|
|
||||||
/* Pretend like we always fail */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _wait(int *status) {
|
|
||||||
errno = ECHILD;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _unlink(char *name) {
|
|
||||||
errno = ENOENT;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _times(struct tms *buf) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _stat(char *file, struct stat *st) {
|
|
||||||
st->st_mode = S_IFCHR;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _link(char *old, char *new) {
|
|
||||||
errno = EMLINK;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _fork(void) {
|
|
||||||
errno = EAGAIN;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int _execve(char *name, char **argv, char **env) {
|
|
||||||
errno = ENOMEM;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
/* Includes */
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
/* Variables */
|
|
||||||
extern int errno;
|
|
||||||
register char *stack_ptr asm("sp");
|
|
||||||
|
|
||||||
/* Functions */
|
|
||||||
|
|
||||||
/**
|
|
||||||
_sbrk
|
|
||||||
Increase program data space. Malloc and related functions depend on this
|
|
||||||
**/
|
|
||||||
caddr_t _sbrk(int incr) {
|
|
||||||
return (void*) -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -386,7 +386,6 @@ static bool shouldBeSleeping() {
|
|||||||
#ifdef HALL_SENSOR
|
#ifdef HALL_SENSOR
|
||||||
//If the hall effect sensor is enabled in the build, check if its over threshold, and if so then we force sleep
|
//If the hall effect sensor is enabled in the build, check if its over threshold, and if so then we force sleep
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -620,9 +619,7 @@ uint8_t idleScreenBGF[sizeof(idleScreenBG)];
|
|||||||
/* StartGUITask function */
|
/* StartGUITask function */
|
||||||
void startGUITask(void const *argument __unused) {
|
void startGUITask(void const *argument __unused) {
|
||||||
OLED::initialize(); // start up the LCD
|
OLED::initialize(); // start up the LCD
|
||||||
// for (;;) {
|
|
||||||
// osDelay(2000);
|
|
||||||
// }
|
|
||||||
uint8_t tempWarningState = 0;
|
uint8_t tempWarningState = 0;
|
||||||
bool buttonLockout = false;
|
bool buttonLockout = false;
|
||||||
bool tempOnDisplay = false;
|
bool tempOnDisplay = false;
|
||||||
@@ -657,6 +654,14 @@ void startGUITask(void const *argument __unused) {
|
|||||||
OLED::refresh();
|
OLED::refresh();
|
||||||
waitForButtonPressOrTimeout(10000);
|
waitForButtonPressOrTimeout(10000);
|
||||||
}
|
}
|
||||||
|
if (getHallSensorFitted()) {
|
||||||
|
OLED::clearScreen();
|
||||||
|
OLED::setFont(1);
|
||||||
|
OLED::setCursor(0, 0);
|
||||||
|
OLED::printNumber(5000, 4, 0);
|
||||||
|
OLED::refresh();
|
||||||
|
waitForButtonPressOrTimeout(10000);
|
||||||
|
}
|
||||||
if (systemSettings.autoStartMode) {
|
if (systemSettings.autoStartMode) {
|
||||||
// jump directly to the autostart mode
|
// jump directly to the autostart mode
|
||||||
if (systemSettings.autoStartMode == 1) {
|
if (systemSettings.autoStartMode == 1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user