[include] move almost all of the remainder of top level includes into a subdir

Examples are include/platform.h -> platform/include/platform.h
include/target.h -> target/include/target.h

The old model generally considered these to be Always There includes,
but they're starting to stick out more and more so may as well actually
follow the model that most of the rest of the system follows.
This commit is contained in:
Travis Geiselbrecht
2019-07-13 16:05:41 -07:00
parent a634b338c5
commit 35a8d555a3
48 changed files with 13 additions and 3 deletions

14
top/include/lk/asm.h Normal file
View File

@@ -0,0 +1,14 @@
/*
* Copyright (c) 2008-2013 Travis Geiselbrecht
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#pragma once
#define FUNCTION(x) .global x; .type x,STT_FUNC; x:
#define DATA(x) .global x; .type x,STT_OBJECT; x:
#define LOCAL_FUNCTION(x) .type x,STT_FUNC; x:
#define LOCAL_DATA(x) .type x,STT_OBJECT; x:

70
top/include/lk/bits.h Normal file
View File

@@ -0,0 +1,70 @@
/*
* Copyright (c) 2008 Travis Geiselbrecht
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <arch/ops.h>
#include <lk/compiler.h>
__BEGIN_CDECLS
#define clz(x) __builtin_clz(x)
#define ctz(x) __builtin_ctz(x)
#define BIT(x, bit) ((x) & (1UL << (bit)))
#define BIT_SHIFT(x, bit) (((x) >> (bit)) & 1)
#define BITS(x, high, low) ((x) & (((1UL<<((high)+1))-1) & ~((1UL<<(low))-1)))
#define BITS_SHIFT(x, high, low) (((x) >> (low)) & ((1UL<<((high)-(low)+1))-1))
#define BIT_SET(x, bit) (((x) & (1UL << (bit))) ? 1 : 0)
#define BITMAP_BITS_PER_WORD (sizeof(unsigned long) * 8)
#define BITMAP_NUM_WORDS(x) (((x) + BITMAP_BITS_PER_WORD - 1) / BITMAP_BITS_PER_WORD)
#define BITMAP_WORD(x) ((x) / BITMAP_BITS_PER_WORD)
#define BITMAP_BIT_IN_WORD(x) ((x) & (BITMAP_BITS_PER_WORD - 1))
#define BITMAP_BITS_PER_INT (sizeof(unsigned int) * 8)
#define BITMAP_BIT_IN_INT(x) ((x) & (BITMAP_BITS_PER_INT - 1))
#define BITMAP_INT(x) ((x) / BITMAP_BITS_PER_INT)
#define BIT_MASK(x) (((x) >= sizeof(unsigned long) * 8) ? (0UL-1) : ((1UL << (x)) - 1))
static inline int bitmap_set(unsigned long *bitmap, int bit) {
unsigned long mask = 1UL << BITMAP_BIT_IN_INT(bit);
return atomic_or(&((int *)bitmap)[BITMAP_INT(bit)], mask) & mask ? 1 : 0;
}
static inline int bitmap_clear(unsigned long *bitmap, int bit) {
unsigned long mask = 1UL << BITMAP_BIT_IN_INT(bit);
return atomic_and(&((int *)bitmap)[BITMAP_INT(bit)], ~mask) & mask ? 1:0;
}
static inline int bitmap_test(unsigned long *bitmap, int bit) {
return BIT_SET(bitmap[BITMAP_WORD(bit)], BITMAP_BIT_IN_WORD(bit));
}
/* find first zero bit starting from LSB */
static inline unsigned long _ffz(unsigned long x) {
return __builtin_ffsl(~x) - 1;
}
static inline int bitmap_ffz(unsigned long *bitmap, int numbits) {
uint i;
int bit;
for (i = 0; i < BITMAP_NUM_WORDS(numbits); i++) {
if (bitmap[i] == ~0UL)
continue;
bit = i * BITMAP_BITS_PER_WORD + _ffz(bitmap[i]);
if (bit < numbits)
return bit;
return -1;
}
return -1;
}
__END_CDECLS

152
top/include/lk/compiler.h Normal file
View File

