MityDSP Documentation Index
Macros | Functions | Variables
sys_arch.c File Reference

MityDSP architecture-specific routines for lwIP. More...

#include <stdio.h>
#include <std.h>
#include <c62.h>
#include <clk.h>
#include <sem.h>
#include "lwip/def.h"
#include "lwip/sys.h"
#include "lwip/mem.h"
#include "arch/sys_arch.h"

Macros

#define LOG_DEBUG   0

Functions

void sys_set_max_lwip_threads (int anMaxTasks)
int sys_get_max_lwip_threads (void)
void sys_set_mbx_queue_entries (int anMbxEntries)
int sys_get_mbx_queue_entries (void)
void sys_init (void)
sys_sem_t sys_sem_new (u8_t anInitCount)
void sys_sem_free (sys_sem_t ahSem)
void sys_sem_signal (sys_sem_t ahSem)
u32_t sys_arch_sem_wait (sys_sem_t ahSem, u32_t anTimeout)
sys_mbox_t sys_mbox_new (int anSize)
void sys_mbox_free (sys_mbox_t ahMbox)
void sys_mbox_post (sys_mbox_t ahMbox, void *apMsg)
err_t sys_mbox_trypost (sys_mbox_t ahMbox, void *apMsg)
u32_t sys_arch_mbox_fetch (sys_mbox_t ahMbox, void **apMsg, u32_t anTimeout)
u32_t sys_arch_mbox_tryfetch (sys_mbox_t ahMbox, void **apMsg)
struct sys_timeouts * sys_arch_timeouts (void)
int sys_thread_register (sys_thread_t ahThread)
int sys_thread_unregister (sys_thread_t ahThread)
int sys_thread_priority (sys_thread_t ahThread, int anPrio)
sys_thread_t sys_thread_new (char *apName, void(*ahThread)(void *), void *apArg, int anStacksize, int anPrio)
void sys_arch_assert (const char *apMsg, int anLine, const char *apFile)

Variables

NetAssertCB DSPNet_nacb_func
int DSPNet_tcpip_priority
static int fnLwipTaskMax = 5
 Set default for the number of concurrent lwIP threads.
static int fnMbxQueueEntries = PBUF_POOL_SIZE / 2
 Set default lwIP mailbox depths.
static struct sys_timeouts * fpLwipTimeouts = NULL
 This structure contains a linked list of timeouts managed on a per thread basis.
static TSK_Handle * fpLwipTasks = NULL
 Task handles associated with the fpLwipTimeouts structure.
static LCK_Handle fhMutex = NULL
 Local lock for thread creation/modification functions.
static unsigned int fnTicksPerMsec = 1
 MityDSP clock ticks per millisecond.
tsSysArchStats fsSysArchStats
 Statistic storage.
LCK_Handle ghLwipLock = NULL
 Define the lwIP Critical Section lock.
void(* lwip_printf )(const char *fmt,...) = NULL
 Define default lwip_printf function.

Detailed Description

MityDSP architecture-specific routines for lwIP.

o 0 | / Copyright (c) 2005-2007 (CL)—o Critical Link, LLC \ O


Macro Definition Documentation

#define LOG_DEBUG   0

Function Documentation

void sys_set_max_lwip_threads ( int  anMaxTasks)

Set number of threads allowed to use lwIP concurrently.

Note:
Must be called prior to stack initialization.
Parameters:
[in]anMaxTasksMaximum lwIP threads allowed.
Returns:
None.
int sys_get_max_lwip_threads ( void  )

Get number of threads allowed to use lwIP concurrently.

Returns:
Concurrent threads allowed.
void sys_set_mbx_queue_entries ( int  anMbxEntries)

Set number of queue entries created in lwIP mailboxes.

Note:
Must be called prior to stack initialization.
Parameters:
[in]anMbxEntriesNumber of entries to create.
Returns:
None.
int sys_get_mbx_queue_entries ( void  )

Get number of queue entries used in lwIP mailboxes.

Returns:
Queue entries configured.
void sys_init ( void  )

Initialize internal lwIP data structures.

Returns:
None.
sys_sem_t sys_sem_new ( u8_t  anInitCount)

Create and initialize a semaphore.

Parameters:
[in]anInitCountInitial semaphore count.
Returns:
Semaphore handle.
void sys_sem_free ( sys_sem_t  ahSem)

Delete a previously created semaphore.

Parameters:
[in]ahSemSemaphore handle.
Returns:
None.
void sys_sem_signal ( sys_sem_t  ahSem)

Signal a previously created semaphore.

Parameters:
[in]ahSemSemaphore handle.
Returns:
None.
u32_t sys_arch_sem_wait ( sys_sem_t  ahSem,
u32_t  anTimeout 
)

Pend on a previously created semaphore.

Note:
A timeout of zero causes the thread to pend indefinitely.
Parameters:
[in]ahSemSemaphore handle.
[in]anTimeoutTimeout (msec).
Returns:
Time spent waiting (if successful), or SYS_ARCH_TIMEOUT.
sys_mbox_t sys_mbox_new ( int  anSize)

