26 lines
462 B
C
26 lines
462 B
C
#include "sys_arch.h"
|
|
|
|
#include "ch32fun.h"
|
|
#include "lwip/sys.h"
|
|
#include "systick.h"
|
|
|
|
static unsigned long next = 1;
|
|
|
|
int rand(void) {
|
|
next = next * 1103515245 + 12345;
|
|
return (unsigned int)(next / 65536) % 32768;
|
|
}
|
|
|
|
void srand(unsigned int seed) { next = seed; }
|
|
|
|
uint32_t sys_now(void) { return millis(); }
|
|
|
|
sys_prot_t sys_arch_protect(void) {
|
|
__disable_irq();
|
|
return 1;
|
|
}
|
|
|
|
void sys_arch_unprotect(sys_prot_t pval) {
|
|
(void)pval;
|
|
__enable_irq();
|
|
} |