Adapted win32 port to changes in sys.h (for NO_SYS=1 only)

This commit is contained in:
goldsimon 2009-04-27 20:14:04 +00:00
parent 105dc66785
commit e0675d8b82
4 changed files with 36 additions and 23 deletions

View File

@ -62,6 +62,7 @@ typedef unsigned long u32_t;
typedef signed long s32_t;
typedef size_t mem_ptr_t;
typedef u32_t sys_prot_t;
/* Define (sn)printf formatters for these lwIP types */
#define U16_F "hu"
@ -70,6 +71,7 @@ typedef size_t mem_ptr_t;
#define U32_F "lu"
#define S32_F "ld"
#define X32_F "lx"
#define SZT_F U32_F
/* Compiler hints for packing structures */
#define PACK_STRUCT_STRUCT
@ -81,7 +83,13 @@ typedef size_t mem_ptr_t;
#define LWIP_PLATFORM_ASSERT(x) do {printf("Assertion \"%s\" failed at line %d in %s\n", \
x, __LINE__, __FILE__); fflush(NULL); abort();} while(0)
#define LWIP_ERROR(message, expression, handler) do { if (!(expression)) { \
printf("Assertion \"%s\" failed at line %d in %s\n", expression, __LINE__, __FILE__); \
fflush(NULL);handler;}} while(0)
/* C runtime functions redefined */
#define snprintf _snprintf
u32_t dns_lookup_external_hosts_file(const char *name);
#endif /* __ARCH_CC_H__ */

View File

@ -32,8 +32,6 @@
#ifndef __ARCH_SYS_ARCH_H__
#define __ARCH_SYS_ARCH_H__
typedef u32_t sys_prot_t;
/* HANDLE is used for sys_sem_t but we won't include windows.h */
typedef void* sys_sem_t;
#define SYS_SEM_NULL NULL

View File

@ -65,6 +65,29 @@ u32_t sys_now()
return sys_get_ms_longlong();
}
CRITICAL_SECTION critSec;
void InitSysArchProtect()
{
InitializeCriticalSection(&critSec);
}
u32_t sys_arch_protect()
{
EnterCriticalSection(&critSec);
return 0;
}
void sys_arch_unprotect(u32_t pval)
{
LWIP_UNUSED_ARG(pval);
LeaveCriticalSection(&critSec);
}
void msvc_sys_init()
{
sys_init_timing();
InitSysArchProtect();
}
#if !NO_SYS
#define MAX_QUEUE_ENTRIES 100
@ -82,33 +105,17 @@ struct lwip_mbox {
};
struct threadlist *lwip_win32_threads = NULL;
CRITICAL_SECTION critSec;
void InitSysArchProtect()
void sys_init()
{
InitializeCriticalSection(&critSec);
}
u32_t sys_arch_protect()
{
EnterCriticalSection(&critSec);
return 0;
}
void sys_arch_unprotect(u32_t pval)
{
LWIP_UNUSED_ARG(pval);
LeaveCriticalSection(&critSec);
msvc_sys_init();
}
void do_sleep(int ms)
{
Sleep(ms);
}
void sys_init(void)
{
sys_init_timing();
InitSysArchProtect();
}
sys_sem_t sys_sem_new(u8_t count)
{
HANDLE new_sem = NULL;

View File

@ -84,7 +84,7 @@
#if NO_SYS
/* port-defined functions used for timer execution */
void sys_init_timing();
void msvc_sys_init();
u32_t sys_now();
#endif /* NO_SYS */
@ -135,7 +135,7 @@ static timers_infos timers_table[] = {
static void
nosys_init()
{
sys_init_timing();
msvc_sys_init();
lwip_init();
}