@@ -0,0 +1,152 @@
/*
* Copyright (c) 2008-2013 Travis Geiselbrecht
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#pragma once
#ifndef __ASSEMBLY__
#if __GNUC__
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#define __UNUSED __attribute__((__unused__))
#define __PACKED __attribute__((packed))
#define __ALIGNED(x) __attribute__((aligned(x)))
#define __PRINTFLIKE(__fmt,__varargs) __attribute__((__format__ (__printf__, __fmt, __varargs)))
#define __SCANFLIKE(__fmt,__varargs) __attribute__((__format__ (__scanf__, __fmt, __varargs)))
#define __SECTION(x) __attribute((section(x)))
#define __PURE __attribute((pure))
#define __CONST __attribute((const))
#define __NO_RETURN __attribute__((noreturn))
#define __MALLOC __attribute__((malloc))
#define __WEAK __attribute__((weak))
#define __GNU_INLINE __attribute__((gnu_inline))
#define __GET_CALLER(x) __builtin_return_address(0)
#define __GET_FRAME(x) __builtin_frame_address(0)
#define __NAKED __attribute__((naked))
#define __ISCONSTANT(x) __builtin_constant_p(x)
#define __NO_INLINE __attribute((noinline))
#define __SRAM __NO_INLINE __SECTION(".sram.text")
#define __CONSTRUCTOR __attribute__((constructor))
#define __DESTRUCTOR __attribute__((destructor))
#define __OPTIMIZE(x) __attribute__((optimize(x)))
#define INCBIN(symname, sizename, filename, section) \
__asm__ (".section " section "; .align 4; .globl "#symname); \
__asm__ (""#symname ":\n.incbin \"" filename "\""); \
__asm__ (".section " section "; .align 1;"); \
__asm__ (""#symname "_end:"); \
__asm__ (".section " section "; .align 4; .globl "#sizename); \
__asm__ (""#sizename ": .long "#symname "_end - "#symname " - 1"); \
extern unsigned char symname[]; \
extern unsigned int sizename
#define INCFILE(symname, sizename, filename) INCBIN(symname, sizename, filename, ".rodata")
/* look for gcc 3.0 and above */
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 0)
#define __ALWAYS_INLINE __attribute__((always_inline))
#else
#define __ALWAYS_INLINE
#endif
/* look for gcc 3.1 and above */
#if !defined(__DEPRECATED) // seems to be built in in some versions of the compiler
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
#define __DEPRECATED __attribute((deprecated))
#else
#define __DEPRECATED
#endif
#endif
/* look for gcc 3.3 and above */
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
/* the may_alias attribute was introduced in gcc 3.3; before that, there
* was no way to specify aliasiang rules on a type-by-type basis */
#define __MAY_ALIAS __attribute__((may_alias))
/* nonnull was added in gcc 3.3 as well */
#define __NONNULL(x) __attribute((nonnull x))
#else
#define __MAY_ALIAS
#define __NONNULL(x)
#endif
/* look for gcc 3.4 and above */
#if (__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
#define __WARN_UNUSED_RESULT __attribute((warn_unused_result))
#else
#define __WARN_UNUSED_RESULT
#endif
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
#define __EXTERNALLY_VISIBLE __attribute__((externally_visible))
#else
#define __EXTERNALLY_VISIBLE
#endif
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
#define __UNREACHABLE __builtin_unreachable()
#else
#define __UNREACHABLE
#endif
#if (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
#ifdef __cplusplus
#define STATIC_ASSERT(e) static_assert(e, #e)
#else
#define STATIC_ASSERT(e) _Static_assert(e, #e)
#endif
#else
#define STATIC_ASSERT(e) extern char (*ct_assert(void)) [sizeof(char[1 - 2*!(e)])]
#endif
/* compiler fence */
#define CF do { __asm__ volatile("" ::: "memory"); } while(0)
#define __WEAK_ALIAS(x) __attribute__((weak, alias(x)))
#define __ALIAS(x) __attribute__((alias(x)))
#define __EXPORT __attribute__ ((visibility("default")))
#define __LOCAL __attribute__ ((visibility("hidden")))
#define __THREAD __thread
#define __offsetof(type, field) __builtin_offsetof(type, field)
#else
#define likely(x) (x)
#define unlikely(x) (x)
#define __UNUSED
#define __PACKED
#define __ALIGNED(x)
#define __PRINTFLIKE(__fmt,__varargs)
#define __SCANFLIKE(__fmt,__varargs)
#define __SECTION(x)
#define __PURE
#define __CONST
#define __NONNULL(x)
#define __DEPRECATED
#define __WARN_UNUSED_RESULT
#define __ALWAYS_INLINE
#define __MAY_ALIAS
#define __NO_RETURN
#endif
#endif
/* TODO: add type check */
#define countof(a) (sizeof(a) / sizeof((a)[0]))
/* CPP header guards */
#ifdef __cplusplus
#define __BEGIN_CDECLS extern "C" {
#define __END_CDECLS }
#else
#define __BEGIN_CDECLS
#define __END_CDECLS
#endif

