From 0ddc739a1873a3fdb2b3045780c9528aab50a27f Mon Sep 17 00:00:00 2001 From: root Date: Thu, 10 Jul 2014 23:18:03 -0800 Subject: [PATCH] add some comments of lwip porting --- bsp/mini2440/.dm9000.c.swp | Bin 0 -> 16384 bytes components/net/lwip-1.4.1/src/arch/sys_arch.c | 46 +++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 bsp/mini2440/.dm9000.c.swp diff --git a/bsp/mini2440/.dm9000.c.swp b/bsp/mini2440/.dm9000.c.swp new file mode 100644 index 0000000000000000000000000000000000000000..6fd20765798cdbc9ffd0811c228ec3a4c44db56a GIT binary patch literal 16384 zcmeI2ZHya78OOJUkT@>{Q3(W6(BulmPM!1m&UwA-wXV;1XK^pa_K{SOE_?PkUd3KJ zyX(Z4q*WmwKp;VhfbyYmVS5k%rnnC^UO1|GmpKZek8ZR4vdZ~c)deWcK+qN#ZPR$p)~N`YBn7z z-sn}~D~4`vB&8^cTC>3u)oP`(x^gCQ+;9?>v)8FvT(2Zn>{g;-n8sKtr6wwkL#nEd zmN!-zN`xK=J#fn&*rAM%CDl7ecC$O)xqQp5Lc!1jp$9?_gdPYz5PBf=KHHYsmlD7S-);5Nw{c%8%hOY-yU`1}OkzZU`|a}%GxivQ2Z&u_u|d%%NGMD^h- z^g!r=&;y|dLJx!<2t5#bAoM`!fzSh?2SN{o9{At!fL?L${-2=)0KW659KiLRigFeF z1biDj2`+<6;5>K)90T`(NiYF+f$iYsw=2q@!By}B@O|(-@I~+_SOz690(OI~;ME<9 z@(=J+@HBWBoCRlq0gi*CAO|MEL2v+!00wSsSCl`1--8#x*TEIA3igA2;9cN%+Z5%u z;G5t)_#`NU6>txj05Na}`1@8xc?G--u7bzFm%w?T0}VU~?gcj@it;b;SMYQ2BKR5j z26zNK4C>$nm;yV%3tJTBhu|W392^1L!8Y*vX6OX3fotFia0#3Q_knxC4sh*lit-fr zIM6@}jDuG;DauRWI=BkH0=^8&APuHK6ucko1h2hSQT_ye1D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)Nz$Gb@QL=>PJb9(~01Ih_T5<>U6L{%J==!R*$p==>T!phS4^@LD59!6y3;S z2K6AD;AZDo&3eRdmMq(#rASv%&cWYQ6mHOvHqPF5RJK90a=mHu-gcsJgNDe;o4xI* zY=dSr*}cuEtbYTmpLxT6(LtFq!(DJlPGkMcN7bi z>20Ukpxhi*;VKRiBFT+wIhG|7lQLg{d=W|1HJ3|~uF4XmbbY7ocrz(C2J zJ`I$eqJZ_~kdO)$+YKfC-1SZGDCXMS;Q#;t literal 0 HcmV?d00001 diff --git a/components/net/lwip-1.4.1/src/arch/sys_arch.c b/components/net/lwip-1.4.1/src/arch/sys_arch.c index 356dc101cf..287c861f04 100644 --- a/components/net/lwip-1.4.1/src/arch/sys_arch.c +++ b/components/net/lwip-1.4.1/src/arch/sys_arch.c @@ -29,6 +29,11 @@ #include +/* + * Initialize the network interface device + * + * @return the operation status, ERR_OK on OK, ERR_IF on error + */ static err_t netif_device_init(struct netif *netif) { struct eth_device *ethif; @@ -53,7 +58,9 @@ static err_t netif_device_init(struct netif *netif) return ERR_IF; } - +/* + * Initialize the ethernetif layer and set network interface device up + */ static void tcpip_init_done_callback(void *arg) { rt_device_t device; @@ -182,6 +189,11 @@ void lwip_sys_init(void) lwip_system_init(); } +/* + * Create a new semaphore + * + * @return the operation status, ERR_OK on OK; others on error + */ err_t sys_sem_new(sys_sem_t *sem, u8_t count) { static unsigned short counter = 0; @@ -204,17 +216,31 @@ err_t sys_sem_new(sys_sem_t *sem, u8_t count) } } +/* + * Deallocate a semaphore + */ void sys_sem_free(sys_sem_t *sem) { RT_DEBUG_NOT_IN_INTERRUPT; rt_sem_delete(*sem); } +/* + * Signal a semaphore + */ void sys_sem_signal(sys_sem_t *sem) { rt_sem_release(*sem); } +/* + * Block the thread while waiting for the semaphore to be signaled + * + * @return If the timeout argument is non-zero, it will return the number of milliseconds + * spent waiting for the semaphore to be signaled; If the semaphore isn't signaled + * within the specified time, it will return SYS_ARCH_TIMEOUT; If the thread doesn't + * wait for the semaphore, it will return zero + */ u32_t sys_arch_sem_wait(sys_sem_t *sem, u32_t timeout) { rt_err_t ret; @@ -354,6 +380,11 @@ void sys_mutex_set_invalid(sys_mutex_t *mutex) /* ====================== Mailbox ====================== */ +/* + * Create an empty mailbox for maximum "size" elements + * + * @return the operation status, ERR_OK on OK; others on error + */ err_t sys_mbox_new(sys_mbox_t *mbox, int size) { static unsigned short counter = 0; @@ -376,6 +407,9 @@ err_t sys_mbox_new(sys_mbox_t *mbox, int size) return ERR_MEM; } +/* + * Deallocate a mailbox + */ void sys_mbox_free(sys_mbox_t *mbox) { RT_DEBUG_NOT_IN_INTERRUPT; @@ -399,6 +433,11 @@ void sys_mbox_post(sys_mbox_t *mbox, void *msg) return; } +/* + * Try to post the "msg" to the mailbox + * + * @return return ERR_OK if the "msg" is posted, ERR_MEM if the mailbox is full + */ err_t sys_mbox_trypost(sys_mbox_t *mbox, void *msg) { if (rt_mb_send(*mbox, (rt_uint32_t)msg) == RT_EOK) @@ -502,6 +541,11 @@ void sys_mbox_set_invalid(sys_mbox_t *mbox) /* ====================== System ====================== */ +/* + * Start a new thread named "name" with priority "prio" that will begin + * its execution in the function "thread()". The "arg" argument will be + * passed as an argument to the thread() function + */ sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, -- GitLab