fix 32bit & 64bit value to pointer interconvert.

This commit is contained in:
geniusgogo 2022-01-27 17:23:47 +08:00 committed by Bernard Xiong
parent 039e2ff530
commit 658b2c1027
9 changed files with 16 additions and 16 deletions

View File

@ -51,7 +51,7 @@ public:
else
tick = rt_tick_from_millisecond(millisec);
return rt_mb_send_wait(&mID, (rt_uint32_t)mptr, tick) == RT_EOK;
return rt_mb_send_wait(&mID, (rt_ubase_t)mptr, tick) == RT_EOK;
}
/** Get a mail from a queue.

View File

@ -17,7 +17,7 @@
// todo: remove repleat code
#define RT_MEMHEAP_SIZE RT_ALIGN(sizeof(struct rt_lwp_memheap_item), RT_ALIGN_SIZE)
#define MEMITEM_SIZE(item) ((rt_uint32_t)item->next - (rt_uint32_t)item - RT_MEMHEAP_SIZE)
#define MEMITEM_SIZE(item) ((rt_ubase_t)item->next - (rt_ubase_t)item - RT_MEMHEAP_SIZE)
#ifndef LWP_MEM_PAGE_SIZE
#define LWP_MEM_PAGE_SIZE (4 * 1024)

View File

@ -29,7 +29,7 @@
#define RT_MEMHEAP_MINIALLOC 12
#define RT_MEMHEAP_SIZE RT_ALIGN(sizeof(struct rt_lwp_memheap_item), RT_ALIGN_SIZE)
#define MEMITEM_SIZE(item) ((rt_uint32_t)item->next - (rt_uint32_t)item - RT_MEMHEAP_SIZE)
#define MEMITEM_SIZE(item) ((rt_ubase_t)item->next - (rt_ubase_t)item - RT_MEMHEAP_SIZE)
/*
* The initialized memory pool will be:

View File

@ -450,7 +450,7 @@ void sys_mbox_post(sys_mbox_t *mbox, void *msg)
{
RT_DEBUG_NOT_IN_INTERRUPT;
rt_mb_send_wait(*mbox, (rt_uint32_t)msg, RT_WAITING_FOREVER);
rt_mb_send_wait(*mbox, (rt_ubase_t)msg, RT_WAITING_FOREVER);
return;
}
@ -462,7 +462,7 @@ void sys_mbox_post(sys_mbox_t *mbox, void *msg)
*/
err_t sys_mbox_trypost(sys_mbox_t *mbox, void *msg)
{
if (rt_mb_send(*mbox, (rt_uint32_t)msg) == RT_EOK)
if (rt_mb_send(*mbox, (rt_ubase_t)msg) == RT_EOK)
return ERR_OK;
return ERR_MEM;

View File

@ -374,7 +374,7 @@ static err_t ethernetif_linkoutput(struct netif *netif, struct pbuf *p)
/* send a message to eth tx thread */
msg.netif = netif;
msg.buf = p;
if (rt_mb_send(&eth_tx_thread_mb, (rt_uint32_t) &msg) == RT_EOK)
if (rt_mb_send(&eth_tx_thread_mb, (rt_ubase_t) &msg) == RT_EOK)
{
/* waiting for ack */
rt_sem_take(&(enetif->tx_ack), RT_WAITING_FOREVER);
@ -556,7 +556,7 @@ rt_err_t eth_device_ready(struct eth_device* dev)
if(dev->rx_notice == RT_FALSE)
{
dev->rx_notice = RT_TRUE;
return rt_mb_send(&eth_rx_thread_mb, (rt_uint32_t)dev);
return rt_mb_send(&eth_rx_thread_mb, (rt_ubase_t)dev);
}
else
return RT_EOK;
@ -581,7 +581,7 @@ rt_err_t eth_device_linkchange(struct eth_device* dev, rt_bool_t up)
rt_hw_interrupt_enable(level);
/* post message to ethernet thread */
return rt_mb_send(&eth_rx_thread_mb, (rt_uint32_t)dev);
return rt_mb_send(&eth_rx_thread_mb, (rt_ubase_t)dev);
}
#else
/* NOTE: please not use it in interrupt when no RxThread exist */

View File

@ -605,7 +605,7 @@ rt_err_t eth_device_ready(struct eth_device* dev)
if(dev->rx_notice == RT_FALSE)
{
dev->rx_notice = RT_TRUE;
return rt_mb_send(&eth_rx_thread_mb, (rt_uint32_t)dev);
return rt_mb_send(&eth_rx_thread_mb, (rt_ubase_t)dev);
}
else
return RT_EOK;

View File

@ -469,7 +469,7 @@ void sys_mbox_post(sys_mbox_t *mbox, void *msg)
{
RT_DEBUG_NOT_IN_INTERRUPT;
rt_mb_send_wait(*mbox, (rt_uint32_t)msg, RT_WAITING_FOREVER);
rt_mb_send_wait(*mbox, (rt_ubase_t)msg, RT_WAITING_FOREVER);
return;
}
@ -481,7 +481,7 @@ void sys_mbox_post(sys_mbox_t *mbox, void *msg)
*/
err_t sys_mbox_trypost(sys_mbox_t *mbox, void *msg)
{
if (rt_mb_send(*mbox, (rt_uint32_t)msg) == RT_EOK)
if (rt_mb_send(*mbox, (rt_ubase_t)msg) == RT_EOK)
return ERR_OK;
return ERR_MEM;

View File

@ -405,7 +405,7 @@ static err_t ethernetif_linkoutput(struct netif *netif, struct pbuf *p)
msg.netif = netif;
msg.buf = p;
rt_completion_init(&msg.ack);
if (rt_mb_send(&eth_tx_thread_mb, (rt_uint32_t) &msg) == RT_EOK)
if (rt_mb_send(&eth_tx_thread_mb, (rt_ubase_t) &msg) == RT_EOK)
{
/* waiting for ack */
rt_completion_wait(&msg.ack, RT_WAITING_FOREVER);
@ -615,7 +615,7 @@ rt_err_t eth_device_ready(struct eth_device* dev)
if(dev->rx_notice == RT_FALSE)
{
dev->rx_notice = RT_TRUE;
return rt_mb_send(&eth_rx_thread_mb, (rt_uint32_t)dev);
return rt_mb_send(&eth_rx_thread_mb, (rt_ubase_t)dev);
}
else
return RT_EOK;
@ -640,7 +640,7 @@ rt_err_t eth_device_linkchange(struct eth_device* dev, rt_bool_t up)
rt_hw_interrupt_enable(level);
/* post message to ethernet thread */
return rt_mb_send(&eth_rx_thread_mb, (rt_uint32_t)dev);
return rt_mb_send(&eth_rx_thread_mb, (rt_ubase_t)dev);
}
#else
/* NOTE: please not use it in interrupt when no RxThread exist */

View File

@ -22,12 +22,12 @@
static void memheap_test(void)
{
struct rt_memheap heap1;
rt_uint32_t ptr_start;
rt_ubase_t ptr_start;
void *ptr[SLICE_NUM];
int i, cnt = 0;
/* init heap */
ptr_start = (rt_uint32_t)rt_malloc_align(HEAP_SIZE, HEAP_ALIGN);
ptr_start = (rt_ubase_t)rt_malloc_align(HEAP_SIZE, HEAP_ALIGN);
if (ptr_start == RT_NULL)
{
rt_kprintf("totle size too big,can not malloc memory!");