65
top/include/lk/debug.h Normal file
View File

@@ -0,0 +1,65 @@
/*
* Copyright (c) 2008-2012 Travis Geiselbrecht
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <lk/compiler.h>
#include <stddef.h>
#include <stdio.h>
#include <platform/debug.h>
#if !defined(LK_DEBUGLEVEL)
#define LK_DEBUGLEVEL 0
#endif
/* debug levels */
#define CRITICAL 0
#define ALWAYS 0
#define INFO 1
#define SPEW 2
__BEGIN_CDECLS
#if !DISABLE_DEBUG_OUTPUT
/* Obtain the panic file descriptor. */
FILE *get_panic_fd(void);
/* dump memory */
void hexdump(const void *ptr, size_t len);
void hexdump8_ex(const void *ptr, size_t len, uint64_t disp_addr_start);
#else
/* Obtain the panic file descriptor. */
static inline FILE *get_panic_fd(void) { return NULL; }
/* dump memory */
static inline void hexdump(const void *ptr, size_t len) { }
static inline void hexdump8_ex(const void *ptr, size_t len, uint64_t disp_addr_start) { }
#endif /* DISABLE_DEBUG_OUTPUT */
static inline void hexdump8(const void *ptr, size_t len) {
hexdump8_ex(ptr, len, (uint64_t)((addr_t)ptr));
}
#define dprintf(level, x...) do { if ((level) <= LK_DEBUGLEVEL) { printf(x); } } while (0)
/* systemwide halts */
void _panic(void *caller, const char *fmt, ...) __PRINTFLIKE(2, 3) __NO_RETURN;
#define panic(x...) _panic(__GET_CALLER(), x)
#define PANIC_UNIMPLEMENTED panic("%s unimplemented\n", __PRETTY_FUNCTION__)
/* spin the cpu for a period of (short) time */
void spin(uint32_t usecs);
/* spin the cpu for a certain number of cpu cycles */
void spin_cycles(uint32_t usecs);
__END_CDECLS

60
top/include/lk/err.h Normal file
View File