Create a mailbox to hold generic pointer values, with a queue length of fnMbxQueueEntries.

Parameters:
[in]anSizeMailbox depth (0=use default)
Returns:
Mailbox handle.
void sys_mbox_free ( sys_mbox_t  ahMbox)

Delete a previously created mailbox.

Parameters:
[in]ahMboxMailbox handle.
Returns:
None.
void sys_mbox_post ( sys_mbox_t  ahMbox,
void *  apMsg 
)

Post a message to a previously created mailbox, waiting indefinitely for space to become available.

Parameters:
[in]ahMboxMailbox handle.
[in]apMsgMessage to post.
Returns:
None.
err_t sys_mbox_trypost ( sys_mbox_t  ahMbox,
void *  apMsg 
)

Attempt to post a message to a previously created mailbox, without blocking.

Parameters:
[in]ahMboxMailbox handle.
[in]apMsgMessage to post.
Returns:
ERR_OK upon success, ERR_MEM if mailbox full.
u32_t sys_arch_mbox_fetch ( sys_mbox_t  ahMbox,
void **  apMsg,
u32_t  anTimeout 
)

Wait for a message from a previously created mailbox.

Note:
A timeout of zero causes the thread to wait indefinitely.
Parameters:
[in]ahMboxMailbox handle.
[in]apMsgStorage for returned message.
[in]anTimeoutTimeout (msec).
Returns:
Time spent waiting (if successful), or SYS_ARCH_TIMEOUT.
u32_t sys_arch_mbox_tryfetch ( sys_mbox_t  ahMbox,
void **  apMsg 
)

Attempt to get a message IFF a mailbox is not empty.

Parameters:
[in]ahMboxMailbox handle.
[in]apMsgStorage for returned message.
Returns:
SYS_MBOX_EMPTY if no message found, otherwise zero.
struct sys_timeouts* sys_arch_timeouts ( void  )
read

Attempt to find the timeout structure for the current thread.

Returns:
Pointer to the timeout structure, or NULL if the current thread is not registered.
int sys_thread_register ( sys_thread_t  ahThread)

Attempt to register a specified thread with lwIP.

Parameters:
[in]ahThreadHandle of thread to register.
Returns:
Index into timeout structure (if successful), or -1 if failed.
int sys_thread_unregister ( sys_thread_t  ahThread)

Attempt to un-register a specified thread with lwIP.

Parameters:
[in]ahThreadHandle of thread to register.
Returns:
0 (if successful), or -1 if failed.
int sys_thread_priority ( sys_thread_t  ahThread,
int  anPrio 
)

Attempt to change the priority of a previously created thread.

Parameters:
[in]ahThreadHandle of thread to register.
[in]anPrioNew thread priority.
Returns:
Index into timeout structure (if successful), or -1 if failed.
sys_thread_t sys_thread_new ( char *  apName,
void(*)(void *)  ahThread,
void *  apArg,
int  anStacksize,
int  anPrio 
)

Attempt to create a new thread and register it with lwIP.

Parameters:
[in]apNamePointer to static thread name string
[in]ahThreadFunction to start as a thread.
[in]apArgArgument to provided function.
[in]anStacksizeStack size to allocate (bytes).
[in]anPrioThread priority.
Note:
All lwIP threads must be lower priority than the stack itself.
Returns:
Handle of created thread (if successful), or NULL if failed.
void sys_arch_assert ( const char *  apMsg,
int  anLine,
const char *  apFile 
)

Upon failure of an assertion this routine creates an error string, passes it to any registered assertion handlers, and then aborts the current thread.

Parameters:
[in]apMsgText message associate with assertion.
[in]anLineLine number assertion occurred on.
[in]apFileFile that assertion occurred in.
Returns:
None (doesn't return).

Variable Documentation

NetAssertCB DSPNet_nacb_func
int DSPNet_tcpip_priority
int fnLwipTaskMax = 5
static

Set default for the number of concurrent lwIP threads.

int fnMbxQueueEntries = PBUF_POOL_SIZE / 2
static

Set default lwIP mailbox depths.

struct sys_timeouts* fpLwipTimeouts = NULL
static

This structure contains a linked list of timeouts managed on a per thread basis.

TSK_Handle* fpLwipTasks = NULL
static

Task handles associated with the fpLwipTimeouts structure.

LCK_Handle fhMutex = NULL
static

Local lock for thread creation/modification functions.

unsigned int fnTicksPerMsec = 1
static

MityDSP clock ticks per millisecond.

tsSysArchStats fsSysArchStats

Statistic storage.

LCK_Handle ghLwipLock = NULL

Define the lwIP Critical Section lock.

void(* lwip_printf)(const char *fmt,...) = NULL

Define default lwip_printf function.


  
Generated on Mon Apr 22 2013 11:33:29 for MityDSP lwIP Port by  Doxygen Version 1.8.1.1
Copyright © 2009, Critical Link LLC, All rights reserved.