tweak lwipopts.h
This commit is contained in:
26
port/arch/sys_arch.c
Normal file
26
port/arch/sys_arch.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#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();
|
||||
}
|
||||
Reference in New Issue
Block a user