@@ -0,0 +1,60 @@
/*
* Copyright (c) 2008-2014 Travis Geiselbrecht
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#pragma once
#ifndef ASSEMBLY
#include <sys/types.h> // for status_t
#endif
#define NO_ERROR (0)
#define ERR_GENERIC (-1)
#define ERR_NOT_FOUND (-2)
#define ERR_NOT_READY (-3)
#define ERR_NO_MSG (-4)
#define ERR_NO_MEMORY (-5)
#define ERR_ALREADY_STARTED (-6)
#define ERR_NOT_VALID (-7)
#define ERR_INVALID_ARGS (-8)
#define ERR_NOT_ENOUGH_BUFFER (-9)
#define ERR_NOT_SUSPENDED (-10)
#define ERR_OBJECT_DESTROYED (-11)
#define ERR_NOT_BLOCKED (-12)
#define ERR_TIMED_OUT (-13)
#define ERR_ALREADY_EXISTS (-14)
#define ERR_CHANNEL_CLOSED (-15)
#define ERR_OFFLINE (-16)
#define ERR_NOT_ALLOWED (-17)
#define ERR_BAD_PATH (-18)
#define ERR_ALREADY_MOUNTED (-19)
#define ERR_IO (-20)
#define ERR_NOT_DIR (-21)
#define ERR_NOT_FILE (-22)
#define ERR_RECURSE_TOO_DEEP (-23)
#define ERR_NOT_SUPPORTED (-24)
#define ERR_TOO_BIG (-25)
#define ERR_CANCELLED (-26)
#define ERR_NOT_IMPLEMENTED (-27)
#define ERR_CHECKSUM_FAIL (-28)
#define ERR_CRC_FAIL (-29)
#define ERR_CMD_UNKNOWN (-30)
#define ERR_BAD_STATE (-31)
#define ERR_BAD_LEN (-32)
#define ERR_BUSY (-33)
#define ERR_THREAD_DETACHED (-34)
#define ERR_I2C_NACK (-35)
#define ERR_ALREADY_EXPIRED (-36)
#define ERR_OUT_OF_RANGE (-37)
#define ERR_NOT_CONFIGURED (-38)
#define ERR_NOT_MOUNTED (-39)
#define ERR_FAULT (-40)
#define ERR_NO_RESOURCES (-41)
#define ERR_BAD_HANDLE (-42)
#define ERR_ACCESS_DENIED (-43)
#define ERR_PARTIAL_WRITE (-44)
#define ERR_USER_BASE (-16384)

253
top/include/lk/list.h Normal file
View File

@@ -0,0 +1,253 @@
/*
* Copyright (c) 2008 Travis Geiselbrecht
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <lk/compiler.h>
#include <stddef.h>
#include <stdbool.h>
__BEGIN_CDECLS
#define containerof(ptr, type, member) \
((type *)((addr_t)(ptr) - offsetof(type, member)))
struct list_node {
struct list_node *prev;
struct list_node *next;
};
#define LIST_INITIAL_VALUE(list) { &(list), &(list) }
#define LIST_INITIAL_CLEARED_VALUE { NULL, NULL }
static inline void list_initialize(struct list_node *list) {
list->prev = list->next = list;
}
static inline void list_clear_node(struct list_node *item) {
item->prev = item->next = 0;
}
static inline bool list_in_list(struct list_node *item) {
if (item->prev == 0 && item->next == 0)
return false;
else
return true;
}
static inline void list_add_head(struct list_node *list, struct list_node *item) {
item->next = list->next;
item->prev = list;
list->next->prev = item;
list->next = item;
}
#define list_add_after(entry, new_entry) list_add_head(entry, new_entry)
static inline void list_add_tail(struct list_node *list, struct list_node *item) {
item->prev = list->prev;
item->next = list;
list->prev->next = item;
list->prev = item;
}
#define list_add_before(entry, new_entry) list_add_tail(entry, new_entry)
static inline void list_delete(struct list_node *item) {
item->next->prev = item->prev;
item->prev->next = item->next;
item->prev = item->next = 0;
}
static inline struct list_node *list_remove_head(struct list_node *list) {
if (list->next != list) {
struct list_node *item = list->next;
list_delete(item);
return item;
} else {
return NULL;
}
}
#define list_remove_head_type(list, type, element) ({\
struct list_node *__nod = list_remove_head(list);\
type *__t;\
if(__nod)\
__t = containerof(__nod, type, element);\
else\
__t = (type *)0;\
__t;\
})
static inline struct list_node *list_remove_tail(struct list_node *list) {
if (list->prev != list) {
struct list_node *item = list->prev;
list_delete(item);
return item;
} else {
return NULL;
}
}
#define list_remove_tail_type(list, type, element) ({\
struct list_node *__nod = list_remove_tail(list);\
type *__t;\
if(__nod)\
__t = containerof(__nod, type, element);\
else\
__t = (type *)0;\
__t;\
})
static inline struct list_node *list_peek_head(struct list_node *list) {
if (list->next != list) {
return list->next;
} else {
return NULL;
}
}
#define list_peek_head_type(list, type, element) ({\
struct list_node *__nod = list_peek_head(list);\
type *__t;\
if(__nod)\
__t = containerof(__nod, type, element);\
else\
__t = (type *)0;\
__t;\
})
static inline struct list_node *list_peek_tail(struct list_node *list) {
if (list->prev != list) {
return list->prev;
} else {
return NULL;
}
}
#define list_peek_tail_type(list, type, element) ({\
struct list_node *__nod = list_peek_tail(list);\
type *__t;\
if(__nod)\
__t = containerof(__nod, type, element);\
else\
__t = (type *)0;\
__t;\
})
static inline struct list_node *list_prev(struct list_node *list, struct list_node *item) {
if (item->prev != list)
return item->prev;
else
return NULL;
}
#define list_prev_type(list, item, type, element) ({\
struct list_node *__nod = list_prev(list, item);\
type *__t;\
if(__nod)\
__t = containerof(__nod, type, element);\
else\
__t = (type *)0;\
__t;\
})
static inline struct list_node *list_prev_wrap(struct list_node *list, struct list_node *item) {
if (item->prev != list)
return item->prev;
else if (item->prev->prev != list)
return item->prev->prev;
else
return NULL;
}
#define list_prev_wrap_type(list, item, type, element) ({\
struct list_node *__nod = list_prev_wrap(list, item);\
type *__t;\
if(__nod)\
__t = containerof(__nod, type, element);\
else\
__t = (type *)0;\
__t;\
})
static inline struct list_node *list_next(struct list_node *list, struct list_node *item) {
if (item->next != list)
return item->next;
else
return NULL;
}
#define list_next_type(list, item, type, element) ({\
struct list_node *__nod = list_next(list, item);\
type *__t;\
if(__nod)\
__t = containerof(__nod, type, element);\
else\
__t = (type *)0;\
__t;\
})
static inline struct list_node *list_next_wrap(struct list_node *list, struct list_node *item) {
if (item->next != list)
return item->next;
else if (item->next->next != list)
return item->next->next;
else
return NULL;
}
#define list_next_wrap_type(list, item, type, element) ({\
struct list_node *__nod = list_next_wrap(list, item);\
type *__t;\
if(__nod)\
__t = containerof(__nod, type, element);\
else\
__t = (type *)0;\
__t;\
})
// iterates over the list, node should be struct list_node*
#define list_for_every(list, node) \
for(node = (list)->next; node != (list); node = node->next)
// iterates over the list in a safe way for deletion of current node
// node and temp_node should be struct list_node*
#define list_for_every_safe(list, node, temp_node) \
for(node = (list)->next, temp_node = (node)->next;\
node != (list);\
node = temp_node, temp_node = (node)->next)
// iterates over the list, entry should be the container structure type *
#define list_for_every_entry(list, entry, type, member) \
for((entry) = containerof((list)->next, type, member);\
&(entry)->member != (list);\
(entry) = containerof((entry)->member.next, type, member))
// iterates over the list in a safe way for deletion of current node
// entry and temp_entry should be the container structure type *
#define list_for_every_entry_safe(list, entry, temp_entry, type, member) \
for(entry = containerof((list)->next, type, member),\
temp_entry = containerof((entry)->member.next, type, member);\
&(entry)->member != (list);\
entry = temp_entry, temp_entry = containerof((temp_entry)->member.next, type, member))
static inline bool list_is_empty(struct list_node *list) {
return (list->next == list) ? true : false;
}
static inline size_t list_length(struct list_node *list) {
size_t cnt = 0;
struct list_node *node = list;
list_for_every(list, node) {
cnt++;
}
return cnt;
}
__END_CDECLS

53
top/include/lk/pow2.h Normal file
View File

@@ -0,0 +1,53 @@
/*
* Copyright (c) 2008-2014 Travis Geiselbrecht
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <lk/compiler.h>
#include <sys/types.h>
#include <stdbool.h>
#include <stdint.h>
__BEGIN_CDECLS
/* routines for dealing with power of 2 values for efficiency */
static inline __ALWAYS_INLINE bool ispow2(uint val) {
return ((val - 1) & val) == 0;
}
static inline __ALWAYS_INLINE uint log2_uint(uint val) {
if (val == 0)
return 0; // undefined
return (sizeof(val) * 8) - 1 - __builtin_clz(val);
}
static inline __ALWAYS_INLINE uint valpow2(uint valp2) {
return 1U << valp2;
}
static inline __ALWAYS_INLINE uint divpow2(uint val, uint divp2) {
return val >> divp2;
}
static inline __ALWAYS_INLINE uint modpow2(uint val, uint modp2) {
return val & ((1UL << modp2) - 1);
}
// Cribbed from:
// http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2
static inline __ALWAYS_INLINE uint32_t round_up_pow2_u32(uint32_t v) {
v--;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
v++;
return v;
}
__END_CDECLS

