mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Reduce IRAM memory footprint
This commit is contained in:
+8
-7
@@ -85,9 +85,9 @@ uip_neighbor_periodic(void)
|
|||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
uip_neighbor_add(uip_ipaddr_t ipaddr, __xdata struct uip_neighbor_addr *addr)
|
uip_neighbor_add(__xdata uip_ipaddr_t ipaddr, __xdata struct uip_neighbor_addr *addr)
|
||||||
{
|
{
|
||||||
int i, oldest;
|
uint16_t i, oldest;
|
||||||
u8_t oldest_time;
|
u8_t oldest_time;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -130,12 +130,13 @@ uip_neighbor_add(uip_ipaddr_t ipaddr, __xdata struct uip_neighbor_addr *addr)
|
|||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
__xdata static struct neighbor_entry *
|
__xdata static struct neighbor_entry *
|
||||||
find_entry(uip_ipaddr_t ipaddr)
|
find_entry(__xdata uip_ipaddr_t ipaddr)
|
||||||
{
|
{
|
||||||
int i;
|
uint16_t i;
|
||||||
|
|
||||||
for(i = 0; i < ENTRIES; ++i) {
|
for(i = 0; i < ENTRIES; ++i) {
|
||||||
if(uip_ipaddr_cmp(entries[i].ipaddr, ipaddr)) {
|
// if(uip_ipaddr_cmp(entries[i].ipaddr, ipaddr)) {
|
||||||
|
if (entries[i].ipaddr[0] == ipaddr[0] && entries[i].ipaddr[1] == ipaddr[1]) {
|
||||||
return &entries[i];
|
return &entries[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,7 +144,7 @@ find_entry(uip_ipaddr_t ipaddr)
|
|||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
uip_neighbor_update(uip_ipaddr_t ipaddr)
|
uip_neighbor_update(__xdata uip_ipaddr_t ipaddr)
|
||||||
{
|
{
|
||||||
struct neighbor_entry *e;
|
struct neighbor_entry *e;
|
||||||
|
|
||||||
@@ -154,7 +155,7 @@ uip_neighbor_update(uip_ipaddr_t ipaddr)
|
|||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
__xdata struct uip_neighbor_addr *
|
__xdata struct uip_neighbor_addr *
|
||||||
uip_neighbor_lookup(uip_ipaddr_t ipaddr)
|
uip_neighbor_lookup(__xdata uip_ipaddr_t ipaddr)
|
||||||
{
|
{
|
||||||
__xdata struct neighbor_entry *e;
|
__xdata struct neighbor_entry *e;
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -54,9 +54,9 @@ struct uip_neighbor_addr {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void uip_neighbor_init(void);
|
void uip_neighbor_init(void);
|
||||||
void uip_neighbor_add(uip_ipaddr_t ipaddr, __xdata struct uip_neighbor_addr *addr);
|
void uip_neighbor_add(__xdata uip_ipaddr_t ipaddr, __xdata struct uip_neighbor_addr *addr);
|
||||||
void uip_neighbor_update(uip_ipaddr_t ipaddr);
|
void uip_neighbor_update(__xdata uip_ipaddr_t ipaddr);
|
||||||
__xdata struct uip_neighbor_addr *uip_neighbor_lookup(uip_ipaddr_t ipaddr);
|
__xdata struct uip_neighbor_addr *uip_neighbor_lookup(__xdata uip_ipaddr_t ipaddr);
|
||||||
void uip_neighbor_periodic(void);
|
void uip_neighbor_periodic(void);
|
||||||
|
|
||||||
#endif /* __UIP-NEIGHBOR_H__ */
|
#endif /* __UIP-NEIGHBOR_H__ */
|
||||||
|
|||||||
@@ -397,9 +397,9 @@ uip_init(void) __banked
|
|||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
#if UIP_ACTIVE_OPEN
|
#if UIP_ACTIVE_OPEN
|
||||||
__xdata struct uip_conn *
|
__xdata struct uip_conn *
|
||||||
uip_connect(register __xdata uip_ipaddr_t *ripaddr, register u16_t rport)
|
uip_connect(register __xdata uip_ipaddr_t *ripaddr, __xdata u16_t rport)
|
||||||
{
|
{
|
||||||
register __xdata struct uip_conn *conn, *cconn;
|
__xdata struct uip_conn *conn, *cconn;
|
||||||
|
|
||||||
/* Find an unused local port. */
|
/* Find an unused local port. */
|
||||||
again:
|
again:
|
||||||
@@ -411,7 +411,7 @@ uip_connect(register __xdata uip_ipaddr_t *ripaddr, register u16_t rport)
|
|||||||
|
|
||||||
/* Check if this port is already in use, and if so try to find
|
/* Check if this port is already in use, and if so try to find
|
||||||
another one. */
|
another one. */
|
||||||
for(c = 0; c < UIP_CONNS; ++c) {
|
for(uint8_t c = 0; c < UIP_CONNS; ++c) {
|
||||||
conn = &uip_conns[c];
|
conn = &uip_conns[c];
|
||||||
if(conn->tcpstateflags != UIP_CLOSED &&
|
if(conn->tcpstateflags != UIP_CLOSED &&
|
||||||
conn->lport == htons(lastport)) {
|
conn->lport == htons(lastport)) {
|
||||||
@@ -420,7 +420,7 @@ uip_connect(register __xdata uip_ipaddr_t *ripaddr, register u16_t rport)
|
|||||||
}
|
}
|
||||||
|
|
||||||
conn = 0;
|
conn = 0;
|
||||||
for(c = 0; c < UIP_CONNS; ++c) {
|
for(uint8_t c = 0; c < UIP_CONNS; ++c) {
|
||||||
cconn = &uip_conns[c];
|
cconn = &uip_conns[c];
|
||||||
if(cconn->tcpstateflags == UIP_CLOSED) {
|
if(cconn->tcpstateflags == UIP_CLOSED) {
|
||||||
conn = cconn;
|
conn = cconn;
|
||||||
|
|||||||
@@ -495,7 +495,7 @@ void uip_unlisten(u16_t port);
|
|||||||
* or NULL if no connection could be allocated.
|
* or NULL if no connection could be allocated.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
__xdata struct uip_conn *uip_connect(register __xdata uip_ipaddr_t *ripaddr, register u16_t port);
|
__xdata struct uip_conn *uip_connect(register __xdata uip_ipaddr_t *ripaddr, __xdata u16_t port);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user