From 0e40d55d9f6894aec2dfc844e8ea89756b0306fe Mon Sep 17 00:00:00 2001 From: "dzzxzz@gmail.com" Date: Thu, 20 Dec 2012 07:25:19 +0000 Subject: [PATCH] fixed the coding style of RT_DEBUG_LOG git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2500 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- components/drivers/usb/usbdevice/core/core.c | 3 +- components/drivers/usb/usbhost/class/adk.c | 18 ++--- components/drivers/usb/usbhost/core/core.c | 15 ++-- src/ipc.c | 49 +++++++----- src/irq.c | 3 +- src/mem.c | 21 ++--- src/memheap.c | 47 ++++++++---- src/module.c | 81 +++++++++----------- src/scheduler.c | 30 +++++--- src/slab.c | 38 +++++---- src/thread.c | 12 +-- 11 files changed, 176 insertions(+), 141 deletions(-) diff --git a/components/drivers/usb/usbdevice/core/core.c b/components/drivers/usb/usbdevice/core/core.c index 0c5be97ca..a09849ffe 100644 --- a/components/drivers/usb/usbdevice/core/core.c +++ b/components/drivers/usb/usbdevice/core/core.c @@ -512,7 +512,8 @@ static rt_err_t _setup_request(udevice_t device, ureq_t setup) RT_ASSERT(setup != RT_NULL); RT_DEBUG_LOG(RT_DEBUG_USB, ("[\n")); - RT_DEBUG_LOG(RT_DEBUG_USB, ("setup_request_handler 0x%x\n", setup->request_type)); + RT_DEBUG_LOG(RT_DEBUG_USB, ("setup_request_handler 0x%x\n", + setup->request_type)); RT_DEBUG_LOG(RT_DEBUG_USB, ("value 0x%x\n", setup->value)); RT_DEBUG_LOG(RT_DEBUG_USB, ("length 0x%x\n", setup->length)); RT_DEBUG_LOG(RT_DEBUG_USB, ("index 0x%x\n", setup->index)); diff --git a/components/drivers/usb/usbhost/class/adk.c b/components/drivers/usb/usbhost/class/adk.c index 208d70a09..0f1d40979 100644 --- a/components/drivers/usb/usbhost/class/adk.c +++ b/components/drivers/usb/usbhost/class/adk.c @@ -223,7 +223,7 @@ static rt_err_t rt_usb_adk_run(void* arg) return -RT_EIO; } - RT_DEBUG_LOG(RT_DEBUG_USB,("rt_usb_adk_run\n")); + RT_DEBUG_LOG(RT_DEBUG_USB, ("rt_usb_adk_run\n")); dev_desc = &ifinst->uinst->dev_desc; if(dev_desc->idVendor == USB_ACCESSORY_VENDOR_ID && @@ -232,11 +232,11 @@ static rt_err_t rt_usb_adk_run(void* arg) { if(ifinst->intf_desc->bInterfaceSubClass != 0xFF) return -RT_ERROR; - RT_DEBUG_LOG(RT_DEBUG_USB,("found android accessory device\n")); + RT_DEBUG_LOG(RT_DEBUG_USB, ("found android accessory device\n")); } else { - RT_DEBUG_LOG(RT_DEBUG_USB,("switch device\n")); + RT_DEBUG_LOG(RT_DEBUG_USB, ("switch device\n")); if((ret = rt_usb_adk_get_protocol(ifinst, &protocol)) != RT_EOK) { @@ -263,12 +263,12 @@ static rt_err_t rt_usb_adk_run(void* arg) rt_usb_adk_send_string(ifinst, ACCESSORY_STRING_SERIAL, _adk_serial); - RT_DEBUG_LOG(RT_DEBUG_USB,("manufacturer %s\n", _adk_manufacturer)); - RT_DEBUG_LOG(RT_DEBUG_USB,("model %s\n", _adk_model)); - RT_DEBUG_LOG(RT_DEBUG_USB,("description %s\n", _adk_description)); - RT_DEBUG_LOG(RT_DEBUG_USB,("version %s\n", _adk_version)); - RT_DEBUG_LOG(RT_DEBUG_USB,("uri %s\n", _adk_uri)); - RT_DEBUG_LOG(RT_DEBUG_USB,("serial %s\n", _adk_serial)); + RT_DEBUG_LOG(RT_DEBUG_USB, ("manufacturer %s\n", _adk_manufacturer)); + RT_DEBUG_LOG(RT_DEBUG_USB, ("model %s\n", _adk_model)); + RT_DEBUG_LOG(RT_DEBUG_USB, ("description %s\n", _adk_description)); + RT_DEBUG_LOG(RT_DEBUG_USB, ("version %s\n", _adk_version)); + RT_DEBUG_LOG(RT_DEBUG_USB, ("uri %s\n", _adk_uri)); + RT_DEBUG_LOG(RT_DEBUG_USB, ("serial %s\n", _adk_serial)); if((ret = rt_usb_adk_start(ifinst)) != RT_EOK) { diff --git a/components/drivers/usb/usbhost/core/core.c b/components/drivers/usb/usbhost/core/core.c index 755b8c0ac..956f283b9 100644 --- a/components/drivers/usb/usbhost/core/core.c +++ b/components/drivers/usb/usbhost/core/core.c @@ -100,8 +100,8 @@ rt_err_t rt_usb_attatch_instance(uinst_t uinst) /* set device max packet size */ uinst->max_packet_size = uinst->dev_desc.bMaxPacketSize0; - RT_DEBUG_LOG(RT_DEBUG_USB, ("get device descriptor length %d\n", - dev_desc->bLength)); + RT_DEBUG_LOG(RT_DEBUG_USB, ("get device descriptor length %d\n", + dev_desc->bLength)); /* get full device descriptor again */ ret = rt_usb_get_descriptor @@ -152,7 +152,8 @@ rt_err_t rt_usb_attatch_instance(uinst_t uinst) } RT_DEBUG_LOG(RT_DEBUG_USB, ("interface class 0x%x, subclass 0x%x\n", - intf_desc->bInterfaceClass, intf_desc->bInterfaceSubClass)); + intf_desc->bInterfaceClass, + intf_desc->bInterfaceSubClass)); /* find driver by class code found in interface descriptor */ drv = rt_usb_class_driver_find(intf_desc->bInterfaceClass, @@ -406,8 +407,8 @@ rt_err_t rt_usb_get_interface_descriptor(ucfg_desc_t cfg_desc, int num, { *intf_desc = (uintf_desc_t)desc; - RT_DEBUG_LOG(RT_DEBUG_USB, - ("rt_usb_get_interface_descriptor: %d\n", num)); + RT_DEBUG_LOG(RT_DEBUG_USB, + ("rt_usb_get_interface_descriptor: %d\n", num)); return RT_EOK; } } @@ -453,8 +454,8 @@ rt_err_t rt_usb_get_endpoint_descriptor(uintf_desc_t intf_desc, int num, { *ep_desc = (uep_desc_t)desc; - RT_DEBUG_LOG(RT_DEBUG_USB, - ("rt_usb_get_endpoint_descriptor: %d\n", num)); + RT_DEBUG_LOG(RT_DEBUG_USB, + ("rt_usb_get_endpoint_descriptor: %d\n", num)); return RT_EOK; } else count++; diff --git a/src/ipc.c b/src/ipc.c index e3db05a6f..38b2c609a 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -317,9 +317,10 @@ rt_err_t rt_sem_take(rt_sem_t sem, rt_int32_t time) /* disable interrupt */ temp = rt_hw_interrupt_disable(); - RT_DEBUG_LOG(RT_DEBUG_IPC, - ("thread %s take sem:%s, which value is: %d\n", rt_thread_self()->name, - ((struct rt_object *)sem)->name, sem->value)); + RT_DEBUG_LOG(RT_DEBUG_IPC, ("thread %s take sem:%s, which value is: %d\n", + rt_thread_self()->name, + ((struct rt_object *)sem)->name, + sem->value)); if (sem->value > 0) { @@ -350,7 +351,8 @@ rt_err_t rt_sem_take(rt_sem_t sem, rt_int32_t time) /* reset thread error number */ thread->error = RT_EOK; - RT_DEBUG_LOG(RT_DEBUG_IPC, ("sem take: suspend thread - %s\n", thread->name)); + RT_DEBUG_LOG(RT_DEBUG_IPC, ("sem take: suspend thread - %s\n", + thread->name)); /* suspend thread */ rt_ipc_list_suspend(&(sem->parent.suspend_thread), @@ -359,7 +361,8 @@ rt_err_t rt_sem_take(rt_sem_t sem, rt_int32_t time) /* has waiting time, start thread timer */ if (time > 0) { - RT_DEBUG_LOG(RT_DEBUG_IPC, ("set thread:%s to timer list\n", thread->name)); + RT_DEBUG_LOG(RT_DEBUG_IPC, ("set thread:%s to timer list\n", + thread->name)); /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, &time); @@ -418,9 +421,10 @@ rt_err_t rt_sem_release(rt_sem_t sem) /* disable interrupt */ temp = rt_hw_interrupt_disable(); - RT_DEBUG_LOG(RT_DEBUG_IPC, - ("thread %s releases sem:%s, which value is: %d\n", rt_thread_self()->name, - ((struct rt_object *)sem)->name, sem->value)); + RT_DEBUG_LOG(RT_DEBUG_IPC, ("thread %s releases sem:%s, which value is: %d\n", + rt_thread_self()->name, + ((struct rt_object *)sem)->name, + sem->value)); if (!rt_list_isempty(&sem->parent.suspend_thread)) { @@ -631,8 +635,8 @@ rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t time) RT_OBJECT_HOOK_CALL(rt_object_trytake_hook, (&(mutex->parent.parent))); RT_DEBUG_LOG(RT_DEBUG_IPC, - ("mutex_take: current thread %s, mutex value: %d, hold: %d\n", - thread->name, mutex->value, mutex->hold)); + ("mutex_take: current thread %s, mutex value: %d, hold: %d\n", + thread->name, mutex->value, mutex->hold)); /* reset thread error */ thread->error = RT_EOK; @@ -673,8 +677,8 @@ rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t time) else { /* mutex is unavailable, push to suspend list */ - RT_DEBUG_LOG(RT_DEBUG_IPC, - ("mutex_take: suspend thread: %s\n", thread->name)); + RT_DEBUG_LOG(RT_DEBUG_IPC, ("mutex_take: suspend thread: %s\n", + thread->name)); /* change the owner thread priority of mutex */ if (thread->current_priority < mutex->owner->current_priority) @@ -692,7 +696,8 @@ rt_err_t rt_mutex_take(rt_mutex_t mutex, rt_int32_t time) if (time > 0) { RT_DEBUG_LOG(RT_DEBUG_IPC, - ("mutex_take: start the timer of thread:%s\n", thread->name)); + ("mutex_take: start the timer of thread:%s\n", + thread->name)); /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, &time); @@ -752,8 +757,8 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex) temp = rt_hw_interrupt_disable(); RT_DEBUG_LOG(RT_DEBUG_IPC, - ("mutex_release:current thread %s, mutex value: %d, hold: %d\n", - thread->name, mutex->value, mutex->hold)); + ("mutex_release:current thread %s, mutex value: %d, hold: %d\n", + thread->name, mutex->value, mutex->hold)); RT_OBJECT_HOOK_CALL(rt_object_put_hook, (&(mutex->parent.parent))); @@ -786,7 +791,8 @@ rt_err_t rt_mutex_release(rt_mutex_t mutex) /* get suspended thread */ thread = rt_list_entry(mutex->parent.suspend_thread.next, struct rt_thread, tlist); - RT_DEBUG_LOG(RT_DEBUG_IPC, ("mutex_release: resume thread: %s\n", thread->name)); + RT_DEBUG_LOG(RT_DEBUG_IPC, ("mutex_release: resume thread: %s\n", + thread->name)); /* set new owner and priority */ mutex->owner = thread; @@ -1396,8 +1402,8 @@ rt_err_t rt_mb_send_wait(rt_mailbox_t mb, rt_uint32_t value, rt_int32_t timeout) /* get the start tick of timer */ tick_delta = rt_tick_get(); - RT_DEBUG_LOG(RT_DEBUG_IPC, - ("mb_send_wait: start timer of thread:%s\n", thread->name)); + RT_DEBUG_LOG(RT_DEBUG_IPC, ("mb_send_wait: start timer of thread:%s\n", + thread->name)); /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, &timeout); @@ -1539,8 +1545,8 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_uint32_t *value, rt_int32_t timeout) /* get the start tick of timer */ tick_delta = rt_tick_get(); - RT_DEBUG_LOG(RT_DEBUG_IPC, - ("mb_recv: start timer of thread:%s\n", thread->name)); + RT_DEBUG_LOG(RT_DEBUG_IPC, ("mb_recv: start timer of thread:%s\n", + thread->name)); /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, &timeout); @@ -2072,7 +2078,8 @@ rt_err_t rt_mq_recv(rt_mq_t mq, void *buffer, rt_size_t size, rt_int32_t timeout /* get the start tick of timer */ tick_delta = rt_tick_get(); - RT_DEBUG_LOG(RT_DEBUG_IPC, ("set thread:%s to timer list\n", thread->name)); + RT_DEBUG_LOG(RT_DEBUG_IPC, ("set thread:%s to timer list\n", + thread->name)); /* reset the timeout of thread timer and start it */ rt_timer_control(&(thread->thread_timer), RT_TIMER_CTRL_SET_TIME, &timeout); diff --git a/src/irq.c b/src/irq.c index f006f7b67..491f97f4a 100644 --- a/src/irq.c +++ b/src/irq.c @@ -37,7 +37,8 @@ void rt_interrupt_enter(void) { rt_base_t level; - RT_DEBUG_LOG(RT_DEBUG_IRQ, ("irq coming..., irq nest:%d\n", rt_interrupt_nest)); + RT_DEBUG_LOG(RT_DEBUG_IRQ, ("irq coming..., irq nest:%d\n", + rt_interrupt_nest)); level = rt_hw_interrupt_disable(); rt_interrupt_nest ++; diff --git a/src/mem.c b/src/mem.c index fba3bc9df..1149c7f2f 100644 --- a/src/mem.c +++ b/src/mem.c @@ -190,8 +190,8 @@ void rt_system_heap_init(void *begin_addr, void *end_addr) /* point to begin address of heap */ heap_ptr = (rt_uint8_t *)begin_align; - RT_DEBUG_LOG(RT_DEBUG_MEM, - ("mem init, heap begin address 0x%x, size %d\n", (rt_uint32_t)heap_ptr, mem_size_aligned)); + RT_DEBUG_LOG(RT_DEBUG_MEM, ("mem init, heap begin address 0x%x, size %d\n", + (rt_uint32_t)heap_ptr, mem_size_aligned)); /* initialize the start of the heap */ mem = (struct heap_mem *)heap_ptr; @@ -237,7 +237,8 @@ void *rt_malloc(rt_size_t size) return RT_NULL; if (size != RT_ALIGN(size, RT_ALIGN_SIZE)) - RT_DEBUG_LOG(RT_DEBUG_MEM, ("malloc size %d, but align to %d\n", size, RT_ALIGN(size, RT_ALIGN_SIZE))); + RT_DEBUG_LOG(RT_DEBUG_MEM, ("malloc size %d, but align to %d\n", + size, RT_ALIGN(size, RT_ALIGN_SIZE))); else RT_DEBUG_LOG(RT_DEBUG_MEM, ("malloc size %d\n", size)); @@ -335,9 +336,10 @@ void *rt_malloc(rt_size_t size) RT_ASSERT((rt_uint32_t)((rt_uint8_t *)mem + SIZEOF_STRUCT_MEM) % RT_ALIGN_SIZE == 0); RT_ASSERT((((rt_uint32_t)mem) & (RT_ALIGN_SIZE-1)) == 0); - RT_DEBUG_LOG(RT_DEBUG_MEM, ("allocate memory at 0x%x, size: %d\n", - (rt_uint32_t)((rt_uint8_t *)mem + SIZEOF_STRUCT_MEM), - (rt_uint32_t)(mem->next - ((rt_uint8_t *)mem - heap_ptr)))); + RT_DEBUG_LOG(RT_DEBUG_MEM, + ("allocate memory at 0x%x, size: %d\n", + (rt_uint32_t)((rt_uint8_t *)mem + SIZEOF_STRUCT_MEM), + (rt_uint32_t)(mem->next - ((rt_uint8_t *)mem - heap_ptr)))); RT_OBJECT_HOOK_CALL(rt_malloc_hook, (((void*)((rt_uint8_t *)mem + SIZEOF_STRUCT_MEM)), size)); @@ -503,9 +505,10 @@ void rt_free(void *rmem) /* Get the corresponding struct heap_mem ... */ mem = (struct heap_mem *)((rt_uint8_t *)rmem - SIZEOF_STRUCT_MEM); - RT_DEBUG_LOG(RT_DEBUG_MEM, ("release memory 0x%x, size: %d\n", - (rt_uint32_t)rmem, - (rt_uint32_t)(mem->next - ((rt_uint8_t *)mem - heap_ptr)))); + RT_DEBUG_LOG(RT_DEBUG_MEM, + ("release memory 0x%x, size: %d\n", + (rt_uint32_t)rmem, + (rt_uint32_t)(mem->next - ((rt_uint8_t *)mem - heap_ptr)))); /* protect the heap from concurrent access */ diff --git a/src/memheap.c b/src/memheap.c index 458b8593e..af902376a 100644 --- a/src/memheap.c +++ b/src/memheap.c @@ -100,8 +100,9 @@ rt_err_t rt_memheap_init(struct rt_memheap *memheap, const char *name, /* initialize mutex lock */ rt_mutex_init(&(memheap->lock), name, RT_IPC_FLAG_FIFO); - RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("memory heap: start addr 0x%08x, size %d, free list header 0x%08x", - start_addr, size, &(memheap->free_header))); + RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, + ("memory heap: start addr 0x%08x, size %d, free list header 0x%08x", + start_addr, size, &(memheap->free_header))); return RT_EOK; } @@ -174,9 +175,12 @@ void *rt_memheap_alloc(struct rt_memheap *heap, rt_uint32_t size) /* split the block. */ new_ptr = (struct rt_memheap_item *)(((rt_uint8_t *)header_ptr) + size + RT_MEMHEAP_SIZE); - RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("split: h[0x%08x] nm[0x%08x] pm[0x%08x] to n[0x%08x]", header_ptr, - header_ptr->next, header_ptr->prev, - new_ptr)); + RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, + ("split: h[0x%08x] nm[0x%08x] pm[0x%08x] to n[0x%08x]", + header_ptr, + header_ptr->next, + header_ptr->prev, + new_ptr)); /* mark the new block as a memory block and freed. */ new_ptr->magic = RT_MEMHEAP_MAGIC; @@ -202,7 +206,8 @@ void *rt_memheap_alloc(struct rt_memheap *heap, rt_uint32_t size) heap->free_list->next_free->prev_free = new_ptr; heap->free_list->next_free = new_ptr; RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("new ptr: nf 0x%08x, pf 0x%08x", - new_ptr->next_free, new_ptr->prev_free)); + new_ptr->next_free, + new_ptr->prev_free)); /* decrement the available byte count. */ heap->available_size = heap->available_size - size - RT_MEMHEAP_SIZE; @@ -213,8 +218,11 @@ void *rt_memheap_alloc(struct rt_memheap *heap, rt_uint32_t size) heap->available_size = heap->available_size - free_size; /* remove header_ptr from free list */ - RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("one block: h[0x%08x], nf 0x%08x, pf 0x%08x", header_ptr, - header_ptr->next_free, header_ptr->prev_free)); + RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, + ("one block: h[0x%08x], nf 0x%08x, pf 0x%08x", + header_ptr, + header_ptr->next_free, + header_ptr->prev_free)); header_ptr->next_free->prev_free = header_ptr->prev_free; header_ptr->prev_free->next_free = header_ptr->next_free; @@ -229,8 +237,11 @@ void *rt_memheap_alloc(struct rt_memheap *heap, rt_uint32_t size) header_ptr->magic |= RT_MEMHEAP_USED; /* Return a memory address to the caller. */ - RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("am: m[0x%08x], h[0x%08x], size: %d", - (void *)((rt_uint8_t *)header_ptr + RT_MEMHEAP_SIZE), header_ptr, size); + RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, + ("am: m[0x%08x], h[0x%08x], size: %d", + (void *)((rt_uint8_t *)header_ptr + RT_MEMHEAP_SIZE), + header_ptr, + size); return (void *)((rt_uint8_t *)header_ptr + RT_MEMHEAP_SIZE)); } @@ -258,7 +269,8 @@ void rt_memheap_free(void *ptr) new_ptr = RT_NULL; header_ptr = (struct rt_memheap_item *)((rt_uint8_t *)ptr - RT_MEMHEAP_SIZE); - RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("free memory: m[0x%08x], h[0x%08x]", ptr, header_ptr)); + RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("free memory: m[0x%08x], h[0x%08x]", + ptr, header_ptr)); /* check magic */ RT_ASSERT((header_ptr->magic & RT_MEMHEAP_MASK) == RT_MEMHEAP_MAGIC); @@ -285,7 +297,8 @@ void rt_memheap_free(void *ptr) /* Determine if the block can be merged with the previous neighbor. */ if (!RT_MEMHEAP_IS_USED(header_ptr->prev)) { - RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("merge: left node 0x%08x", header_ptr->prev)); + RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("merge: left node 0x%08x", + header_ptr->prev)); /* adjust the available number of bytes. */ heap->available_size = heap->available_size + RT_MEMHEAP_SIZE; @@ -309,8 +322,9 @@ void rt_memheap_free(void *ptr) /* merge block with next neighbor. */ new_ptr = header_ptr->next; - RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("merge: right node 0x%08x, nf 0x%08x, pf 0x%08x", - new_ptr, new_ptr->next_free, new_ptr->prev_free)); + RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, + ("merge: right node 0x%08x, nf 0x%08x, pf 0x%08x", + new_ptr, new_ptr->next_free, new_ptr->prev_free)); new_ptr->next->prev = header_ptr; header_ptr->next = new_ptr->next; @@ -328,8 +342,9 @@ void rt_memheap_free(void *ptr) heap->free_list->next_free->prev_free = header_ptr; heap->free_list->next_free = header_ptr; - RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, ("insert to free list: nf 0x%08x, pf 0x%08x", - header_ptr->next_free, header_ptr->prev_free)); + RT_DEBUG_LOG(RT_DEBUG_MEMHEAP, + ("insert to free list: nf 0x%08x, pf 0x%08x", + header_ptr->next_free, header_ptr->prev_free)); } /* release lock */ diff --git a/src/module.c b/src/module.c index 8b62f5a02..ca885a8e9 100644 --- a/src/module.c +++ b/src/module.c @@ -140,8 +140,8 @@ static int rt_module_arm_relocate(struct rt_module *module, break; case R_ARM_ABS32: *where += (Elf32_Addr)sym_val; - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("R_ARM_ABS32: %x -> %x\n", where, *where)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_ARM_ABS32: %x -> %x\n", + where, *where)); break; case R_ARM_PC24: case R_ARM_PLT32: @@ -153,8 +153,8 @@ static int rt_module_arm_relocate(struct rt_module *module, tmp = sym_val - (Elf32_Addr)where + (addend << 2); tmp >>= 2; *where = (*where & 0xff000000) | (tmp & 0x00ffffff); - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("R_ARM_PC24: %x -> %x\n", where, *where)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_ARM_PC24: %x -> %x\n", + where, *where)); break; case R_ARM_REL32: *where += sym_val - (Elf32_Addr)where; @@ -169,24 +169,21 @@ static int rt_module_arm_relocate(struct rt_module *module, case R_ARM_GLOB_DAT: case R_ARM_JUMP_SLOT: *where = (Elf32_Addr)sym_val; - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("R_ARM_JUMP_SLOT: 0x%x -> 0x%x 0x%x\n", - where, *where, sym_val)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_ARM_JUMP_SLOT: 0x%x -> 0x%x 0x%x\n", + where, *where, sym_val)); break; #if 0 /* To do */ case R_ARM_GOT_BREL: temp = (Elf32_Addr)sym_val; *where = (Elf32_Addr)&temp; - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("R_ARM_GOT_BREL: 0x%x -> 0x%x 0x%x\n", - where, *where, sym_val)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_ARM_GOT_BREL: 0x%x -> 0x%x 0x%x\n", + where, *where, sym_val)); break; #endif case R_ARM_RELATIVE: *where = (Elf32_Addr)sym_val + *where; - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("R_ARM_RELATIVE: 0x%x -> 0x%x 0x%x\n", - where, *where, sym_val)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("R_ARM_RELATIVE: 0x%x -> 0x%x 0x%x\n", + where, *where, sym_val)); break; case R_ARM_THM_CALL: case R_ARM_THM_JUMP24: @@ -431,9 +428,9 @@ static struct rt_module *_load_shared_object(const char *name, { Elf32_Sym *sym = &symtab[ELF32_R_SYM(rel->r_info)]; - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("relocate symbol %s shndx %d\n", - strtab + sym->st_name, sym->st_shndx)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("relocate symbol %s shndx %d\n", + strtab + sym->st_name, + sym->st_shndx)); if ((sym->st_shndx != SHT_NULL) || (ELF_ST_BIND(sym->st_info) == STB_LOCAL)) @@ -445,8 +442,8 @@ static struct rt_module *_load_shared_object(const char *name, { Elf32_Addr addr; - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("relocate symbol: %s\n", strtab + sym->st_name)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("relocate symbol: %s\n", + strtab + sym->st_name)); /* need to resolve symbol in kernel symbol table */ addr = rt_module_symbol_find((const char *)(strtab + sym->st_name)); @@ -592,9 +589,8 @@ static struct rt_module* _load_relocated_object(const char *name, rt_memcpy(ptr, (rt_uint8_t *)elf_module + shdr[index].sh_offset, shdr[index].sh_size); - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("load text 0x%x, size %d\n", - ptr, shdr[index].sh_size)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("load text 0x%x, size %d\n", + ptr, shdr[index].sh_size)); ptr += shdr[index].sh_size; } @@ -629,9 +625,8 @@ static struct rt_module* _load_relocated_object(const char *name, { rt_memset(ptr, 0, shdr[index].sh_size); bss_addr = (rt_uint32_t)ptr; - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("load bss 0x%x, size %d,\n", - ptr, shdr[index].sh_size)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("load bss 0x%x, size %d,\n", + ptr, shdr[index].sh_size)); } } @@ -666,8 +661,8 @@ static struct rt_module* _load_relocated_object(const char *name, { Elf32_Sym *sym = &symtab[ELF32_R_SYM(rel->r_info)]; - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("relocate symbol: %s\n", strtab + sym->st_name)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("relocate symbol: %s\n", + strtab + sym->st_name)); if (sym->st_shndx != STN_UNDEF) { @@ -712,17 +707,16 @@ static struct rt_module* _load_relocated_object(const char *name, if (ELF32_R_TYPE(rel->r_info) != R_ARM_V4BX) { - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("relocate symbol: %s\n", - strtab + sym->st_name)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("relocate symbol: %s\n", + strtab + sym->st_name)); /* need to resolve symbol in kernel symbol table */ addr = rt_module_symbol_find((const char *)(strtab + sym->st_name)); if (addr != (Elf32_Addr)RT_NULL) { rt_module_arm_relocate(module, rel, addr); - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("symbol addr 0x%x\n", addr)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("symbol addr 0x%x\n", + addr)); } else rt_kprintf("Module: can't find %s in kernel symbol table\n", @@ -826,8 +820,8 @@ rt_module_t rt_module_load(const char *name, void *module_ptr) module->thread_priority, 10); - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("thread entry 0x%x\n", module->module_entry)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("thread entry 0x%x\n", + module->module_entry)); /* set module id */ module->module_thread->module_id = (void *)module; @@ -982,9 +976,8 @@ rt_err_t rt_module_destroy(rt_module_t module) RT_ASSERT(module != RT_NULL); RT_ASSERT(module->nref == 0); - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("rt_module_destroy: %8.*s\n", - RT_NAME_MAX, module->parent.name)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("rt_module_destroy: %8.*s\n", + RT_NAME_MAX, module->parent.name)); /* module has entry point */ if (!(module->parent.flag & RT_MODULE_FLAG_WITHOUTENTRY)) @@ -1295,8 +1288,8 @@ static void *rt_module_malloc_page(rt_size_t npages) self_module->page_cnt ++; RT_ASSERT(self_module->page_cnt <= PAGE_COUNT_MAX); - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("rt_module_malloc_page 0x%x %d\n", chunk, npages)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("rt_module_malloc_page 0x%x %d\n", + chunk, npages)); return chunk; } @@ -1321,8 +1314,8 @@ static void rt_module_free_page(rt_module_t module, self_module = rt_module_self(); RT_ASSERT(self_module != RT_NULL); - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("rt_module_free_page 0x%x %d\n", page_ptr, npages)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("rt_module_free_page 0x%x %d\n", + page_ptr, npages)); rt_page_free(page_ptr, npages); page = (struct rt_page_info *)module->page_array; @@ -1399,8 +1392,8 @@ void *rt_module_malloc(rt_size_t size) b->size = nunits; *prev = n; - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("rt_module_malloc 0x%x, %d\n", b + 1, size)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("rt_module_malloc 0x%x, %d\n", + b + 1, size)); rt_sem_release(&mod_sem); return (void *)(b + 1); @@ -1411,8 +1404,8 @@ void *rt_module_malloc(rt_size_t size) /* this node fit, remove this node */ *prev = b->next; - RT_DEBUG_LOG(RT_DEBUG_MODULE, - ("rt_module_malloc 0x%x, %d\n", b + 1, size)); + RT_DEBUG_LOG(RT_DEBUG_MODULE, ("rt_module_malloc 0x%x, %d\n", + b + 1, size)); rt_sem_release(&mod_sem); diff --git a/src/scheduler.c b/src/scheduler.c index 27f0fc53f..512d4ecfe 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -129,8 +129,8 @@ void rt_system_scheduler_init(void) rt_scheduler_lock_nest = 0; - RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, - ("start scheduler: max priority 0x%02x\n", RT_THREAD_PRIORITY_MAX)); + RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("start scheduler: max priority 0x%02x\n", + RT_THREAD_PRIORITY_MAX)); for (offset = 0; offset < RT_THREAD_PRIORITY_MAX; offset ++) { @@ -270,8 +270,10 @@ void rt_schedule(void) /* switch to new thread */ RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, - ("[%d]switch to priority#%d thread:%s\n", rt_interrupt_nest, - highest_ready_priority, to_thread->name)); + ("[%d]switch to priority#%d thread:%s\n", + rt_interrupt_nest, + highest_ready_priority, + to_thread->name)); #ifdef RT_USING_OVERFLOW_CHECK _rt_scheduler_stack_check(to_thread); @@ -319,10 +321,14 @@ void rt_schedule_insert_thread(struct rt_thread *thread) /* set priority mask */ #if RT_THREAD_PRIORITY_MAX <= 32 RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("insert thread[%s], the priority: %d\n", - thread->name, thread->current_priority)); + thread->name, thread->current_priority)); #else - RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("insert thread[%s], the priority: %d 0x%x %d\n", - thread->name, thread->number, thread->number_mask, thread->high_mask)); + RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, + ("insert thread[%s], the priority: %d 0x%x %d\n", + thread->name, + thread->number, + thread->number_mask, + thread->high_mask)); #endif #if RT_THREAD_PRIORITY_MAX > 32 @@ -352,10 +358,14 @@ void rt_schedule_remove_thread(struct rt_thread *thread) #if RT_THREAD_PRIORITY_MAX <= 32 RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("remove thread[%s], the priority: %d\n", - thread->name, thread->current_priority)); + thread->name, thread->current_priority)); #else - RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, ("remove thread[%s], the priority: %d 0x%x %d\n", - thread->name, thread->number, thread->number_mask, thread->high_mask)); + RT_DEBUG_LOG(RT_DEBUG_SCHEDULER, + ("remove thread[%s], the priority: %d 0x%x %d\n", + thread->name, + thread->number, + thread->number_mask, + thread->high_mask)); #endif /* remove thread from ready list */ diff --git a/src/slab.c b/src/slab.c index 4de89276d..5a2987976 100644 --- a/src/slab.c +++ b/src/slab.c @@ -364,8 +364,8 @@ void rt_system_heap_init(void *begin_addr, void *end_addr) /* initialize heap semaphore */ rt_sem_init(&heap_sem, "heap", 1, RT_IPC_FLAG_FIFO); - RT_DEBUG_LOG(RT_DEBUG_SLAB, - ("heap[0x%x - 0x%x], size 0x%x, 0x%x pages\n", heap_start, heap_end, limsize, npages)); + RT_DEBUG_LOG(RT_DEBUG_SLAB, ("heap[0x%x - 0x%x], size 0x%x, 0x%x pages\n", + heap_start, heap_end, limsize, npages)); /* init pages */ rt_page_init((void *)heap_start, npages); @@ -381,16 +381,16 @@ void rt_system_heap_init(void *begin_addr, void *end_addr) zone_page_cnt = zone_size / RT_MM_PAGE_SIZE; - RT_DEBUG_LOG(RT_DEBUG_SLAB, - ("zone size 0x%x, zone page count 0x%x\n", zone_size, zone_page_cnt)); + RT_DEBUG_LOG(RT_DEBUG_SLAB, ("zone size 0x%x, zone page count 0x%x\n", + zone_size, zone_page_cnt)); /* allocate memusage array */ limsize = npages * sizeof(struct memusage); limsize = RT_ALIGN(limsize, RT_MM_PAGE_SIZE); memusage = rt_page_alloc(limsize/RT_MM_PAGE_SIZE); - RT_DEBUG_LOG(RT_DEBUG_SLAB, - ("memusage 0x%x, size 0x%x\n", (rt_uint32_t)memusage, limsize)); + RT_DEBUG_LOG(RT_DEBUG_SLAB, ("memusage 0x%x, size 0x%x\n", + (rt_uint32_t)memusage, limsize)); } /* @@ -505,10 +505,11 @@ void *rt_malloc(rt_size_t size) kup->type = PAGE_TYPE_LARGE; kup->size = size >> RT_MM_PAGE_BITS; - RT_DEBUG_LOG(RT_DEBUG_SLAB, ("malloc a large memory 0x%x, page cnt %d, kup %d\n", - size, - size >> RT_MM_PAGE_BITS, - ((rt_uint32_t)chunk - heap_start) >> RT_MM_PAGE_BITS)); + RT_DEBUG_LOG(RT_DEBUG_SLAB, + ("malloc a large memory 0x%x, page cnt %d, kup %d\n", + size, + size >> RT_MM_PAGE_BITS, + ((rt_uint32_t)chunk - heap_start) >> RT_MM_PAGE_BITS)); /* lock heap */ rt_sem_take(&heap_sem, RT_WAITING_FOREVER); @@ -607,7 +608,8 @@ void *rt_malloc(rt_size_t size) /* lock heap */ rt_sem_take(&heap_sem, RT_WAITING_FOREVER); - RT_DEBUG_LOG(RT_DEBUG_SLAB, ("alloc a new zone: 0x%x\n", (rt_uint32_t)z)); + RT_DEBUG_LOG(RT_DEBUG_SLAB, ("alloc a new zone: 0x%x\n", + (rt_uint32_t)z)); /* set message usage */ for (off = 0, kup = btokup(z); off < zone_page_cnt; off ++) @@ -800,10 +802,10 @@ void rt_free(void *ptr) { rt_uint32_t addr = ((rt_uint32_t)ptr & ~RT_MM_PAGE_MASK); RT_DEBUG_LOG(RT_DEBUG_SLAB, - ("free a memory 0x%x and align to 0x%x, kup index %d\n", - (rt_uint32_t)ptr, - (rt_uint32_t)addr, - ((rt_uint32_t)(addr) - heap_start) >> RT_MM_PAGE_BITS)); + ("free a memory 0x%x and align to 0x%x, kup index %d\n", + (rt_uint32_t)ptr, + (rt_uint32_t)addr, + ((rt_uint32_t)(addr) - heap_start) >> RT_MM_PAGE_BITS)); } #endif @@ -825,7 +827,8 @@ void rt_free(void *ptr) rt_sem_release(&heap_sem); RT_DEBUG_LOG(RT_DEBUG_SLAB, - ("free large memory block 0x%x, page count %d\n", (rt_uint32_t)ptr, size)); + ("free large memory block 0x%x, page count %d\n", + (rt_uint32_t)ptr, size)); /* free this page */ rt_page_free(ptr, size); @@ -868,7 +871,8 @@ void rt_free(void *ptr) { slab_zone **pz; - RT_DEBUG_LOG(RT_DEBUG_SLAB, ("free zone 0x%x\n", (rt_uint32_t)z, z->z_zoneindex)); + RT_DEBUG_LOG(RT_DEBUG_SLAB, ("free zone 0x%x\n", + (rt_uint32_t)z, z->z_zoneindex)); /* remove zone from zone array list */ for (pz = &zone_array[z->z_zoneindex]; z != *pz; pz = &(*pz)->z_next) diff --git a/src/thread.c b/src/thread.c index c3603657e..2723a8b30 100644 --- a/src/thread.c +++ b/src/thread.c @@ -196,8 +196,8 @@ rt_err_t rt_thread_startup(rt_thread_t thread) thread->number_mask = 1L << thread->current_priority; #endif - RT_DEBUG_LOG(RT_DEBUG_THREAD,\ - ("startup a thread:%s with priority:%d\n", thread->name, thread->init_priority)); + RT_DEBUG_LOG(RT_DEBUG_THREAD, ("startup a thread:%s with priority:%d\n", + thread->name, thread->init_priority)); /* change thread stat */ thread->stat = RT_THREAD_SUSPEND; /* then resume it */ @@ -532,8 +532,8 @@ rt_err_t rt_thread_suspend(rt_thread_t thread) if (thread->stat != RT_THREAD_READY) { - RT_DEBUG_LOG(RT_DEBUG_THREAD,\ - ("thread suspend: thread disorder, %d\n", thread->stat)); + RT_DEBUG_LOG(RT_DEBUG_THREAD, ("thread suspend: thread disorder, %d\n", + thread->stat)); return -RT_ERROR; } @@ -570,8 +570,8 @@ rt_err_t rt_thread_resume(rt_thread_t thread) if (thread->stat != RT_THREAD_SUSPEND) { - RT_DEBUG_LOG(RT_DEBUG_THREAD, \ - ("thread resume: thread disorder, %d\n", thread->stat)); + RT_DEBUG_LOG(RT_DEBUG_THREAD, ("thread resume: thread disorder, %d\n", + thread->stat)); return -RT_ERROR; } -- GitLab