26
top/include/lk/reg.h Normal file
View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2008 Travis Geiselbrecht
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <stdint.h>
/* low level macros for accessing memory mapped hardware registers */
#define REG64(addr) ((volatile uint64_t *)(uintptr_t)(addr))
#define REG32(addr) ((volatile uint32_t *)(uintptr_t)(addr))
#define REG16(addr) ((volatile uint16_t *)(uintptr_t)(addr))
#define REG8(addr) ((volatile uint8_t *)(uintptr_t)(addr))
#define RMWREG64(addr, startbit, width, val) *REG64(addr) = (*REG64(addr) & ~(((1<<(width)) - 1) << (startbit))) | ((val) << (startbit))
#define RMWREG32(addr, startbit, width, val) *REG32(addr) = (*REG32(addr) & ~(((1<<(width)) - 1) << (startbit))) | ((val) << (startbit))
#define RMWREG16(addr, startbit, width, val) *REG16(addr) = (*REG16(addr) & ~(((1<<(width)) - 1) << (startbit))) | ((val) << (startbit))
#define RMWREG8(addr, startbit, width, val) *REG8(addr) = (*REG8(addr) & ~(((1<<(width)) - 1) << (startbit))) | ((val) << (startbit))
#define writel(v, a) (*REG32(a) = (v))
#define readl(a) (*REG32(a))
#define writeb(v, a) (*REG8(a) = (v))
#define readb(a) (*REG8(a))

25
top/include/lk/trace.h Normal file
View File

@@ -0,0 +1,25 @@
/*
* Copyright (c) 2008-2013 Travis Geiselbrecht
*
* Use of this source code is governed by a MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT
*/
#pragma once
#include <stdio.h>
/* trace routines */
#define TRACE_ENTRY printf("%s: entry\n", __PRETTY_FUNCTION__)
#define TRACE_EXIT printf("%s: exit\n", __PRETTY_FUNCTION__)
#define TRACE_ENTRY_OBJ printf("%s: entry obj %p\n", __PRETTY_FUNCTION__, this)
#define TRACE_EXIT_OBJ printf("%s: exit obj %p\n", __PRETTY_FUNCTION__, this)
#define TRACE printf("%s:%d\n", __PRETTY_FUNCTION__, __LINE__)
#define TRACEF(str, x...) do { printf("%s:%d: " str, __PRETTY_FUNCTION__, __LINE__, ## x); } while (0)
/* trace routines that work if LOCAL_TRACE is set */
#define LTRACE_ENTRY do { if (LOCAL_TRACE) { TRACE_ENTRY; } } while (0)
#define LTRACE_EXIT do { if (LOCAL_TRACE) { TRACE_EXIT; } } while (0)
#define LTRACE do { if (LOCAL_TRACE) { TRACE; } } while (0)
#define LTRACEF(x...) do { if (LOCAL_TRACE) { TRACEF(x); } } while (0)
#define LTRACEF_LEVEL(level, x...) do { if (LOCAL_TRACE >= (level)) { TRACEF(x); } } while (0)

View File

@@ -3,11 +3,12 @@ LOCAL_DIR := $(GET_LOCAL_DIR)
MODULE := $(LOCAL_DIR)
MODULE_DEPS := \
platform \
target \
app \
arch \
dev \
kernel
kernel \
platform \
target
MODULE_SRCS := \
$(LOCAL_DIR)/init.c \