RGMP 4.0 update from Qiang Yu
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5305 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
6a4d802afc
commit
308516c028
33 changed files with 2141 additions and 573 deletions
|
|
@ -3561,4 +3561,5 @@
|
|||
constructors before main() starts. BUT... NuttX is not initialized
|
||||
and this results in a crash. On the STM324Discovery, I will have
|
||||
better control over when the static constructors run.
|
||||
* RGMP 4.0 updated from Qiany Yu.
|
||||
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@
|
|||
#define AFIO_MAPR2_TIM14_REMAP (1 << 9) /* Bit 9: TIM14 remapping */
|
||||
#define AFIO_MAPR2_FSMC_NADV (1 << 10) /* Bit 10: NADV connect/disconnect */
|
||||
#ifdef CONFIG_STM32_VALUELINE
|
||||
# define AFIO_MAPR2_TIM76_DAC_DMA_REMAP (1 << 11) /* Bit 11: TIM67_DAC DMA remapping */
|
||||
# define AFIO_MAPR2_TIM67_DAC_DMA_REMAP (1 << 11) /* Bit 11: TIM67_DAC DMA remapping */
|
||||
# define AFIO_MAPR2_TIM12_REMAP (1 << 12) /* Bit 12: TIM12 remapping */
|
||||
# define AFIO_MAPR2_MISC_REMAP (1 << 13) /* Bit 13: Miscellaneous features remapping */
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@
|
|||
|
||||
#include <nuttx/sched.h>
|
||||
|
||||
|
||||
struct up_wait {
|
||||
struct up_wait *next;
|
||||
_TCB *task;
|
||||
|
|
|
|||
|
|
@ -44,12 +44,13 @@
|
|||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <rgmp/spinlock.h>
|
||||
#include <arch/types.h>
|
||||
|
||||
#include <rgmp/trap.h>
|
||||
#include <rgmp/arch/arch.h>
|
||||
|
||||
struct xcptcontext {
|
||||
struct Trapframe *tf;
|
||||
struct rgmp_context ctx;
|
||||
// for signal using
|
||||
unsigned int save_eip;
|
||||
unsigned int save_eflags;
|
||||
|
|
@ -63,12 +64,14 @@ extern int nest_irq;
|
|||
|
||||
static inline irqstate_t irqsave(void)
|
||||
{
|
||||
return pushcli();
|
||||
unsigned long flags;
|
||||
local_irq_save(flags);
|
||||
return flags;
|
||||
}
|
||||
|
||||
static inline void irqrestore(irqstate_t flags)
|
||||
{
|
||||
popcli(flags);
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
|
|
|||
|
|
@ -57,6 +57,200 @@ extern "C" {
|
|||
|
||||
#include <rgmp/math.h>
|
||||
|
||||
// following functions are not implemented by RGMP math library
|
||||
// don't use them
|
||||
// declared here for cmath
|
||||
|
||||
/* General Functions ********************************************************/
|
||||
|
||||
float ceilf (float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double ceil (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double ceill (long double x);
|
||||
#endif
|
||||
|
||||
float floorf(float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double floor (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double floorl(long double x);
|
||||
#endif
|
||||
|
||||
float fabsf (float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double fabs (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double fabsl (long double x);
|
||||
#endif
|
||||
|
||||
float modff (float x, float *iptr);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double modf (double x, double *iptr);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double modfl (long double x, long double *iptr);
|
||||
#endif
|
||||
|
||||
float fmodf (float x, float div);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double fmod (double x, double div);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double fmodl (long double x, long double div);
|
||||
#endif
|
||||
|
||||
/* Exponential and Logarithmic Functions ************************************/
|
||||
|
||||
float powf (float b, float e);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double pow (double b, double e);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double powl (long double b, long double e);
|
||||
#endif
|
||||
|
||||
float expf (float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double exp (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double expl (long double x);
|
||||
#endif
|
||||
|
||||
float logf (float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double log (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double logl (long double x);
|
||||
#endif
|
||||
|
||||
float log10f(float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double log10 (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double log10l(long double x);
|
||||
#endif
|
||||
|
||||
float log2f (float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double log2 (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double log2l (long double x);
|
||||
#endif
|
||||
|
||||
float sqrtf (float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double sqrt (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double sqrtl (long double x);
|
||||
#endif
|
||||
|
||||
float ldexpf(float x, int n);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
double ldexp (double x, int n);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double ldexpl(long double x, int n);
|
||||
#endif
|
||||
|
||||
float frexpf(float x, int *exp);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
double frexp (double x, int *exp);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double frexpl(long double x, int *exp);
|
||||
#endif
|
||||
|
||||
/* Trigonometric Functions **************************************************/
|
||||
|
||||
float sinf (float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double sin (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double sinl (long double x);
|
||||
#endif
|
||||
|
||||
float cosf (float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double cos (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double cosl (long double x);
|
||||
#endif
|
||||
|
||||
float tanf (float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double tan (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double tanl (long double x);
|
||||
#endif
|
||||
|
||||
float asinf (float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double asin (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double asinl (long double x);
|
||||
#endif
|
||||
|
||||
float acosf (float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double acos (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double acosl (long double x);
|
||||
#endif
|
||||
|
||||
float atanf (float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double atan (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double atanl (long double x);
|
||||
#endif
|
||||
|
||||
float atan2f(float y, float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double atan2 (double y, double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double atan2l(long double y, long double x);
|
||||
#endif
|
||||
|
||||
float sinhf (float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double sinh (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double sinhl (long double x);
|
||||
#endif
|
||||
|
||||
float coshf (float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double cosh (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double coshl (long double x);
|
||||
#endif
|
||||
|
||||
float tanhf (float x);
|
||||
#if CONFIG_HAVE_DOUBLE
|
||||
//double tanh (double x);
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_LONG_DOUBLE
|
||||
long double tanhl (long double x);
|
||||
#endif
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,9 +58,6 @@
|
|||
* use _Bool8 as the underlying type.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_ARCH_RGMP
|
||||
#define bool _Bool8
|
||||
#endif
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
|
|
@ -82,8 +79,6 @@
|
|||
* as the underlying type.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_ARCH_RGMP
|
||||
typedef uint8_t _Bool8;
|
||||
#endif
|
||||
|
||||
#endif /* __ARCH_RGMP_INCLUDE_STDBOOL_H */
|
||||
|
|
|
|||
|
|
@ -42,8 +42,11 @@
|
|||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <rgmp/arch/hpet.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <rgmp/arch/hpet.h>
|
||||
|
||||
static inline void up_mdelay(uint32_t msec)
|
||||
{
|
||||
|
|
@ -52,9 +55,13 @@ static inline void up_mdelay(uint32_t msec)
|
|||
|
||||
static inline void up_udelay(uint32_t usec)
|
||||
{
|
||||
hpet_udelay(usec*1000);
|
||||
hpet_ndelay(usec*1000);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -42,18 +42,21 @@ RGMP_ARCH_CSRCS := $(addprefix $(CONFIG_RGMP_SUBARCH)/,$(RGMP_ARCH_CSRCS))
|
|||
CFLAGS += -I$(TOPDIR)/sched -I$(TOPDIR)/fs
|
||||
|
||||
ASRCS = $(RGMP_ARCH_ASRCS)
|
||||
CSRCS = nuttx.c rgmp.c bridge.c $(RGMP_ARCH_CSRCS)
|
||||
CSRCS = nuttx.c cxx.c $(RGMP_ARCH_CSRCS)
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
OBJS = $(AOBJS) $(COBJS)
|
||||
|
||||
LINKSRCS = rgmp.c bridge.c
|
||||
LINKOBJS = $(LINKSRCS:.c=$(OBJEXT))
|
||||
|
||||
LDFLAGS += -T$(RGMPLKSCPT)
|
||||
LDPATHS = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
|
||||
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
|
||||
LDPATHS += -L$(RGMPLIBDIR)
|
||||
LDLIBS += -lrgmp -lm -ltest $(shell gcc -print-libgcc-file-name)
|
||||
LDLIBS += -lrgmp $(shell $(CC) -print-libgcc-file-name)
|
||||
|
||||
all: libarch$(LIBEXT)
|
||||
|
||||
|
|
@ -74,9 +77,9 @@ libarch$(LIBEXT): $(OBJS)
|
|||
# Generate the final NuttX binary by linking the host-specific objects with the NuttX
|
||||
# specific objects (with munged names)
|
||||
|
||||
nuttx$(EXEEXT):
|
||||
nuttx$(EXEEXT): $(LINKOBJS)
|
||||
@echo "LD: nuttx$(EXEEXT)"
|
||||
@$(LD) $(LDFLAGS) $(LDPATHS) --start-group $(LDLIBS) --end-group -o $(TOPDIR)/$@
|
||||
@$(LD) $(LDFLAGS) $(LDPATHS) $(LINKOBJS) --start-group $(LDLIBS) $(EXTRA_LIBS) --end-group -o $(TOPDIR)/$@
|
||||
@$(OBJDUMP) -S $(TOPDIR)/$@ > $(TOPDIR)/nuttx.asm
|
||||
@$(NM) -n $(TOPDIR)/$@ > $(TOPDIR)/nuttx.sym
|
||||
@$(OBJCOPY) -S -O binary $(TOPDIR)/$@ nuttx.img
|
||||
|
|
@ -88,14 +91,15 @@ export_head:
|
|||
|
||||
# Dependencies
|
||||
|
||||
.depend: Makefile $(SRCS)
|
||||
@$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||
.depend: Makefile $(SRCS) $(LINKSRCS)
|
||||
@$(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) $(LINKSRCS) >Make.dep
|
||||
@touch $@
|
||||
|
||||
depend: .depend
|
||||
|
||||
clean:
|
||||
@rm $(TOPDIR)/kernel.img nuttx.img
|
||||
@rm -f $(TOPDIR)/arch/rgmp/src/x86/*.o
|
||||
@rm -f $(TOPDIR)/kernel.img nuttx.img
|
||||
@rm -f libarch$(LIBEXT) *~ .*.swp
|
||||
$(call CLEAN)
|
||||
|
||||
|
|
|
|||
|
|
@ -44,25 +44,37 @@
|
|||
#include <fs_internal.h>
|
||||
#include <queue.h>
|
||||
#include <arch/irq.h>
|
||||
#include <rgmp/rtos.h>
|
||||
#include <rgmp/bridge.h>
|
||||
#include <rgmp/string.h>
|
||||
#include <rgmp/stdio.h>
|
||||
|
||||
struct bridge {
|
||||
struct rgmp_bridge *b;
|
||||
sem_t rd_lock;
|
||||
sem_t wr_lock;
|
||||
};
|
||||
|
||||
static ssize_t up_bridge_read(struct file *filp, char *buffer, size_t len)
|
||||
{
|
||||
struct rgmp_bridge *b;
|
||||
ssize_t ret;
|
||||
struct bridge *b = filp->f_inode->i_private;
|
||||
|
||||
b = filp->f_inode->i_private;
|
||||
return rgmp_bridge_read(b, buffer, len);
|
||||
sem_wait(&b->rd_lock);
|
||||
ret = rgmp_bridge_read(b->b, buffer, len, 0);
|
||||
sem_post(&b->rd_lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t up_bridge_write(struct file *filp, const char *buffer, size_t len)
|
||||
{
|
||||
struct rgmp_bridge *b;
|
||||
ssize_t ret;
|
||||
struct bridge *b = filp->f_inode->i_private;
|
||||
|
||||
b = filp->f_inode->i_private;
|
||||
return rgmp_bridge_write(b, (char *)buffer, len);
|
||||
sem_wait(&b->wr_lock);
|
||||
ret = rgmp_bridge_write(b->b, (char *)buffer, len, 0);
|
||||
sem_post(&b->wr_lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int up_bridge_open(struct file *filp)
|
||||
|
|
@ -75,30 +87,45 @@ static int up_bridge_close(struct file *filp)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations up_bridge_fops =
|
||||
{
|
||||
static const struct file_operations up_bridge_fops = {
|
||||
.read = up_bridge_read,
|
||||
.write = up_bridge_write,
|
||||
.open = up_bridge_open,
|
||||
.close = up_bridge_close,
|
||||
};
|
||||
|
||||
void up_register_bridges(void)
|
||||
int rtos_bridge_init(struct rgmp_bridge *b)
|
||||
{
|
||||
int err;
|
||||
struct bridge *bridge;
|
||||
char path[30] = {'/', 'd', 'e', 'v', '/'};
|
||||
struct rgmp_bridge *b;
|
||||
|
||||
for (b=bridge_list.next; b!=NULL; b=b->next) {
|
||||
if ((bridge = kmalloc(sizeof(*bridge))) == NULL)
|
||||
goto err0;
|
||||
|
||||
bridge->b = b;
|
||||
if ((err = sem_init(&bridge->rd_lock, 0, 1)) == ERROR)
|
||||
goto err1;
|
||||
if ((err = sem_init(&bridge->wr_lock, 0, 1)) == ERROR)
|
||||
goto err1;
|
||||
|
||||
// make rgmp_bridge0 to be the console
|
||||
if (strcmp(b->vdev->name, "rgmp_bridge0") == 0)
|
||||
strlcpy(path+5, "console", 25);
|
||||
strlcpy(path + 5, "console", 25);
|
||||
else
|
||||
strlcpy(path+5, b->vdev->name, 25);
|
||||
err = register_driver(path, &up_bridge_fops, 0666, b);
|
||||
if (err == ERROR)
|
||||
strlcpy(path + 5, b->vdev->name, 25);
|
||||
|
||||
if ((err = register_driver(path, &up_bridge_fops, 0666, bridge)) == ERROR) {
|
||||
cprintf("NuttX: register bridge %s fail\n", b->vdev->name);
|
||||
}
|
||||
goto err1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err1:
|
||||
kfree(bridge);
|
||||
err0:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
19
arch/rgmp/src/cxx.c
Normal file
19
arch/rgmp/src/cxx.c
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#include <rgmp/assert.h>
|
||||
#include <rgmp/stdio.h>
|
||||
|
||||
int stderr = 2;
|
||||
|
||||
void __stack_chk_fail_local(void)
|
||||
{
|
||||
panic("stack check fail\n");
|
||||
}
|
||||
|
||||
int __sprintf_chk(char *str, int flag, size_t strlen, const char *format)
|
||||
{
|
||||
return snprintf(str, strlen, format);
|
||||
}
|
||||
|
||||
int dl_iterate_phdr(void* arg1, void* arg2)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -38,13 +38,12 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include <rgmp/boot.h>
|
||||
#include <rgmp/pmap.h>
|
||||
#include <rgmp/cxx.h>
|
||||
#include <rgmp/memlayout.h>
|
||||
#include <rgmp/allocator.h>
|
||||
#include <rgmp/assert.h>
|
||||
#include <rgmp/spinlock.h>
|
||||
#include <rgmp/string.h>
|
||||
|
||||
#include <rgmp/arch/arch.h>
|
||||
#include <rgmp/arch/console.h>
|
||||
|
||||
#include <nuttx/sched.h>
|
||||
#include <nuttx/kmalloc.h>
|
||||
|
|
@ -67,37 +66,34 @@ static inline void up_switchcontext(_TCB *ctcb, _TCB *ntcb)
|
|||
{
|
||||
// do nothing if two tasks are the same
|
||||
if (ctcb == ntcb)
|
||||
return;
|
||||
return;
|
||||
|
||||
// this function can not be called in interrupt
|
||||
if (up_interrupt_context()) {
|
||||
panic("%s: try to switch context in interrupt\n", __func__);
|
||||
panic("%s: try to switch context in interrupt\n", __func__);
|
||||
}
|
||||
|
||||
// start switch
|
||||
current_task = ntcb;
|
||||
rgmp_context_switch(ctcb?&ctcb->xcp.tf:NULL, ntcb->xcp.tf);
|
||||
rgmp_context_switch(ctcb ? &ctcb->xcp.ctx : NULL, &ntcb->xcp.ctx);
|
||||
}
|
||||
|
||||
void up_initialize(void)
|
||||
{
|
||||
extern pidhash_t g_pidhash[];
|
||||
extern void up_register_bridges(void);
|
||||
extern void vnet_initialize(void);
|
||||
extern void vdev_init(void);
|
||||
extern void nuttx_arch_init(void);
|
||||
|
||||
// intialize the current_task to g_idletcb
|
||||
current_task = g_pidhash[PIDHASH(0)].tcb;
|
||||
|
||||
// setup console
|
||||
up_register_bridges();
|
||||
// OS memory alloc system is ready
|
||||
use_os_kmalloc = 1;
|
||||
|
||||
#ifdef CONFIG_NET_VNET
|
||||
// setup vnet device
|
||||
vnet_initialize();
|
||||
#endif
|
||||
// rgmp vdev init
|
||||
vdev_init();
|
||||
|
||||
nuttx_arch_init();
|
||||
nuttx_arch_init();
|
||||
|
||||
// enable interrupt
|
||||
local_irq_enable();
|
||||
|
|
@ -110,8 +106,9 @@ void up_idle(void)
|
|||
|
||||
void up_allocate_heap(void **heap_start, size_t *heap_size)
|
||||
{
|
||||
void *boot_freemem = boot_alloc(0, sizeof(int));
|
||||
*heap_start = boot_freemem;
|
||||
*heap_size = KERNBASE + boot_param.mem_size - (uint32_t)boot_freemem;
|
||||
*heap_size = KERNBASE + kmem_size - (uint32_t)boot_freemem;
|
||||
}
|
||||
|
||||
int up_create_stack(_TCB *tcb, size_t stack_size)
|
||||
|
|
@ -128,16 +125,16 @@ int up_create_stack(_TCB *tcb, size_t stack_size)
|
|||
|
||||
uint32_t *stack_alloc_ptr = (uint32_t*)kmalloc(adj_stack_size);
|
||||
if (stack_alloc_ptr) {
|
||||
/* This is the address of the last word in the allocation */
|
||||
/* This is the address of the last word in the allocation */
|
||||
|
||||
adj_stack_ptr = &stack_alloc_ptr[adj_stack_words - 1];
|
||||
adj_stack_ptr = &stack_alloc_ptr[adj_stack_words - 1];
|
||||
|
||||
/* Save the values in the TCB */
|
||||
/* Save the values in the TCB */
|
||||
|
||||
tcb->adj_stack_size = adj_stack_size;
|
||||
tcb->stack_alloc_ptr = stack_alloc_ptr;
|
||||
tcb->adj_stack_ptr = (void *)((unsigned int)adj_stack_ptr & ~7);
|
||||
ret = OK;
|
||||
tcb->adj_stack_size = adj_stack_size;
|
||||
tcb->stack_alloc_ptr = stack_alloc_ptr;
|
||||
tcb->adj_stack_ptr = (void *)((unsigned int)adj_stack_ptr & ~7);
|
||||
ret = OK;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -164,7 +161,7 @@ int up_use_stack(_TCB *tcb, void *stack, size_t stack_size)
|
|||
void up_release_stack(_TCB *dtcb)
|
||||
{
|
||||
if (dtcb->stack_alloc_ptr) {
|
||||
free(dtcb->stack_alloc_ptr);
|
||||
free(dtcb->stack_alloc_ptr);
|
||||
}
|
||||
|
||||
dtcb->stack_alloc_ptr = NULL;
|
||||
|
|
@ -199,43 +196,43 @@ void up_block_task(_TCB *tcb, tstate_t task_state)
|
|||
{
|
||||
/* Verify that the context switch can be performed */
|
||||
if ((tcb->task_state < FIRST_READY_TO_RUN_STATE) ||
|
||||
(tcb->task_state > LAST_READY_TO_RUN_STATE)) {
|
||||
warn("%s: task sched error\n", __func__);
|
||||
return;
|
||||
(tcb->task_state > LAST_READY_TO_RUN_STATE)) {
|
||||
warn("%s: task sched error\n", __func__);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
_TCB *rtcb = current_task;
|
||||
bool switch_needed;
|
||||
_TCB *rtcb = current_task;
|
||||
bool switch_needed;
|
||||
|
||||
/* Remove the tcb task from the ready-to-run list. If we
|
||||
* are blocking the task at the head of the task list (the
|
||||
* most likely case), then a context switch to the next
|
||||
* ready-to-run task is needed. In this case, it should
|
||||
* also be true that rtcb == tcb.
|
||||
*/
|
||||
switch_needed = sched_removereadytorun(tcb);
|
||||
/* Remove the tcb task from the ready-to-run list. If we
|
||||
* are blocking the task at the head of the task list (the
|
||||
* most likely case), then a context switch to the next
|
||||
* ready-to-run task is needed. In this case, it should
|
||||
* also be true that rtcb == tcb.
|
||||
*/
|
||||
switch_needed = sched_removereadytorun(tcb);
|
||||
|
||||
/* Add the task to the specified blocked task list */
|
||||
sched_addblocked(tcb, (tstate_t)task_state);
|
||||
/* Add the task to the specified blocked task list */
|
||||
sched_addblocked(tcb, (tstate_t)task_state);
|
||||
|
||||
/* Now, perform the context switch if one is needed */
|
||||
if (switch_needed) {
|
||||
_TCB *nexttcb;
|
||||
// this part should not be executed in interrupt context
|
||||
if (up_interrupt_context()) {
|
||||
panic("%s: %d\n", __func__, __LINE__);
|
||||
}
|
||||
// If there are any pending tasks, then add them to the g_readytorun
|
||||
// task list now. It should be the up_realease_pending() called from
|
||||
// sched_unlock() to do this for disable preemption. But it block
|
||||
// itself, so it's OK.
|
||||
if (g_pendingtasks.head) {
|
||||
warn("Disable preemption failed for task block itself\n");
|
||||
sched_mergepending();
|
||||
}
|
||||
nexttcb = (_TCB*)g_readytorun.head;
|
||||
// context switch
|
||||
up_switchcontext(rtcb, nexttcb);
|
||||
/* Now, perform the context switch if one is needed */
|
||||
if (switch_needed) {
|
||||
_TCB *nexttcb;
|
||||
// this part should not be executed in interrupt context
|
||||
if (up_interrupt_context()) {
|
||||
panic("%s: %d\n", __func__, __LINE__);
|
||||
}
|
||||
// If there are any pending tasks, then add them to the g_readytorun
|
||||
// task list now. It should be the up_realease_pending() called from
|
||||
// sched_unlock() to do this for disable preemption. But it block
|
||||
// itself, so it's OK.
|
||||
if (g_pendingtasks.head) {
|
||||
warn("Disable preemption failed for task block itself\n");
|
||||
sched_mergepending();
|
||||
}
|
||||
nexttcb = (_TCB*)g_readytorun.head;
|
||||
// context switch
|
||||
up_switchcontext(rtcb, nexttcb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -259,31 +256,31 @@ void up_unblock_task(_TCB *tcb)
|
|||
{
|
||||
/* Verify that the context switch can be performed */
|
||||
if ((tcb->task_state < FIRST_BLOCKED_STATE) ||
|
||||
(tcb->task_state > LAST_BLOCKED_STATE)) {
|
||||
warn("%s: task sched error\n", __func__);
|
||||
return;
|
||||
(tcb->task_state > LAST_BLOCKED_STATE)) {
|
||||
warn("%s: task sched error\n", __func__);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
_TCB *rtcb = current_task;
|
||||
_TCB *rtcb = current_task;
|
||||
|
||||
/* Remove the task from the blocked task list */
|
||||
sched_removeblocked(tcb);
|
||||
/* Remove the task from the blocked task list */
|
||||
sched_removeblocked(tcb);
|
||||
|
||||
/* Reset its timeslice. This is only meaningful for round
|
||||
* robin tasks but it doesn't here to do it for everything
|
||||
*/
|
||||
/* Reset its timeslice. This is only meaningful for round
|
||||
* robin tasks but it doesn't here to do it for everything
|
||||
*/
|
||||
#if CONFIG_RR_INTERVAL > 0
|
||||
tcb->timeslice = CONFIG_RR_INTERVAL / MSEC_PER_TICK;
|
||||
tcb->timeslice = CONFIG_RR_INTERVAL / MSEC_PER_TICK;
|
||||
#endif
|
||||
|
||||
// Add the task in the correct location in the prioritized
|
||||
// g_readytorun task list.
|
||||
if (sched_addreadytorun(tcb) && !up_interrupt_context()) {
|
||||
/* The currently active task has changed! */
|
||||
_TCB *nexttcb = (_TCB*)g_readytorun.head;
|
||||
// context switch
|
||||
up_switchcontext(rtcb, nexttcb);
|
||||
}
|
||||
// Add the task in the correct location in the prioritized
|
||||
// g_readytorun task list.
|
||||
if (sched_addreadytorun(tcb) && !up_interrupt_context()) {
|
||||
/* The currently active task has changed! */
|
||||
_TCB *nexttcb = (_TCB*)g_readytorun.head;
|
||||
// context switch
|
||||
up_switchcontext(rtcb, nexttcb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -298,11 +295,11 @@ void up_release_pending(void)
|
|||
/* Merge the g_pendingtasks list into the g_readytorun task list */
|
||||
|
||||
if (sched_mergepending()) {
|
||||
/* The currently active task has changed! */
|
||||
_TCB *nexttcb = (_TCB*)g_readytorun.head;
|
||||
/* The currently active task has changed! */
|
||||
_TCB *nexttcb = (_TCB*)g_readytorun.head;
|
||||
|
||||
// context switch
|
||||
up_switchcontext(rtcb, nexttcb);
|
||||
// context switch
|
||||
up_switchcontext(rtcb, nexttcb);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -311,54 +308,54 @@ void up_reprioritize_rtr(_TCB *tcb, uint8_t priority)
|
|||
/* Verify that the caller is sane */
|
||||
|
||||
if (tcb->task_state < FIRST_READY_TO_RUN_STATE ||
|
||||
tcb->task_state > LAST_READY_TO_RUN_STATE
|
||||
tcb->task_state > LAST_READY_TO_RUN_STATE
|
||||
#if SCHED_PRIORITY_MIN > UINT8_MIN
|
||||
|| priority < SCHED_PRIORITY_MIN
|
||||
|| priority < SCHED_PRIORITY_MIN
|
||||
#endif
|
||||
#if SCHED_PRIORITY_MAX < UINT8_MAX
|
||||
|| priority > SCHED_PRIORITY_MAX
|
||||
|| priority > SCHED_PRIORITY_MAX
|
||||
#endif
|
||||
) {
|
||||
warn("%s: task sched error\n", __func__);
|
||||
return;
|
||||
) {
|
||||
warn("%s: task sched error\n", __func__);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
_TCB *rtcb = current_task;
|
||||
bool switch_needed;
|
||||
_TCB *rtcb = current_task;
|
||||
bool switch_needed;
|
||||
|
||||
/* Remove the tcb task from the ready-to-run list.
|
||||
* sched_removereadytorun will return true if we just
|
||||
* remove the head of the ready to run list.
|
||||
*/
|
||||
switch_needed = sched_removereadytorun(tcb);
|
||||
/* Remove the tcb task from the ready-to-run list.
|
||||
* sched_removereadytorun will return true if we just
|
||||
* remove the head of the ready to run list.
|
||||
*/
|
||||
switch_needed = sched_removereadytorun(tcb);
|
||||
|
||||
/* Setup up the new task priority */
|
||||
tcb->sched_priority = (uint8_t)priority;
|
||||
/* Setup up the new task priority */
|
||||
tcb->sched_priority = (uint8_t)priority;
|
||||
|
||||
/* Return the task to the specified blocked task list.
|
||||
* sched_addreadytorun will return true if the task was
|
||||
* added to the new list. We will need to perform a context
|
||||
* switch only if the EXCLUSIVE or of the two calls is non-zero
|
||||
* (i.e., one and only one the calls changes the head of the
|
||||
* ready-to-run list).
|
||||
*/
|
||||
switch_needed ^= sched_addreadytorun(tcb);
|
||||
/* Return the task to the specified blocked task list.
|
||||
* sched_addreadytorun will return true if the task was
|
||||
* added to the new list. We will need to perform a context
|
||||
* switch only if the EXCLUSIVE or of the two calls is non-zero
|
||||
* (i.e., one and only one the calls changes the head of the
|
||||
* ready-to-run list).
|
||||
*/
|
||||
switch_needed ^= sched_addreadytorun(tcb);
|
||||
|
||||
/* Now, perform the context switch if one is needed */
|
||||
if (switch_needed && !up_interrupt_context()) {
|
||||
_TCB *nexttcb;
|
||||
// If there are any pending tasks, then add them to the g_readytorun
|
||||
// task list now. It should be the up_realease_pending() called from
|
||||
// sched_unlock() to do this for disable preemption. But it block
|
||||
// itself, so it's OK.
|
||||
if (g_pendingtasks.head) {
|
||||
warn("Disable preemption failed for reprioritize task\n");
|
||||
sched_mergepending();
|
||||
/* Now, perform the context switch if one is needed */
|
||||
if (switch_needed && !up_interrupt_context()) {
|
||||
_TCB *nexttcb;
|
||||
// If there are any pending tasks, then add them to the g_readytorun
|
||||
// task list now. It should be the up_realease_pending() called from
|
||||
// sched_unlock() to do this for disable preemption. But it block
|
||||
// itself, so it's OK.
|
||||
if (g_pendingtasks.head) {
|
||||
warn("Disable preemption failed for reprioritize task\n");
|
||||
sched_mergepending();
|
||||
}
|
||||
|
||||
nexttcb = (_TCB*)g_readytorun.head;
|
||||
// context switch
|
||||
up_switchcontext(rtcb, nexttcb);
|
||||
nexttcb = (_TCB*)g_readytorun.head;
|
||||
// context switch
|
||||
up_switchcontext(rtcb, nexttcb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -390,26 +387,26 @@ void up_assert(const uint8_t *filename, int line)
|
|||
// which will stop the OS
|
||||
// if in user space just terminate the task
|
||||
if (up_interrupt_context() || current_task->pid == 0) {
|
||||
panic("%s: %d\n", __func__, __LINE__);
|
||||
panic("%s: %d\n", __func__, __LINE__);
|
||||
}
|
||||
else {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
void up_assert_code(const uint8_t *filename, int line, int code)
|
||||
{
|
||||
fprintf(stderr, "Assertion failed at file:%s line: %d error code: %d\n",
|
||||
filename, line, code);
|
||||
filename, line, code);
|
||||
|
||||
// in interrupt context or idle task means kernel error
|
||||
// which will stop the OS
|
||||
// if in user space just terminate the task
|
||||
if (up_interrupt_context() || current_task->pid == 0) {
|
||||
panic("%s: %d\n", __func__, __LINE__);
|
||||
panic("%s: %d\n", __func__, __LINE__);
|
||||
}
|
||||
else {
|
||||
exit(EXIT_FAILURE);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -420,38 +417,38 @@ void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver)
|
|||
{
|
||||
/* Refuse to handle nested signal actions */
|
||||
if (!tcb->xcp.sigdeliver) {
|
||||
int flags;
|
||||
int flags;
|
||||
|
||||
/* Make sure that interrupts are disabled */
|
||||
flags = pushcli();
|
||||
/* Make sure that interrupts are disabled */
|
||||
local_irq_save(flags);
|
||||
|
||||
// First, handle some special cases when the signal is
|
||||
// being delivered to the currently executing task.
|
||||
if (tcb == current_task) {
|
||||
// CASE 1: We are not in an interrupt handler and
|
||||
// a task is signalling itself for some reason.
|
||||
if (!up_interrupt_context()) {
|
||||
// In this case just deliver the signal now.
|
||||
sigdeliver(tcb);
|
||||
}
|
||||
// CASE 2: We are in an interrupt handler AND the
|
||||
// interrupted task is the same as the one that
|
||||
// must receive the signal.
|
||||
else {
|
||||
tcb->xcp.sigdeliver = sigdeliver;
|
||||
// First, handle some special cases when the signal is
|
||||
// being delivered to the currently executing task.
|
||||
if (tcb == current_task) {
|
||||
// CASE 1: We are not in an interrupt handler and
|
||||
// a task is signalling itself for some reason.
|
||||
if (!up_interrupt_context()) {
|
||||
// In this case just deliver the signal now.
|
||||
sigdeliver(tcb);
|
||||
}
|
||||
// CASE 2: We are in an interrupt handler AND the
|
||||
// interrupted task is the same as the one that
|
||||
// must receive the signal.
|
||||
else {
|
||||
tcb->xcp.sigdeliver = sigdeliver;
|
||||
}
|
||||
}
|
||||
|
||||
// Otherwise, we are (1) signaling a task is not running
|
||||
// from an interrupt handler or (2) we are not in an
|
||||
// interrupt handler and the running task is signalling
|
||||
// some non-running task.
|
||||
else {
|
||||
tcb->xcp.sigdeliver = sigdeliver;
|
||||
push_xcptcontext(&tcb->xcp);
|
||||
// Otherwise, we are (1) signaling a task is not running
|
||||
// from an interrupt handler or (2) we are not in an
|
||||
// interrupt handler and the running task is signalling
|
||||
// some non-running task.
|
||||
else {
|
||||
tcb->xcp.sigdeliver = sigdeliver;
|
||||
push_xcptcontext(&tcb->xcp);
|
||||
}
|
||||
|
||||
popcli(flags);
|
||||
local_irq_restore(flags);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -461,7 +458,7 @@ void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver)
|
|||
bool up_interrupt_context(void)
|
||||
{
|
||||
if (nest_irq)
|
||||
return true;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -496,6 +493,16 @@ void up_sigdeliver(struct Trapframe *tf)
|
|||
local_irq_disable();
|
||||
}
|
||||
|
||||
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
|
||||
|
||||
void up_cxxinitialize(void)
|
||||
{
|
||||
rgmp_cxx_init();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include <rgmp/trap.h>
|
||||
#include <rgmp/mmu.h>
|
||||
#include <rgmp/rtos.h>
|
||||
#include <rgmp/arch/arch.h>
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
|
@ -56,9 +56,9 @@ int nest_irq = 0;
|
|||
|
||||
// the default time is 10ms
|
||||
#ifdef CONFIG_MSEC_PER_TICK
|
||||
unsigned int rtos_tick_time = CONFIG_MSEC_PER_TICK;
|
||||
const unsigned int rtos_tick_time = CONFIG_MSEC_PER_TICK;
|
||||
#else
|
||||
unsigned int rtos_tick_time = 10;
|
||||
const unsigned int rtos_tick_time = 10;
|
||||
#endif
|
||||
|
||||
void rtos_entry(void)
|
||||
|
|
@ -76,80 +76,71 @@ void rtos_free_page(void *page)
|
|||
free(page);
|
||||
}
|
||||
|
||||
void *rtos_kmalloc(int size)
|
||||
{
|
||||
return kmalloc(size);
|
||||
}
|
||||
|
||||
void rtos_kfree(void *addr)
|
||||
{
|
||||
kfree(addr);
|
||||
}
|
||||
|
||||
/**
|
||||
* The interrupt can be nested. The pair of rtos_enter_interrupt()
|
||||
* and rtos_exit_interrupt() make sure the context switch is
|
||||
* performed only in the last IRQ exit.
|
||||
*/
|
||||
void rtos_enter_interrupt(struct Trapframe *tf)
|
||||
void rtos_enter_interrupt(void)
|
||||
{
|
||||
nest_irq++;
|
||||
}
|
||||
|
||||
void rtos_exit_interrupt(struct Trapframe *tf)
|
||||
void rtos_exit_interrupt(void)
|
||||
{
|
||||
local_irq_disable();
|
||||
nest_irq--;
|
||||
if (!nest_irq) {
|
||||
_TCB *rtcb = current_task;
|
||||
_TCB *ntcb;
|
||||
_TCB *rtcb = current_task;
|
||||
_TCB *ntcb;
|
||||
|
||||
if (rtcb->xcp.sigdeliver) {
|
||||
rtcb->xcp.tf = tf;
|
||||
push_xcptcontext(&rtcb->xcp);
|
||||
}
|
||||
ntcb = (_TCB*)g_readytorun.head;
|
||||
// switch needed
|
||||
if (rtcb != ntcb) {
|
||||
rtcb->xcp.tf = tf;
|
||||
current_task = ntcb;
|
||||
rgmp_pop_tf(ntcb->xcp.tf);
|
||||
}
|
||||
if (rtcb->xcp.sigdeliver) {
|
||||
rtcb->xcp.ctx.tf = current_regs;
|
||||
push_xcptcontext(&rtcb->xcp);
|
||||
}
|
||||
ntcb = (_TCB*)g_readytorun.head;
|
||||
// switch needed
|
||||
if (rtcb != ntcb) {
|
||||
rtcb->xcp.ctx.tf = current_regs;
|
||||
current_task = ntcb;
|
||||
rgmp_switch_to(&ntcb->xcp.ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rtos_timer_isr(struct Trapframe *tf)
|
||||
void rtos_timer_isr(void *data)
|
||||
{
|
||||
sched_process_timer();
|
||||
}
|
||||
|
||||
/**
|
||||
* RTOS mutex operation
|
||||
*/
|
||||
const int rtos_mutex_size = sizeof(sem_t);
|
||||
void rtos_mutex_init(void *lock)
|
||||
{
|
||||
sem_init(lock, 0, 1);
|
||||
}
|
||||
|
||||
int rtos_mutex_lock(void *lock)
|
||||
{
|
||||
return sem_wait(lock);
|
||||
}
|
||||
|
||||
int rtos_mutex_unlock(void *lock)
|
||||
{
|
||||
return sem_post(lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* RTOS semaphore operation
|
||||
*/
|
||||
const int rtos_semaphore_size = sizeof(sem_t);
|
||||
|
||||
void rtos_sem_init(void *sem, int val)
|
||||
int rtos_sem_init(struct semaphore *sem, int val)
|
||||
{
|
||||
sem_init(sem, 0, val);
|
||||
if ((sem->sem = kmalloc(sizeof(sem_t))) == NULL)
|
||||
return -1;
|
||||
return sem_init(sem->sem, 0, val);
|
||||
}
|
||||
|
||||
int rtos_sem_up(void *sem)
|
||||
int rtos_sem_up(struct semaphore *sem)
|
||||
{
|
||||
return sem_post(sem);
|
||||
return sem_post(sem->sem);
|
||||
}
|
||||
|
||||
int rtos_sem_down(void *sem)
|
||||
int rtos_sem_down(struct semaphore *sem)
|
||||
{
|
||||
return sem_wait(sem);
|
||||
return sem_wait(sem->sem);
|
||||
}
|
||||
|
||||
void rtos_stop_running(void)
|
||||
|
|
@ -161,8 +152,16 @@ void rtos_stop_running(void)
|
|||
nuttx_arch_exit();
|
||||
|
||||
while(1) {
|
||||
arch_hlt();
|
||||
arch_hlt();
|
||||
}
|
||||
}
|
||||
|
||||
int rtos_vnet_init(struct rgmp_vnet *vnet)
|
||||
{
|
||||
extern int vnet_init(struct rgmp_vnet *vnet);
|
||||
|
||||
return vnet_init(vnet);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <rgmp/pmap.h>
|
||||
#include <rgmp/mmu.h>
|
||||
#include <rgmp/string.h>
|
||||
#include <rgmp/arch/fpu.h>
|
||||
|
||||
|
|
@ -75,32 +75,27 @@ void up_initial_state(_TCB *tcb)
|
|||
{
|
||||
struct Trapframe *tf;
|
||||
|
||||
if (tcb->pid != 0) {
|
||||
tf = (struct Trapframe *)tcb->adj_stack_ptr-1;
|
||||
memset(tf, 0, sizeof(struct Trapframe));
|
||||
tf->tf_fpu = rgmp_fpu_init_regs;
|
||||
tf->tf_eflags = 0x00000202;
|
||||
tf->tf_cs = GD_KT;
|
||||
tf->tf_ds = GD_KD;
|
||||
tf->tf_es = GD_KD;
|
||||
tf->tf_eip = (uint32_t)tcb->start;
|
||||
tcb->xcp.tf = tf;
|
||||
if (tcb->pid) {
|
||||
tf = (struct Trapframe *)tcb->adj_stack_ptr - 1;
|
||||
rgmp_setup_context(&tcb->xcp.ctx, tf, tcb->start, 1);
|
||||
}
|
||||
else
|
||||
rgmp_setup_context(&tcb->xcp.ctx, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
void push_xcptcontext(struct xcptcontext *xcp)
|
||||
{
|
||||
xcp->save_eip = xcp->tf->tf_eip;
|
||||
xcp->save_eflags = xcp->tf->tf_eflags;
|
||||
xcp->save_eip = xcp->ctx.tf->tf_eip;
|
||||
xcp->save_eflags = xcp->ctx.tf->tf_eflags;
|
||||
|
||||
// set up signal entry with interrupts disabled
|
||||
xcp->tf->tf_eip = (uint32_t)up_sigentry;
|
||||
xcp->tf->tf_eflags = 0;
|
||||
xcp->ctx.tf->tf_eip = (uint32_t)up_sigentry;
|
||||
xcp->ctx.tf->tf_eflags = 0;
|
||||
}
|
||||
|
||||
void pop_xcptcontext(struct xcptcontext *xcp)
|
||||
{
|
||||
xcp->tf->tf_eip = xcp->save_eip;
|
||||
xcp->tf->tf_eflags = xcp->save_eflags;
|
||||
xcp->ctx.tf->tf_eip = xcp->save_eip;
|
||||
xcp->ctx.tf->tf_eflags = xcp->save_eflags;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,6 @@
|
|||
#include <arch/com.h>
|
||||
|
||||
#include <rgmp/trap.h>
|
||||
#include <rgmp/arch/console.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
|
|
@ -129,7 +128,7 @@ static int up_setup(struct uart_dev_s *dev);
|
|||
static void up_shutdown(struct uart_dev_s *dev);
|
||||
static int up_attach(struct uart_dev_s *dev);
|
||||
static void up_detach(struct uart_dev_s *dev);
|
||||
static irqreturn_t up_com_int_handler(struct Trapframe *tf, void *dev_id);
|
||||
static irqreturn_t up_com_int_handler(int irq, void *dev_id);
|
||||
static int up_ioctl(struct file *filep, int cmd, unsigned long arg);
|
||||
static int up_receive(struct uart_dev_s *dev, unsigned int *status);
|
||||
static void up_rxint(struct uart_dev_s *dev, bool enable);
|
||||
|
|
@ -345,7 +344,7 @@ static void up_detach(struct uart_dev_s *dev)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
static irqreturn_t up_com_int_handler(struct Trapframe *tf, void *dev_id)
|
||||
static irqreturn_t up_com_int_handler(int irq, void *dev_id)
|
||||
{
|
||||
struct uart_dev_s *dev = dev_id;
|
||||
struct up_dev_s *priv = dev->priv;
|
||||
|
|
@ -622,6 +621,7 @@ void up_serialinit(void)
|
|||
* writes
|
||||
*
|
||||
****************************************************************************/
|
||||
extern void cons_putc(int c);
|
||||
|
||||
int up_putc(int ch)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -39,11 +39,11 @@
|
|||
|
||||
.globl up_sigentry
|
||||
up_sigentry:
|
||||
subl $172, %esp # 172 is the size of TrapFrame
|
||||
subl $172, %esp # 172 is the size of Trapframe without cross ring part
|
||||
pushl %esp
|
||||
movl %esp, %eax
|
||||
call up_sigdeliver
|
||||
addl $8, %esp # skip parameter and current_task
|
||||
addl $8, %esp # skip parameter and tf_curregs
|
||||
frstor 0(%esp)
|
||||
addl $108, %esp
|
||||
popal
|
||||
|
|
|
|||
134
configs/rgmp/x86/cxxtest/Make.defs
Normal file
134
configs/rgmp/x86/cxxtest/Make.defs
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
####################################################################################
|
||||
# configs/rgmp/default/Make.defs
|
||||
#
|
||||
# Copyright (C) 2011 Yu Qiang. All rights reserved.
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Authors: Yu Qiang <yuq825@gmail.com>
|
||||
# Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include ${TOPDIR}/.config
|
||||
|
||||
RGMPLIBDIR := $(RGMP_INST_DIR)/lib
|
||||
RGMPINCDIR := $(RGMP_INST_DIR)/include
|
||||
RGMPLKSCPT := $(RGMP_INST_DIR)/etc/rgmp.ld
|
||||
|
||||
HOSTOS = ${shell uname -o}
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -O2 -gstabs
|
||||
else
|
||||
ARCHOPTIMIZATION = -O2
|
||||
endif
|
||||
|
||||
#ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
|
||||
ARCHCXXFLAGS = -fno-builtin
|
||||
ARCHCPUFLAGS = -fno-builtin -nostdinc -fno-stack-protector
|
||||
ARCHPICFLAGS = -fpic
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
|
||||
ARCHWARNINGSXX = -Wall -Wshadow
|
||||
ARCHDEFINES = -D__RGMP_KERNEL__ -D__RTOS_KERNEL__ -D__SHARE_KERNEL__
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include -I$(RGMPINCDIR) \
|
||||
-I$(TOPDIR)/configs/rgmp/include -I$(TOPDIR)/arch/rgmp/include/x86
|
||||
|
||||
ARCHXXDEFINES =
|
||||
ARCHXXINCLUDES = -I$(TOPDIR)/include/cxx -isystem $(TOPDIR)/include -I$(RGMPINCDIR) \
|
||||
-I$(TOPDIR)/configs/rgmp/include -I$(TOPDIR)/arch/rgmp/include/x86 \
|
||||
-I$(TOPDIR)/include/uClibc++
|
||||
|
||||
CROSSDEV =
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) \
|
||||
$(ARCHXXDEFINES) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) \
|
||||
-pipe -nodefaultlibs -nostdinc++
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
|
||||
ifeq ($(HOSTOS),Cygwin)
|
||||
EXEEXT = .exe
|
||||
else
|
||||
EXEEXT =
|
||||
endif
|
||||
|
||||
LDFLAGS += -nostdlib
|
||||
EXTRA_LIBS = $(shell $(CC) -print-file-name=libsupc++.a) \
|
||||
$(shell $(CC) -print-file-name=libgcc_eh.a)
|
||||
|
||||
define PREPROCESS
|
||||
@echo "CPP: $1->$2"
|
||||
@$(CPP) $(CPPFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define COMPILE
|
||||
@echo "CC: $1"
|
||||
@$(CC) -c $(CFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define COMPILEXX
|
||||
@echo "CXX: $1"
|
||||
@$(CXX) -c $(CXXFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define ASSEMBLE
|
||||
@echo "AS: $1"
|
||||
@$(CC) -c $(AFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define ARCHIVE
|
||||
echo "AR: $2"; \
|
||||
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
|
||||
endef
|
||||
|
||||
define CLEAN
|
||||
@rm -f *.o *.a
|
||||
endef
|
||||
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps.sh
|
||||
|
||||
HOSTCC = gcc
|
||||
HOSTINCLUDES = -I.
|
||||
HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) -pipe
|
||||
HOSTLDFLAGS =
|
||||
39
configs/rgmp/x86/cxxtest/appconfig
Normal file
39
configs/rgmp/x86/cxxtest/appconfig
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
############################################################################
|
||||
# configs/sim/default/appconfig
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
# Path to example in apps/examples containing the user_start entry point
|
||||
|
||||
CONFIGURED_APPS += examples/cxxtest
|
||||
|
||||
428
configs/rgmp/x86/cxxtest/defconfig
Normal file
428
configs/rgmp/x86/cxxtest/defconfig
Normal file
|
|
@ -0,0 +1,428 @@
|
|||
############################################################################
|
||||
# configs/rgmp/default/defconfig
|
||||
#
|
||||
# Copyright (C) 2011 Yu Qiang. All rights reserved.
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Authors: Yu Qiang <yuq825@gmail.com>
|
||||
# Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
#
|
||||
# Architecture selection
|
||||
#
|
||||
# CONFIG_ARCH - identifies the arch subdirectory and, hence, the
|
||||
# processor architecture.
|
||||
# CONFIG_ARCH_name - for use in C code. This identifies the particular
|
||||
# processor architecture (CONFIG_ARCH_SIM).
|
||||
# CONFIG_ARCH_BOARD - identifies the configs subdirectory and, hence,
|
||||
# the board that supports the particular chip or SoC.
|
||||
# CONFIG_ARCH_BOARD_name - for use in C code
|
||||
# CONFIG_ENDIAN_BIG - define if big endian (default is little endian)
|
||||
#
|
||||
CONFIG_ARCH="rgmp"
|
||||
CONFIG_ARCH_RGMP=y
|
||||
CONFIG_ARCH_BOARD="rgmp"
|
||||
CONFIG_ARCH_BOARD_RGMP=y
|
||||
|
||||
#
|
||||
# General OS setup
|
||||
#
|
||||
# CONFIG_APPS_DIR - Identifies the relative path to the directory
|
||||
# that builds the application to link with NuttX. Default: ../apps
|
||||
# CONFIG_DEBUG - enables built-in debug options
|
||||
# CONFIG_DEBUG_VERBOSE - enables verbose debug output
|
||||
# CONFIG_DEBUG_SYMBOLS - build without optimization and with
|
||||
# debug symbols (needed for use with a debugger).
|
||||
# CONFIG_MM_REGIONS - If the architecture includes multiple
|
||||
# regions of memory to allocate from, this specifies the
|
||||
# number of memory regions that the memory manager must
|
||||
# handle and enables the API mm_addregion(start, end);
|
||||
# CONFIG_ARCH_LOWPUTC - architecture supports low-level, boot
|
||||
# time console output
|
||||
# CONFIG_MSEC_PER_TICK - The default system timer is 100Hz
|
||||
# or MSEC_PER_TICK=10. This setting may be defined to
|
||||
# inform NuttX that the processor hardware is providing
|
||||
# system timer interrupts at some interrupt interval other
|
||||
# than 10 msec.
|
||||
# CONFIG_RR_INTERVAL - The round robin timeslice will be set
|
||||
# this number of milliseconds; Round robin scheduling can
|
||||
# be disabled by setting this value to zero.
|
||||
# CONFIG_SCHED_INSTRUMENTATION - enables instrumentation in
|
||||
# scheduler to monitor system performance
|
||||
# CONFIG_TASK_NAME_SIZE - Spcifies that maximum size of a
|
||||
# task name to save in the TCB. Useful if scheduler
|
||||
# instrumentation is selected. Set to zero to disable.
|
||||
# CONFIG_JULIAN_TIME - Enables Julian time conversions
|
||||
# CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY -
|
||||
# Used to initialize the internal time logic.
|
||||
# CONFIG_DEV_CONSOLE - Set if architecture-specific logic
|
||||
# provides /dev/console. Enables stdout, stderr, stdin.
|
||||
# CONFIG_DEV_LOWCONSOLE - Use the simple, low-level serial console
|
||||
# driver (minimul support)
|
||||
# CONFIG_MUTEX_TYPES: Set to enable support for recursive and
|
||||
# errorcheck mutexes. Enables pthread_mutexattr_settype().
|
||||
# CONFIG_PRIORITY_INHERITANCE : Set to enable support for priority
|
||||
# inheritance on mutexes and semaphores.
|
||||
# CONFIG_SEM_PREALLOCHOLDERS: This setting is only used if priority
|
||||
# inheritance is enabled. It defines the maximum number of
|
||||
# different threads (minus one) that can take counts on a
|
||||
# semaphore with priority inheritance support. This may be
|
||||
# set to zero if priority inheritance is disabled OR if you
|
||||
# are only using semaphores as mutexes (only one holder) OR
|
||||
# if no more than two threads participate using a counting
|
||||
# semaphore.
|
||||
# CONFIG_SEM_NNESTPRIO. If priority inheritance is enabled,
|
||||
# then this setting is the maximum number of higher priority
|
||||
# threads (minus 1) than can be waiting for another thread
|
||||
# to release a count on a semaphore. This value may be set
|
||||
# to zero if no more than one thread is expected to wait for
|
||||
# a semaphore.
|
||||
# CONFIG_FDCLONE_DISABLE. Disable cloning of all file descriptors
|
||||
# by task_create() when a new task is started. If set, all
|
||||
# files/drivers will appear to be closed in the new task.
|
||||
# CONFIG_FDCLONE_STDIO. Disable cloning of all but the first
|
||||
# three file descriptors (stdin, stdout, stderr) by task_create()
|
||||
# when a new task is started. If set, all files/drivers will
|
||||
# appear to be closed in the new task except for stdin, stdout,
|
||||
# and stderr.
|
||||
# CONFIG_SDCLONE_DISABLE. Disable cloning of all socket
|
||||
# desciptors by task_create() when a new task is started. If
|
||||
# set, all sockets will appear to be closed in the new task.
|
||||
#
|
||||
#CONFIG_APPS_DIR=
|
||||
CONFIG_DEBUG=y
|
||||
CONFIG_DEBUG_VERBOSE=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_MM_REGIONS=1
|
||||
CONFIG_ARCH_LOWPUTC=y
|
||||
CONFIG_MSEC_PER_TICK=1
|
||||
CONFIG_RR_INTERVAL=0
|
||||
CONFIG_SCHED_INSTRUMENTATION=n
|
||||
CONFIG_TASK_NAME_SIZE=32
|
||||
CONFIG_START_YEAR=2007
|
||||
CONFIG_START_MONTH=2
|
||||
CONFIG_START_DAY=27
|
||||
CONFIG_JULIAN_TIME=n
|
||||
CONFIG_DEV_CONSOLE=y
|
||||
CONFIG_DEV_LOWCONSOLE=n
|
||||
CONFIG_MUTEX_TYPES=n
|
||||
CONFIG_PRIORITY_INHERITANCE=n
|
||||
CONFIG_SEM_PREALLOCHOLDERS=0
|
||||
CONFIG_SEM_NNESTPRIO=0
|
||||
CONFIG_FDCLONE_DISABLE=n
|
||||
CONFIG_FDCLONE_STDIO=n
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
|
||||
#
|
||||
# The following can be used to disable categories of
|
||||
# APIs supported by the OS. If the compiler supports
|
||||
# weak functions, then it should not be necessary to
|
||||
# disable functions unless you want to restrict usage
|
||||
# of those APIs.
|
||||
#
|
||||
# There are certain dependency relationships in these
|
||||
# features.
|
||||
#
|
||||
# o mq_notify logic depends on signals to awaken tasks
|
||||
# waiting for queues to become full or empty.
|
||||
# o pthread_condtimedwait() depends on signals to wake
|
||||
# up waiting tasks.
|
||||
#
|
||||
CONFIG_DISABLE_CLOCK=n
|
||||
CONFIG_DISABLE_POSIX_TIMERS=n
|
||||
CONFIG_DISABLE_PTHREAD=n
|
||||
CONFIG_DISABLE_SIGNALS=n
|
||||
CONFIG_DISABLE_MQUEUE=n
|
||||
CONFIG_DISABLE_MOUNTPOINT=n
|
||||
CONFIG_DISABLE_ENVIRON=n
|
||||
CONFIG_DISABLE_POLL=y
|
||||
|
||||
#
|
||||
# Misc libc settings
|
||||
#
|
||||
# CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a
|
||||
# little smaller if we do not support fieldwidthes
|
||||
#
|
||||
CONFIG_LIBC_FLOATINGPOINT=y
|
||||
CONFIG_NOPRINTF_FIELDWIDTH=n
|
||||
|
||||
#
|
||||
# Allow for architecture optimized implementations
|
||||
#
|
||||
# The architecture can provide optimized versions of the
|
||||
# following to improve sysem performance
|
||||
#
|
||||
CONFIG_ARCH_MEMCPY=y
|
||||
CONFIG_ARCH_MEMCMP=y
|
||||
CONFIG_ARCH_MEMMOVE=y
|
||||
CONFIG_ARCH_MEMSET=y
|
||||
CONFIG_ARCH_STRCMP=y
|
||||
CONFIG_ARCH_STRCPY=y
|
||||
CONFIG_ARCH_STRNCPY=y
|
||||
CONFIG_ARCH_STRLEN=y
|
||||
CONFIG_ARCH_STRNLEN=y
|
||||
CONFIG_ARCH_STRCHR=y
|
||||
CONFIG_ARCH_BZERO=n
|
||||
CONFIG_ARCH_MATH_H=y
|
||||
CONFIG_ARCH_STDINT_H=y
|
||||
CONFIG_ARCH_STDBOOL_H=y
|
||||
|
||||
#
|
||||
# General build options
|
||||
#
|
||||
# CONFIG_RRLOAD_BINARY - make the rrload binary format used with
|
||||
# BSPs from www.ridgerun.com using the tools/mkimage.sh script
|
||||
# CONFIG_INTELHEX_BINARY - make the Intel HEX binary format
|
||||
# used with many different loaders using the GNU objcopy program
|
||||
# Should not be selected if you are not using the GNU toolchain.
|
||||
# CONFIG_RAW_BINARY - make a raw binary format file used with many
|
||||
# different loaders using the GNU objcopy program. This option
|
||||
# should not be selected if you are not using the GNU toolchain.
|
||||
# CONFIG_HAVE_LIBM - toolchain supports libm.a
|
||||
#
|
||||
CONFIG_RRLOAD_BINARY=n
|
||||
CONFIG_INTELHEX_BINARY=n
|
||||
CONFIG_RAW_BINARY=n
|
||||
CONFIG_HAVE_LIBM=n
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
|
||||
#
|
||||
# Sizes of configurable things (0 disables)
|
||||
#
|
||||
# CONFIG_MAX_TASKS - The maximum number of simultaneously
|
||||
# active tasks. This value must be a power of two.
|
||||
# CONFIG_MAX_TASK_ARGS - This controls the maximum number of
|
||||
# of parameters that a task may receive (i.e., maxmum value
|
||||
# of 'argc')
|
||||
# CONFIG_NPTHREAD_KEYS - The number of items of thread-
|
||||
# specific data that can be retained
|
||||
# CONFIG_NFILE_DESCRIPTORS - The maximum number of file
|
||||
# descriptors (one for each open)
|
||||
# CONFIG_NFILE_STREAMS - The maximum number of streams that
|
||||
# can be fopen'ed
|
||||
# CONFIG_NAME_MAX - The maximum size of a file name.
|
||||
# CONFIG_STDIO_BUFFER_SIZE - Size of the buffer to allocate
|
||||
# on fopen. (Only if CONFIG_NFILE_STREAMS > 0)
|
||||
# CONFIG_NUNGET_CHARS - Number of characters that can be
|
||||
# buffered by ungetc() (Only if CONFIG_NFILE_STREAMS > 0)
|
||||
# CONFIG_PREALLOC_MQ_MSGS - The number of pre-allocated message
|
||||
# structures. The system manages a pool of preallocated
|
||||
# message structures to minimize dynamic allocations
|
||||
# CONFIG_MQ_MAXMSGSIZE - Message structures are allocated with
|
||||
# a fixed payload size given by this settin (does not include
|
||||
# other message structure overhead.
|
||||
# CONFIG_MAX_WDOGPARMS - Maximum number of parameters that
|
||||
# can be passed to a watchdog handler
|
||||
# CONFIG_PREALLOC_WDOGS - The number of pre-allocated watchdog
|
||||
# structures. The system manages a pool of preallocated
|
||||
# watchdog structures to minimize dynamic allocations
|
||||
# CONFIG_PREALLOC_TIMERS - The number of pre-allocated POSIX
|
||||
# timer structures. The system manages a pool of preallocated
|
||||
# timer structures to minimize dynamic allocations. Set to
|
||||
# zero for all dynamic allocations.
|
||||
#
|
||||
CONFIG_MAX_TASKS=64
|
||||
CONFIG_MAX_TASK_ARGS=10
|
||||
CONFIG_NPTHREAD_KEYS=4
|
||||
CONFIG_NFILE_DESCRIPTORS=32
|
||||
CONFIG_NFILE_STREAMS=16
|
||||
CONFIG_NAME_MAX=32
|
||||
CONFIG_STDIO_BUFFER_SIZE=64
|
||||
CONFIG_NUNGET_CHARS=2
|
||||
CONFIG_PREALLOC_MQ_MSGS=32
|
||||
CONFIG_MQ_MAXMSGSIZE=32
|
||||
CONFIG_MAX_WDOGPARMS=4
|
||||
CONFIG_PREALLOC_WDOGS=32
|
||||
CONFIG_PREALLOC_TIMERS=8
|
||||
CONFIG_STDIO_LINEBUFFER=y
|
||||
|
||||
#
|
||||
# FAT filesystem configuration
|
||||
# CONFIG_FS_FAT - Enable FAT filesystem support
|
||||
# CONFIG_FAT_SECTORSIZE - Max supported sector size
|
||||
# CONFIG_FS_ROMFS - Enable ROMFS filesystem support
|
||||
CONFIG_FS_FAT=n
|
||||
CONFIG_FS_ROMFS=n
|
||||
|
||||
#
|
||||
# TCP/IP and UDP support via uIP
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_SOCKOPTS - Enable or disable support for socket options
|
||||
# CONFIG_NET_BUFSIZE - uIP buffer size
|
||||
# CONFIG_NET_TCP - TCP support on or off
|
||||
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
|
||||
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
|
||||
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
|
||||
# accept() is called. The size of the backlog is selected when listen() is called.
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
# CONFIG_NET_ICMP - ICMP ping response support on or off
|
||||
# CONFIG_NET_ICMP_PING - ICMP ping request support on or off
|
||||
# CONFIG_NET_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
# CONFIG_NET_STATISTICS - uIP statistics on or off
|
||||
# CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's window
|
||||
# CONFIG_NET_ARPTAB_SIZE - The size of the ARP table
|
||||
# CONFIG_NET_BROADCAST - Broadcast support
|
||||
# CONFIG_NET_LLH_LEN - The link level header length
|
||||
# CONFIG_NET_FWCACHE_SIZE - number of packets to remember when looking for duplicates
|
||||
CONFIG_NET=y
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=5
|
||||
CONFIG_NET_SOCKOPTS=y
|
||||
CONFIG_NET_BUFSIZE=1514
|
||||
CONFIG_NET_TCP=y
|
||||
CONFIG_NET_TCP_CONNS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
CONFIG_NET_ICMP=y
|
||||
CONFIG_NET_ICMP_PING=y
|
||||
#CONFIG_NET_PINGADDRCONF=0
|
||||
CONFIG_NET_STATISTICS=y
|
||||
#CONFIG_NET_RECEIVE_WINDOW=128
|
||||
#CONFIG_NET_ARPTAB_SIZE=8
|
||||
CONFIG_NET_BROADCAST=n
|
||||
#CONFIG_NET_LLH_LEN=14
|
||||
#CONFIG_NET_FWCACHE_SIZE=2
|
||||
|
||||
#
|
||||
# UIP Network Utilities
|
||||
# CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP
|
||||
# CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries
|
||||
CONFIG_NET_DHCP_LIGHT=n
|
||||
CONFIG_NET_RESOLV_ENTRIES=4
|
||||
|
||||
#
|
||||
# Settings for examples/uip
|
||||
CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80a02
|
||||
CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80a01
|
||||
CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
|
||||
CONFIG_EXAMPLE_UIP_DHCPC=n
|
||||
|
||||
#
|
||||
# Settings for examples/nettest
|
||||
CONFIG_EXAMPLE_NETTEST_SERVER=n
|
||||
CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
|
||||
CONFIG_EXAMPLE_NETTEST_NOMAC=n
|
||||
CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
|
||||
CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
|
||||
CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
|
||||
CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
|
||||
|
||||
#
|
||||
# Settings for examples/nsh
|
||||
CONFIG_NSH_CONSOLE=y
|
||||
CONFIG_NSH_TELNET=n
|
||||
CONFIG_NSH_IOBUFFER_SIZE=512
|
||||
CONFIG_NSH_CMD_SIZE=40
|
||||
CONFIG_NSH_DHCPC=n
|
||||
CONFIG_NSH_NOMAC=n
|
||||
CONFIG_NSH_IPADDR=0x0a000002
|
||||
CONFIG_NSH_DRIPADDR=0x0a000001
|
||||
CONFIG_NSH_NETMASK=0xffffff00
|
||||
|
||||
#
|
||||
# Stack and heap information
|
||||
#
|
||||
# CONFIG_BOOT_RUNFROMFLASH - Some configurations support XIP
|
||||
# operation from FLASH but must copy initialized .data sections to RAM.
|
||||
# CONFIG_BOOT_COPYTORAM - Some configurations boot in FLASH
|
||||
# but copy themselves entirely into RAM for better performance.
|
||||
# CONFIG_CUSTOM_STACK - The up_ implementation will handle
|
||||
# all stack operations outside of the nuttx model.
|
||||
# CONFIG_STACK_POINTER - The initial stack pointer
|
||||
# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
|
||||
# This is the thread that (1) performs the inital boot of the system up
|
||||
# to the point where user_start() is spawned, and (2 after is the
|
||||
# IDLE thread that executes only when there is no other thread ready to
|
||||
# run.
|
||||
# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
|
||||
# for the main user thread that begins at the user_start() entry point.
|
||||
# CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
|
||||
# CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
|
||||
# CONFIG_HEAP_BASE - The beginning of the heap
|
||||
# CONFIG_HEAP_SIZE - The size of the heap
|
||||
#
|
||||
CONFIG_BOOT_RUNFROMFLASH=n
|
||||
CONFIG_BOOT_COPYTORAM=n
|
||||
CONFIG_CUSTOM_STACK=n
|
||||
CONFIG_IDLETHREAD_STACKSIZE=4096
|
||||
CONFIG_USERMAIN_STACKSIZE=4096
|
||||
CONFIG_PTHREAD_STACK_MIN=256
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=8192
|
||||
CONFIG_HEAP_BASE=
|
||||
CONFIG_HEAP_SIZE=
|
||||
CONFIG_USER_ENTRYPOINT="cxxtest_main"
|
||||
|
||||
#
|
||||
# uClibc++ Standard C++ Library
|
||||
#
|
||||
CONFIG_UCLIBCXX=y
|
||||
CONFIG_UCLIBCXX_EXCEPTION=y
|
||||
CONFIG_UCLIBCXX_IOSTREAM_BUFSIZE=32
|
||||
CONFIG_UCLIBCXX_HAVE_LIBSUPCXX=y
|
||||
|
||||
##########################################
|
||||
# RGMP specific configuration
|
||||
##########################################
|
||||
|
||||
#
|
||||
# arch
|
||||
#
|
||||
CONFIG_RGMP_SUBARCH=x86
|
||||
|
||||
#
|
||||
# VNET
|
||||
#
|
||||
CONFIG_NET_VNET=y
|
||||
CONFIG_VNET_NINTERFACES=1
|
||||
|
||||
#
|
||||
# Serial port
|
||||
#
|
||||
CONFIG_COM1=y
|
||||
CONFIG_COM2=y
|
||||
CONFIG_COM3=n
|
||||
CONFIG_COM4=n
|
||||
|
||||
#
|
||||
# E1000
|
||||
#
|
||||
CONFIG_NET_E1000=n
|
||||
CONFIG_E1000_N_TX_DESC=128
|
||||
CONFIG_E1000_N_RX_DESC=128
|
||||
CONFIG_E1000_BUFF_SIZE=0x800
|
||||
47
configs/rgmp/x86/cxxtest/setenv.sh
Normal file
47
configs/rgmp/x86/cxxtest/setenv.sh
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
# config/rgmp/default/setenv.sh
|
||||
#
|
||||
# Copyright (C) 2011 Yu Qiang. All rights reserved.
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Authors: Yu Qiang <yuq825@gmail.com>
|
||||
# Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
if [ "$(basename $0)" = "setenv.sh" ] ; then
|
||||
echo "You must source this script, not run it!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
|
||||
|
||||
#export NUTTX_BIN=
|
||||
#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
|
||||
|
||||
echo "PATH : ${PATH}"
|
||||
|
|
@ -53,7 +53,7 @@ endif
|
|||
ARCHCPUFLAGS = -fno-builtin -nostdinc -fno-stack-protector
|
||||
ARCHPICFLAGS = -fpic
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
|
||||
ARCHDEFINES =
|
||||
ARCHDEFINES = -D__RGMP_KERNEL__ -D__RTOS_KERNEL__ -D__SHARE_KERNEL__
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include -I$(RGMPINCDIR) \
|
||||
-I$(TOPDIR)/configs/rgmp/include -I$(TOPDIR)/arch/rgmp/include/x86
|
||||
ARCHSCRIPT =
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ CONFIG_ARCH_BOARD_RGMP=y
|
|||
CONFIG_USER_ENTRYPOINT="rgmp_main"
|
||||
CONFIG_DEBUG=n
|
||||
CONFIG_DEBUG_VERBOSE=n
|
||||
CONFIG_DEBUG_SYMBOLS=n
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_MM_REGIONS=1
|
||||
CONFIG_ARCH_LOWPUTC=y
|
||||
CONFIG_MSEC_PER_TICK=1
|
||||
|
|
@ -96,6 +96,7 @@ CONFIG_DISABLE_POLL=y
|
|||
#
|
||||
# Misc libc settings
|
||||
#
|
||||
CONFIG_LIBC_FLOATINGPOINT=y
|
||||
CONFIG_NOPRINTF_FIELDWIDTH=n
|
||||
|
||||
#
|
||||
|
|
@ -113,6 +114,7 @@ CONFIG_ARCH_STRCPY=y
|
|||
CONFIG_ARCH_STRNCPY=y
|
||||
CONFIG_ARCH_STRLEN=y
|
||||
CONFIG_ARCH_STRNLEN=y
|
||||
CONFIG_ARCH_STRCHR=y
|
||||
CONFIG_ARCH_BZERO=n
|
||||
CONFIG_ARCH_MATH_H=y
|
||||
CONFIG_ARCH_STDINT_H=y
|
||||
|
|
@ -124,6 +126,7 @@ CONFIG_ARCH_STDBOOL_H=y
|
|||
CONFIG_RRLOAD_BINARY=n
|
||||
CONFIG_INTELHEX_BINARY=n
|
||||
CONFIG_RAW_BINARY=n
|
||||
CONFIG_HAVE_LIBM=n
|
||||
|
||||
#
|
||||
# Sizes of configurable things (0 disables)
|
||||
|
|
|
|||
132
configs/rgmp/x86/helloxx/Make.defs
Normal file
132
configs/rgmp/x86/helloxx/Make.defs
Normal file
|
|
@ -0,0 +1,132 @@
|
|||
####################################################################################
|
||||
# configs/rgmp/default/Make.defs
|
||||
#
|
||||
# Copyright (C) 2011 Yu Qiang. All rights reserved.
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Authors: Yu Qiang <yuq825@gmail.com>
|
||||
# Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include ${TOPDIR}/.config
|
||||
|
||||
RGMPLIBDIR := $(RGMP_INST_DIR)/lib
|
||||
RGMPINCDIR := $(RGMP_INST_DIR)/include
|
||||
RGMPLKSCPT := $(RGMP_INST_DIR)/etc/rgmp.ld
|
||||
|
||||
HOSTOS = ${shell uname -o}
|
||||
|
||||
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||
ARCHOPTIMIZATION = -O2 -gstabs
|
||||
else
|
||||
ARCHOPTIMIZATION = -O2
|
||||
endif
|
||||
|
||||
ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti
|
||||
ARCHCPUFLAGS = -fno-builtin -nostdinc -fno-stack-protector
|
||||
ARCHPICFLAGS = -fpic
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
|
||||
ARCHWARNINGSXX = -Wall -Wshadow
|
||||
ARCHDEFINES = -D__RGMP_KERNEL__ -D__RTOS_KERNEL__ -D__SHARE_KERNEL__
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include -I$(RGMPINCDIR) \
|
||||
-I$(TOPDIR)/configs/rgmp/include -I$(TOPDIR)/arch/rgmp/include/x86
|
||||
|
||||
ARCHXXINCLUDES = -I$(TOPDIR)/include/cxx -isystem $(TOPDIR)/include -I$(RGMPINCDIR) \
|
||||
-I$(TOPDIR)/configs/rgmp/include -I$(TOPDIR)/arch/rgmp/include/x86 \
|
||||
-I$(TOPDIR)/include/uClibc++
|
||||
|
||||
CROSSDEV =
|
||||
CC = $(CROSSDEV)gcc
|
||||
CXX = $(CROSSDEV)g++
|
||||
CPP = $(CROSSDEV)gcc -E
|
||||
LD = $(CROSSDEV)ld
|
||||
AR = $(CROSSDEV)ar rcs
|
||||
NM = $(CROSSDEV)nm
|
||||
OBJCOPY = $(CROSSDEV)objcopy
|
||||
OBJDUMP = $(CROSSDEV)objdump
|
||||
|
||||
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) -pipe
|
||||
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES)
|
||||
CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) \
|
||||
$(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe -nodefaultlibs \
|
||||
-nostdinc++
|
||||
CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS)
|
||||
AFLAGS = $(CFLAGS) -D__ASSEMBLY__
|
||||
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
|
||||
ifeq ($(HOSTOS),Cygwin)
|
||||
EXEEXT = .exe
|
||||
else
|
||||
EXEEXT =
|
||||
endif
|
||||
|
||||
LDFLAGS += -nostdlib
|
||||
EXTRA_LIBS = $(shell $(CC) -print-file-name=libsupc++.a) \
|
||||
$(shell $(CC) -print-file-name=libgcc_eh.a)
|
||||
|
||||
define PREPROCESS
|
||||
@echo "CPP: $1->$2"
|
||||
@$(CPP) $(CPPFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define COMPILE
|
||||
@echo "CC: $1"
|
||||
@$(CC) -c $(CFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define COMPILEXX
|
||||
@echo "CXX: $1"
|
||||
@$(CXX) -c $(CXXFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define ASSEMBLE
|
||||
@echo "AS: $1"
|
||||
@$(CC) -c $(AFLAGS) $1 -o $2
|
||||
endef
|
||||
|
||||
define ARCHIVE
|
||||
echo "AR: $2"; \
|
||||
$(AR) $1 $2 || { echo "$(AR) $1 $2 FAILED!" ; exit 1 ; }
|
||||
endef
|
||||
|
||||
define CLEAN
|
||||
@rm -f *.o *.a
|
||||
endef
|
||||
|
||||
MKDEP = $(TOPDIR)/tools/mkdeps.sh
|
||||
|
||||
HOSTCC = gcc
|
||||
HOSTINCLUDES = -I.
|
||||
HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
||||
$(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) -pipe
|
||||
HOSTLDFLAGS =
|
||||
51
configs/rgmp/x86/helloxx/appconfig
Normal file
51
configs/rgmp/x86/helloxx/appconfig
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
############################################################################
|
||||
# configs/sim/default/appconfig
|
||||
#
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# CONFIG_NFILE_DESCRIPTORS - The maximum number of file
|
||||
# descriptors (one for each open)
|
||||
# CONFIG_NFILE_STREAMS - The maximum number of streams that
|
||||
# can be fopen'ed
|
||||
# CONFIG_NAME_MAX - The maximum size of a file name.
|
||||
# CONFIG_STDIO_BUFFER_SIZE - Size of the buffer to allocate
|
||||
# on fopen. (Only if CONFIG_NFILE_STREAMS > 0)
|
||||
# CONFIG_NUNGET_CHARS - Number of characters that can be
|
||||
# buffered by ungetc() (Only if CONFIG_NFILE_STREAMS > 0)
|
||||
# CONFIG_PREALLOC_MQ_MSGS - The number of pre-allocated message
|
||||
# structures. The system manages a pool of preallocated
|
||||
# message structures to minimize dyAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
# Path to example in apps/examples containing the user_start entry point
|
||||
|
||||
CONFIGURED_APPS += examples/helloxx
|
||||
|
||||
428
configs/rgmp/x86/helloxx/defconfig
Normal file
428
configs/rgmp/x86/helloxx/defconfig
Normal file
|
|
@ -0,0 +1,428 @@
|
|||
############################################################################
|
||||
# configs/rgmp/default/defconfig
|
||||
#
|
||||
# Copyright (C) 2011 Yu Qiang. All rights reserved.
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Authors: Yu Qiang <yuq825@gmail.com>
|
||||
# Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
#
|
||||
# Architecture selection
|
||||
#
|
||||
# CONFIG_ARCH - identifies the arch subdirectory and, hence, the
|
||||
# processor architecture.
|
||||
# CONFIG_ARCH_name - for use in C code. This identifies the particular
|
||||
# processor architecture (CONFIG_ARCH_SIM).
|
||||
# CONFIG_ARCH_BOARD - identifies the configs subdirectory and, hence,
|
||||
# the board that supports the particular chip or SoC.
|
||||
# CONFIG_ARCH_BOARD_name - for use in C code
|
||||
# CONFIG_ENDIAN_BIG - define if big endian (default is little endian)
|
||||
#
|
||||
CONFIG_ARCH="rgmp"
|
||||
CONFIG_ARCH_RGMP=y
|
||||
CONFIG_ARCH_BOARD="rgmp"
|
||||
CONFIG_ARCH_BOARD_RGMP=y
|
||||
|
||||
#
|
||||
# General OS setup
|
||||
#
|
||||
# CONFIG_APPS_DIR - Identifies the relative path to the directory
|
||||
# that builds the application to link with NuttX. Default: ../apps
|
||||
# CONFIG_DEBUG - enables built-in debug options
|
||||
# CONFIG_DEBUG_VERBOSE - enables verbose debug output
|
||||
# CONFIG_DEBUG_SYMBOLS - build without optimization and with
|
||||
# debug symbols (needed for use with a debugger).
|
||||
# CONFIG_MM_REGIONS - If the architecture includes multiple
|
||||
# regions of memory to allocate from, this specifies the
|
||||
# number of memory regions that the memory manager must
|
||||
# handle and enables the API mm_addregion(start, end);
|
||||
# CONFIG_ARCH_LOWPUTC - architecture supports low-level, boot
|
||||
# time console output
|
||||
# CONFIG_MSEC_PER_TICK - The default system timer is 100Hz
|
||||
# or MSEC_PER_TICK=10. This setting may be defined to
|
||||
# inform NuttX that the processor hardware is providing
|
||||
# system timer interrupts at some interrupt interval other
|
||||
# than 10 msec.
|
||||
# CONFIG_RR_INTERVAL - The round robin timeslice will be set
|
||||
# this number of milliseconds; Round robin scheduling can
|
||||
# be disabled by setting this value to zero.
|
||||
# CONFIG_SCHED_INSTRUMENTATION - enables instrumentation in
|
||||
# scheduler to monitor system performance
|
||||
# CONFIG_TASK_NAME_SIZE - Spcifies that maximum size of a
|
||||
# task name to save in the TCB. Useful if scheduler
|
||||
# instrumentation is selected. Set to zero to disable.
|
||||
# CONFIG_JULIAN_TIME - Enables Julian time conversions
|
||||
# CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY -
|
||||
# Used to initialize the internal time logic.
|
||||
# CONFIG_DEV_CONSOLE - Set if architecture-specific logic
|
||||
# provides /dev/console. Enables stdout, stderr, stdin.
|
||||
# CONFIG_DEV_LOWCONSOLE - Use the simple, low-level serial console
|
||||
# driver (minimul support)
|
||||
# CONFIG_MUTEX_TYPES: Set to enable support for recursive and
|
||||
# errorcheck mutexes. Enables pthread_mutexattr_settype().
|
||||
# CONFIG_PRIORITY_INHERITANCE : Set to enable support for priority
|
||||
# inheritance on mutexes and semaphores.
|
||||
# CONFIG_SEM_PREALLOCHOLDERS: This setting is only used if priority
|
||||
# inheritance is enabled. It defines the maximum number of
|
||||
# different threads (minus one) that can take counts on a
|
||||
# semaphore with priority inheritance support. This may be
|
||||
# set to zero if priority inheritance is disabled OR if you
|
||||
# are only using semaphores as mutexes (only one holder) OR
|
||||
# if no more than two threads participate using a counting
|
||||
# semaphore.
|
||||
# CONFIG_SEM_NNESTPRIO. If priority inheritance is enabled,
|
||||
# then this setting is the maximum number of higher priority
|
||||
# threads (minus 1) than can be waiting for another thread
|
||||
# to release a count on a semaphore. This value may be set
|
||||
# to zero if no more than one thread is expected to wait for
|
||||
# a semaphore.
|
||||
# CONFIG_FDCLONE_DISABLE. Disable cloning of all file descriptors
|
||||
# by task_create() when a new task is started. If set, all
|
||||
# files/drivers will appear to be closed in the new task.
|
||||
# CONFIG_FDCLONE_STDIO. Disable cloning of all but the first
|
||||
# three file descriptors (stdin, stdout, stderr) by task_create()
|
||||
# when a new task is started. If set, all files/drivers will
|
||||
# appear to be closed in the new task except for stdin, stdout,
|
||||
# and stderr.
|
||||
# CONFIG_SDCLONE_DISABLE. Disable cloning of all socket
|
||||
# desciptors by task_create() when a new task is started. If
|
||||
# set, all sockets will appear to be closed in the new task.
|
||||
#
|
||||
#CONFIG_APPS_DIR=
|
||||
CONFIG_DEBUG=y
|
||||
CONFIG_DEBUG_VERBOSE=y
|
||||
CONFIG_DEBUG_SYMBOLS=y
|
||||
CONFIG_MM_REGIONS=1
|
||||
CONFIG_ARCH_LOWPUTC=y
|
||||
CONFIG_MSEC_PER_TICK=1
|
||||
CONFIG_RR_INTERVAL=0
|
||||
CONFIG_SCHED_INSTRUMENTATION=n
|
||||
CONFIG_TASK_NAME_SIZE=32
|
||||
CONFIG_START_YEAR=2007
|
||||
CONFIG_START_MONTH=2
|
||||
CONFIG_START_DAY=27
|
||||
CONFIG_JULIAN_TIME=n
|
||||
CONFIG_DEV_CONSOLE=y
|
||||
CONFIG_DEV_LOWCONSOLE=n
|
||||
CONFIG_MUTEX_TYPES=n
|
||||
CONFIG_PRIORITY_INHERITANCE=n
|
||||
CONFIG_SEM_PREALLOCHOLDERS=0
|
||||
CONFIG_SEM_NNESTPRIO=0
|
||||
CONFIG_FDCLONE_DISABLE=n
|
||||
CONFIG_FDCLONE_STDIO=n
|
||||
CONFIG_SDCLONE_DISABLE=y
|
||||
|
||||
#
|
||||
# The following can be used to disable categories of
|
||||
# APIs supported by the OS. If the compiler supports
|
||||
# weak functions, then it should not be necessary to
|
||||
# disable functions unless you want to restrict usage
|
||||
# of those APIs.
|
||||
#
|
||||
# There are certain dependency relationships in these
|
||||
# features.
|
||||
#
|
||||
# o mq_notify logic depends on signals to awaken tasks
|
||||
# waiting for queues to become full or empty.
|
||||
# o pthread_condtimedwait() depends on signals to wake
|
||||
# up waiting tasks.
|
||||
#
|
||||
CONFIG_DISABLE_CLOCK=n
|
||||
CONFIG_DISABLE_POSIX_TIMERS=n
|
||||
CONFIG_DISABLE_PTHREAD=n
|
||||
CONFIG_DISABLE_SIGNALS=n
|
||||
CONFIG_DISABLE_MQUEUE=n
|
||||
CONFIG_DISABLE_MOUNTPOINT=n
|
||||
CONFIG_DISABLE_ENVIRON=n
|
||||
CONFIG_DISABLE_POLL=y
|
||||
|
||||
#
|
||||
# Misc libc settings
|
||||
#
|
||||
# CONFIG_NOPRINTF_FIELDWIDTH - sprintf-related logic is a
|
||||
# little smaller if we do not support fieldwidthes
|
||||
#
|
||||
CONFIG_LIBC_FLOATINGPOINT=y
|
||||
CONFIG_NOPRINTF_FIELDWIDTH=n
|
||||
|
||||
#
|
||||
# Allow for architecture optimized implementations
|
||||
#
|
||||
# The architecture can provide optimized versions of the
|
||||
# following to improve sysem performance
|
||||
#
|
||||
CONFIG_ARCH_MEMCPY=y
|
||||
CONFIG_ARCH_MEMCMP=y
|
||||
CONFIG_ARCH_MEMMOVE=y
|
||||
CONFIG_ARCH_MEMSET=y
|
||||
CONFIG_ARCH_STRCMP=y
|
||||
CONFIG_ARCH_STRCPY=y
|
||||
CONFIG_ARCH_STRNCPY=y
|
||||
CONFIG_ARCH_STRLEN=y
|
||||
CONFIG_ARCH_STRNLEN=y
|
||||
CONFIG_ARCH_STRCHR=y
|
||||
CONFIG_ARCH_BZERO=n
|
||||
CONFIG_ARCH_MATH_H=y
|
||||
CONFIG_ARCH_STDINT_H=y
|
||||
CONFIG_ARCH_STDBOOL_H=y
|
||||
|
||||
#
|
||||
# General build options
|
||||
#
|
||||
# CONFIG_RRLOAD_BINARY - make the rrload binary format used with
|
||||
# BSPs from www.ridgerun.com using the tools/mkimage.sh script
|
||||
# CONFIG_INTELHEX_BINARY - make the Intel HEX binary format
|
||||
# used with many different loaders using the GNU objcopy program
|
||||
# Should not be selected if you are not using the GNU toolchain.
|
||||
# CONFIG_RAW_BINARY - make a raw binary format file used with many
|
||||
# different loaders using the GNU objcopy program. This option
|
||||
# should not be selected if you are not using the GNU toolchain.
|
||||
# CONFIG_HAVE_LIBM - toolchain supports libm.a
|
||||
#
|
||||
CONFIG_RRLOAD_BINARY=n
|
||||
CONFIG_INTELHEX_BINARY=n
|
||||
CONFIG_RAW_BINARY=n
|
||||
CONFIG_HAVE_LIBM=n
|
||||
CONFIG_HAVE_CXX=y
|
||||
CONFIG_HAVE_CXXINITIALIZE=y
|
||||
|
||||
#
|
||||
# Sizes of configurable things (0 disables)
|
||||
#
|
||||
# CONFIG_MAX_TASKS - The maximum number of simultaneously
|
||||
# active tasks. This value must be a power of two.
|
||||
# CONFIG_MAX_TASK_ARGS - This controls the maximum number of
|
||||
# of parameters that a task may receive (i.e., maxmum value
|
||||
# of 'argc')
|
||||
# CONFIG_NPTHREAD_KEYS - The number of items of thread-
|
||||
# specific data that can be retained
|
||||
# CONFIG_NFILE_DESCRIPTORS - The maximum number of file
|
||||
# descriptors (one for each open)
|
||||
# CONFIG_NFILE_STREAMS - The maximum number of streams that
|
||||
# can be fopen'ed
|
||||
# CONFIG_NAME_MAX - The maximum size of a file name.
|
||||
# CONFIG_STDIO_BUFFER_SIZE - Size of the buffer to allocate
|
||||
# on fopen. (Only if CONFIG_NFILE_STREAMS > 0)
|
||||
# CONFIG_NUNGET_CHARS - Number of characters that can be
|
||||
# buffered by ungetc() (Only if CONFIG_NFILE_STREAMS > 0)
|
||||
# CONFIG_PREALLOC_MQ_MSGS - The number of pre-allocated message
|
||||
# structures. The system manages a pool of preallocated
|
||||
# message structures to minimize dynamic allocations
|
||||
# CONFIG_MQ_MAXMSGSIZE - Message structures are allocated with
|
||||
# a fixed payload size given by this settin (does not include
|
||||
# other message structure overhead.
|
||||
# CONFIG_MAX_WDOGPARMS - Maximum number of parameters that
|
||||
# can be passed to a watchdog handler
|
||||
# CONFIG_PREALLOC_WDOGS - The number of pre-allocated watchdog
|
||||
# structures. The system manages a pool of preallocated
|
||||
# watchdog structures to minimize dynamic allocations
|
||||
# CONFIG_PREALLOC_TIMERS - The number of pre-allocated POSIX
|
||||
# timer structures. The system manages a pool of preallocated
|
||||
# timer structures to minimize dynamic allocations. Set to
|
||||
# zero for all dynamic allocations.
|
||||
#
|
||||
CONFIG_MAX_TASKS=64
|
||||
CONFIG_MAX_TASK_ARGS=10
|
||||
CONFIG_NPTHREAD_KEYS=4
|
||||
CONFIG_NFILE_DESCRIPTORS=32
|
||||
CONFIG_NFILE_STREAMS=16
|
||||
CONFIG_NAME_MAX=32
|
||||
CONFIG_STDIO_BUFFER_SIZE=64
|
||||
CONFIG_NUNGET_CHARS=2
|
||||
CONFIG_PREALLOC_MQ_MSGS=32
|
||||
CONFIG_MQ_MAXMSGSIZE=32
|
||||
CONFIG_MAX_WDOGPARMS=4
|
||||
CONFIG_PREALLOC_WDOGS=32
|
||||
CONFIG_PREALLOC_TIMERS=8
|
||||
CONFIG_STDIO_LINEBUFFER=y
|
||||
|
||||
#
|
||||
# FAT filesystem configuration
|
||||
# CONFIG_FS_FAT - Enable FAT filesystem support
|
||||
# CONFIG_FAT_SECTORSIZE - Max supported sector size
|
||||
# CONFIG_FS_ROMFS - Enable ROMFS filesystem support
|
||||
CONFIG_FS_FAT=n
|
||||
CONFIG_FS_ROMFS=n
|
||||
|
||||
#
|
||||
# TCP/IP and UDP support via uIP
|
||||
# CONFIG_NET - Enable or disable all network features
|
||||
# CONFIG_NET_IPv6 - Build in support for IPv6
|
||||
# CONFIG_NSOCKET_DESCRIPTORS - Maximum number of socket descriptors per task/thread.
|
||||
# CONFIG_NET_SOCKOPTS - Enable or disable support for socket options
|
||||
# CONFIG_NET_BUFSIZE - uIP buffer size
|
||||
# CONFIG_NET_TCP - TCP support on or off
|
||||
# CONFIG_NET_TCP_CONNS - Maximum number of TCP connections (all tasks)
|
||||
# CONFIG_NET_TCP_READAHEAD_BUFSIZE - Size of TCP read-ahead buffers
|
||||
# CONFIG_NET_NTCP_READAHEAD_BUFFERS - Number of TCP read-ahead buffers (may be zero)
|
||||
# CONFIG_NET_TCPBACKLOG - Incoming connections pend in a backlog until
|
||||
# accept() is called. The size of the backlog is selected when listen() is called.
|
||||
# CONFIG_NET_MAX_LISTENPORTS - Maximum number of listening TCP ports (all tasks)
|
||||
# CONFIG_NET_UDP - UDP support on or off
|
||||
# CONFIG_NET_UDP_CHECKSUMS - UDP checksums on or off
|
||||
# CONFIG_NET_UDP_CONNS - The maximum amount of concurrent UDP connections
|
||||
# CONFIG_NET_ICMP - ICMP ping response support on or off
|
||||
# CONFIG_NET_ICMP_PING - ICMP ping request support on or off
|
||||
# CONFIG_NET_PINGADDRCONF - Use "ping" packet for setting IP address
|
||||
# CONFIG_NET_STATISTICS - uIP statistics on or off
|
||||
# CONFIG_NET_RECEIVE_WINDOW - The size of the advertised receiver's window
|
||||
# CONFIG_NET_ARPTAB_SIZE - The size of the ARP table
|
||||
# CONFIG_NET_BROADCAST - Broadcast support
|
||||
# CONFIG_NET_LLH_LEN - The link level header length
|
||||
# CONFIG_NET_FWCACHE_SIZE - number of packets to remember when looking for duplicates
|
||||
CONFIG_NET=y
|
||||
CONFIG_NET_IPv6=n
|
||||
CONFIG_NSOCKET_DESCRIPTORS=5
|
||||
CONFIG_NET_SOCKOPTS=y
|
||||
CONFIG_NET_BUFSIZE=1514
|
||||
CONFIG_NET_TCP=y
|
||||
CONFIG_NET_TCP_CONNS=40
|
||||
CONFIG_NET_MAX_LISTENPORTS=40
|
||||
CONFIG_NET_UDP=y
|
||||
CONFIG_NET_UDP_CHECKSUMS=y
|
||||
#CONFIG_NET_UDP_CONNS=10
|
||||
CONFIG_NET_ICMP=y
|
||||
CONFIG_NET_ICMP_PING=y
|
||||
#CONFIG_NET_PINGADDRCONF=0
|
||||
CONFIG_NET_STATISTICS=y
|
||||
#CONFIG_NET_RECEIVE_WINDOW=128
|
||||
#CONFIG_NET_ARPTAB_SIZE=8
|
||||
CONFIG_NET_BROADCAST=n
|
||||
#CONFIG_NET_LLH_LEN=14
|
||||
#CONFIG_NET_FWCACHE_SIZE=2
|
||||
|
||||
#
|
||||
# UIP Network Utilities
|
||||
# CONFIG_NET_DHCP_LIGHT - Reduces size of DHCP
|
||||
# CONFIG_NET_RESOLV_ENTRIES - Number of resolver entries
|
||||
CONFIG_NET_DHCP_LIGHT=n
|
||||
CONFIG_NET_RESOLV_ENTRIES=4
|
||||
|
||||
#
|
||||
# Settings for examples/uip
|
||||
CONFIG_EXAMPLE_UIP_IPADDR=0xc0a80a02
|
||||
CONFIG_EXAMPLE_UIP_DRIPADDR=0xc0a80a01
|
||||
CONFIG_EXAMPLE_UIP_NETMASK=0xffffff00
|
||||
CONFIG_EXAMPLE_UIP_DHCPC=n
|
||||
|
||||
#
|
||||
# Settings for examples/nettest
|
||||
CONFIG_EXAMPLE_NETTEST_SERVER=n
|
||||
CONFIG_EXAMPLE_NETTEST_PERFORMANCE=n
|
||||
CONFIG_EXAMPLE_NETTEST_NOMAC=n
|
||||
CONFIG_EXAMPLE_NETTEST_IPADDR=0xc0a80080
|
||||
CONFIG_EXAMPLE_NETTEST_DRIPADDR=0xc0a80001
|
||||
CONFIG_EXAMPLE_NETTEST_NETMASK=0xffffff00
|
||||
CONFIG_EXAMPLE_NETTEST_CLIENTIP=0xc0a8006a
|
||||
|
||||
#
|
||||
# Settings for examples/nsh
|
||||
CONFIG_NSH_CONSOLE=y
|
||||
CONFIG_NSH_TELNET=n
|
||||
CONFIG_NSH_IOBUFFER_SIZE=512
|
||||
CONFIG_NSH_CMD_SIZE=40
|
||||
CONFIG_NSH_DHCPC=n
|
||||
CONFIG_NSH_NOMAC=n
|
||||
CONFIG_NSH_IPADDR=0x0a000002
|
||||
CONFIG_NSH_DRIPADDR=0x0a000001
|
||||
CONFIG_NSH_NETMASK=0xffffff00
|
||||
|
||||
#
|
||||
# Stack and heap information
|
||||
#
|
||||
# CONFIG_BOOT_RUNFROMFLASH - Some configurations support XIP
|
||||
# operation from FLASH but must copy initialized .data sections to RAM.
|
||||
# CONFIG_BOOT_COPYTORAM - Some configurations boot in FLASH
|
||||
# but copy themselves entirely into RAM for better performance.
|
||||
# CONFIG_CUSTOM_STACK - The up_ implementation will handle
|
||||
# all stack operations outside of the nuttx model.
|
||||
# CONFIG_STACK_POINTER - The initial stack pointer
|
||||
# CONFIG_IDLETHREAD_STACKSIZE - The size of the initial stack.
|
||||
# This is the thread that (1) performs the inital boot of the system up
|
||||
# to the point where user_start() is spawned, and (2 after is the
|
||||
# IDLE thread that executes only when there is no other thread ready to
|
||||
# run.
|
||||
# CONFIG_USERMAIN_STACKSIZE - The size of the stack to allocate
|
||||
# for the main user thread that begins at the user_start() entry point.
|
||||
# CONFIG_PTHREAD_STACK_MIN - Minimum pthread stack size
|
||||
# CONFIG_PTHREAD_STACK_DEFAULT - Default pthread stack size
|
||||
# CONFIG_HEAP_BASE - The beginning of the heap
|
||||
# CONFIG_HEAP_SIZE - The size of the heap
|
||||
#
|
||||
CONFIG_BOOT_RUNFROMFLASH=n
|
||||
CONFIG_BOOT_COPYTORAM=n
|
||||
CONFIG_CUSTOM_STACK=n
|
||||
CONFIG_IDLETHREAD_STACKSIZE=4096
|
||||
CONFIG_USERMAIN_STACKSIZE=4096
|
||||
CONFIG_PTHREAD_STACK_MIN=256
|
||||
CONFIG_PTHREAD_STACK_DEFAULT=8192
|
||||
CONFIG_HEAP_BASE=
|
||||
CONFIG_HEAP_SIZE=
|
||||
CONFIG_USER_ENTRYPOINT="helloxx_main"
|
||||
|
||||
#
|
||||
# uClibc++ Standard C++ Library
|
||||
#
|
||||
#CONFIG_UCLIBCXX=y
|
||||
#CONFIG_UCLIBCXX_EXCEPTION=y
|
||||
#CONFIG_UCLIBCXX_IOSTREAM_BUFSIZE=32
|
||||
#CONFIG_UCLIBCXX_HAVE_LIBSUPCXX=y
|
||||
|
||||
##########################################
|
||||
# RGMP specific configuration
|
||||
##########################################
|
||||
|
||||
#
|
||||
# arch
|
||||
#
|
||||
CONFIG_RGMP_SUBARCH=x86
|
||||
|
||||
#
|
||||
# VNET
|
||||
#
|
||||
CONFIG_NET_VNET=y
|
||||
CONFIG_VNET_NINTERFACES=1
|
||||
|
||||
#
|
||||
# Serial port
|
||||
#
|
||||
CONFIG_COM1=y
|
||||
CONFIG_COM2=y
|
||||
CONFIG_COM3=n
|
||||
CONFIG_COM4=n
|
||||
|
||||
#
|
||||
# E1000
|
||||
#
|
||||
CONFIG_NET_E1000=n
|
||||
CONFIG_E1000_N_TX_DESC=128
|
||||
CONFIG_E1000_N_RX_DESC=128
|
||||
CONFIG_E1000_BUFF_SIZE=0x800
|
||||
47
configs/rgmp/x86/helloxx/setenv.sh
Normal file
47
configs/rgmp/x86/helloxx/setenv.sh
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash
|
||||
# config/rgmp/default/setenv.sh
|
||||
#
|
||||
# Copyright (C) 2011 Yu Qiang. All rights reserved.
|
||||
# Copyright (C) 2011 Gregory Nutt. All rights reserved.
|
||||
# Authors: Yu Qiang <yuq825@gmail.com>
|
||||
# Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name NuttX nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
if [ "$(basename $0)" = "setenv.sh" ] ; then
|
||||
echo "You must source this script, not run it!" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi
|
||||
|
||||
#export NUTTX_BIN=
|
||||
#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG}
|
||||
|
||||
echo "PATH : ${PATH}"
|
||||
|
|
@ -53,7 +53,7 @@ endif
|
|||
ARCHCPUFLAGS = -fno-builtin -nostdinc -fno-stack-protector
|
||||
ARCHPICFLAGS = -fpic
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
|
||||
ARCHDEFINES =
|
||||
ARCHDEFINES = -D__RGMP_KERNEL__ -D__RTOS_KERNEL__ -D__SHARE_KERNEL__
|
||||
ARCHINCLUDES = -I. -isystem $(TOPDIR)/include -I$(RGMPINCDIR) \
|
||||
-I$(TOPDIR)/configs/rgmp/include -I$(TOPDIR)/arch/rgmp/include/x86
|
||||
ARCHSCRIPT =
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ CONFIGURED_APPS += netutils/uiplib
|
|||
CONFIGURED_APPS += netutils/dhcpc
|
||||
CONFIGURED_APPS += netutils/resolv
|
||||
CONFIGURED_APPS += netutils/tftpc
|
||||
CONFIGURED_APPS += netutils/codecs
|
||||
CONFIGURED_APPS += netutils/webclient
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ CONFIG_DISABLE_POLL=y
|
|||
#
|
||||
# Misc libc settings
|
||||
#
|
||||
CONFIG_LIBC_FLOATINGPOINT=y
|
||||
CONFIG_NOPRINTF_FIELDWIDTH=n
|
||||
|
||||
#
|
||||
|
|
@ -113,6 +114,7 @@ CONFIG_ARCH_STRCPY=y
|
|||
CONFIG_ARCH_STRNCPY=y
|
||||
CONFIG_ARCH_STRLEN=y
|
||||
CONFIG_ARCH_STRNLEN=y
|
||||
CONFIG_ARCH_STRCHR=y
|
||||
CONFIG_ARCH_BZERO=n
|
||||
CONFIG_ARCH_MATH_H=y
|
||||
CONFIG_ARCH_STDINT_H=y
|
||||
|
|
@ -124,6 +126,7 @@ CONFIG_ARCH_STDBOOL_H=y
|
|||
CONFIG_RRLOAD_BINARY=n
|
||||
CONFIG_INTELHEX_BINARY=n
|
||||
CONFIG_RAW_BINARY=n
|
||||
CONFIG_HAVE_LIBM=n
|
||||
|
||||
#
|
||||
# Sizes of configurable things (0 disables)
|
||||
|
|
@ -208,6 +211,12 @@ CONFIG_NSH_IPADDR=0xc0a80a02
|
|||
CONFIG_NSH_DRIPADDR=0xc0a80a01
|
||||
CONFIG_NSH_NETMASK=0xffffff00
|
||||
|
||||
#
|
||||
# settings for apps/netutils
|
||||
#
|
||||
CONFIG_NETUTILS_CODECS=y
|
||||
CONFIG_CODECS_URLCODE=y
|
||||
|
||||
#
|
||||
# Stack and heap information
|
||||
#
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@
|
|||
#include <rgmp/pmap.h>
|
||||
#include <rgmp/string.h>
|
||||
#include <rgmp/stdio.h>
|
||||
#include <rgmp/utils.h>
|
||||
#include <rgmp/arch/pci.h>
|
||||
#include <rgmp/memio.h>
|
||||
#include "e1000.h"
|
||||
|
|
@ -104,9 +105,9 @@ struct e1000_dev {
|
|||
uint32_t io_mem_base;
|
||||
uint32_t mem_size;
|
||||
int pci_dev_id;
|
||||
uint16_t pci_addr;
|
||||
unsigned char src_mac[6];
|
||||
unsigned char dst_mac[6];
|
||||
int irq;
|
||||
struct irq_action int_desc;
|
||||
struct tx_ring tx_ring;
|
||||
struct rx_ring rx_ring;
|
||||
|
|
@ -308,16 +309,16 @@ void e1000_init(struct e1000_dev *dev)
|
|||
e1000_outl(dev, E1000_FCRTH, pba*9/10);
|
||||
|
||||
// setup tx rings
|
||||
txd_phys = PADDR(dev->tx_ring.desc);
|
||||
kmem_phys = PADDR(dev->tx_ring.buf);
|
||||
txd_phys = PADDR((uintptr_t)dev->tx_ring.desc);
|
||||
kmem_phys = PADDR((uintptr_t)dev->tx_ring.buf);
|
||||
for (i=0; i<CONFIG_E1000_N_TX_DESC; i++,kmem_phys+=CONFIG_E1000_BUFF_SIZE) {
|
||||
dev->tx_ring.desc[i].base_address = kmem_phys;
|
||||
dev->tx_ring.desc[i].packet_length = 0;
|
||||
dev->tx_ring.desc[i].cksum_offset = 0;
|
||||
dev->tx_ring.desc[i].cksum_origin = 0;
|
||||
dev->tx_ring.desc[i].desc_status = 1;
|
||||
dev->tx_ring.desc[i].desc_command = (1<<0)|(1<<1)|(1<<3);
|
||||
dev->tx_ring.desc[i].special_info = 0;
|
||||
dev->tx_ring.desc[i].base_address = kmem_phys;
|
||||
dev->tx_ring.desc[i].packet_length = 0;
|
||||
dev->tx_ring.desc[i].cksum_offset = 0;
|
||||
dev->tx_ring.desc[i].cksum_origin = 0;
|
||||
dev->tx_ring.desc[i].desc_status = 1;
|
||||
dev->tx_ring.desc[i].desc_command = (1<<0)|(1<<1)|(1<<3);
|
||||
dev->tx_ring.desc[i].special_info = 0;
|
||||
}
|
||||
dev->tx_ring.tail = 0;
|
||||
e1000_outl(dev, E1000_TDT, 0);
|
||||
|
|
@ -329,15 +330,15 @@ void e1000_init(struct e1000_dev *dev)
|
|||
e1000_outl(dev, E1000_TXDCTL, 0x01010000);
|
||||
|
||||
// setup rx rings
|
||||
rxd_phys = PADDR(dev->rx_ring.desc);
|
||||
kmem_phys = PADDR(dev->rx_ring.buf);
|
||||
rxd_phys = PADDR((uintptr_t)dev->rx_ring.desc);
|
||||
kmem_phys = PADDR((uintptr_t)dev->rx_ring.buf);
|
||||
for (i=0; i<CONFIG_E1000_N_RX_DESC; i++,kmem_phys+=CONFIG_E1000_BUFF_SIZE) {
|
||||
dev->rx_ring.desc[i].base_address = kmem_phys;
|
||||
dev->rx_ring.desc[i].packet_length = 0;
|
||||
dev->rx_ring.desc[i].packet_cksum = 0;
|
||||
dev->rx_ring.desc[i].desc_status = 0;
|
||||
dev->rx_ring.desc[i].desc_errors = 0;
|
||||
dev->rx_ring.desc[i].vlan_tag = 0;
|
||||
dev->rx_ring.desc[i].base_address = kmem_phys;
|
||||
dev->rx_ring.desc[i].packet_length = 0;
|
||||
dev->rx_ring.desc[i].packet_cksum = 0;
|
||||
dev->rx_ring.desc[i].desc_status = 0;
|
||||
dev->rx_ring.desc[i].desc_errors = 0;
|
||||
dev->rx_ring.desc[i].vlan_tag = 0;
|
||||
}
|
||||
dev->rx_ring.head = 0;
|
||||
dev->rx_ring.tail = CONFIG_E1000_N_RX_DESC-1;
|
||||
|
|
@ -378,7 +379,7 @@ static int e1000_transmit(struct e1000_dev *e1000)
|
|||
{
|
||||
int tail = e1000->tx_ring.tail;
|
||||
unsigned char *cp = (unsigned char *)
|
||||
(e1000->tx_ring.buf + tail * CONFIG_E1000_BUFF_SIZE);
|
||||
(e1000->tx_ring.buf + tail * CONFIG_E1000_BUFF_SIZE);
|
||||
int count = e1000->uip_dev.d_len;
|
||||
|
||||
/* Verify that the hardware is ready to send another packet. If we get
|
||||
|
|
@ -387,7 +388,7 @@ static int e1000_transmit(struct e1000_dev *e1000)
|
|||
*/
|
||||
|
||||
if (!e1000->tx_ring.desc[tail].desc_status)
|
||||
return -1;
|
||||
return -1;
|
||||
|
||||
/* Increment statistics */
|
||||
|
||||
|
|
@ -445,14 +446,14 @@ static int e1000_uiptxpoll(struct uip_driver_s *dev)
|
|||
*/
|
||||
|
||||
if (e1000->uip_dev.d_len > 0) {
|
||||
uip_arp_out(&e1000->uip_dev);
|
||||
e1000_transmit(e1000);
|
||||
uip_arp_out(&e1000->uip_dev);
|
||||
e1000_transmit(e1000);
|
||||
|
||||
/* Check if there is room in the device to hold another packet. If not,
|
||||
* return a non-zero value to terminate the poll.
|
||||
*/
|
||||
if (!e1000->tx_ring.desc[tail].desc_status)
|
||||
return -1;
|
||||
/* Check if there is room in the device to hold another packet. If not,
|
||||
* return a non-zero value to terminate the poll.
|
||||
*/
|
||||
if (!e1000->tx_ring.desc[tail].desc_status)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* If zero is returned, the polling will continue until all connections have
|
||||
|
|
@ -483,75 +484,75 @@ static void e1000_receive(struct e1000_dev *e1000)
|
|||
{
|
||||
int head = e1000->rx_ring.head;
|
||||
unsigned char *cp = (unsigned char *)
|
||||
(e1000->rx_ring.buf + head * CONFIG_E1000_BUFF_SIZE);
|
||||
(e1000->rx_ring.buf + head * CONFIG_E1000_BUFF_SIZE);
|
||||
int cnt;
|
||||
|
||||
while (e1000->rx_ring.desc[head].desc_status) {
|
||||
|
||||
/* Check for errors and update statistics */
|
||||
/* Check for errors and update statistics */
|
||||
|
||||
// Here we do not handle packets that exceed packet-buffer size
|
||||
if ((e1000->rx_ring.desc[head].desc_status & 3) == 1) {
|
||||
cprintf("NIC READ: Oversized packet\n");
|
||||
goto next;
|
||||
}
|
||||
// Here we do not handle packets that exceed packet-buffer size
|
||||
if ((e1000->rx_ring.desc[head].desc_status & 3) == 1) {
|
||||
cprintf("NIC READ: Oversized packet\n");
|
||||
goto next;
|
||||
}
|
||||
|
||||
/* Check if the packet is a valid size for the uIP buffer configuration */
|
||||
/* Check if the packet is a valid size for the uIP buffer configuration */
|
||||
|
||||
// get the number of actual data-bytes in this packet
|
||||
cnt = e1000->rx_ring.desc[head].packet_length;
|
||||
// get the number of actual data-bytes in this packet
|
||||
cnt = e1000->rx_ring.desc[head].packet_length;
|
||||
|
||||
if (cnt > CONFIG_NET_BUFSIZE || cnt < 14) {
|
||||
cprintf("NIC READ: invalid package size\n");
|
||||
goto next;
|
||||
}
|
||||
if (cnt > CONFIG_NET_BUFSIZE || cnt < 14) {
|
||||
cprintf("NIC READ: invalid package size\n");
|
||||
goto next;
|
||||
}
|
||||
|
||||
/* Copy the data data from the hardware to e1000->uip_dev.d_buf. Set
|
||||
* amount of data in e1000->uip_dev.d_len
|
||||
*/
|
||||
/* Copy the data data from the hardware to e1000->uip_dev.d_buf. Set
|
||||
* amount of data in e1000->uip_dev.d_len
|
||||
*/
|
||||
|
||||
// now we try to copy these data-bytes to the UIP buffer
|
||||
memcpy(e1000->uip_dev.d_buf, cp, cnt);
|
||||
e1000->uip_dev.d_len = cnt;
|
||||
// now we try to copy these data-bytes to the UIP buffer
|
||||
memcpy(e1000->uip_dev.d_buf, cp, cnt);
|
||||
e1000->uip_dev.d_len = cnt;
|
||||
|
||||
/* We only accept IP packets of the configured type and ARP packets */
|
||||
/* We only accept IP packets of the configured type and ARP packets */
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
if (BUF->type == HTONS(UIP_ETHTYPE_IP6))
|
||||
if (BUF->type == HTONS(UIP_ETHTYPE_IP6))
|
||||
#else
|
||||
if (BUF->type == HTONS(UIP_ETHTYPE_IP))
|
||||
if (BUF->type == HTONS(UIP_ETHTYPE_IP))
|
||||
#endif
|
||||
{
|
||||
uip_arp_ipin(&e1000->uip_dev);
|
||||
uip_input(&e1000->uip_dev);
|
||||
{
|
||||
uip_arp_ipin(&e1000->uip_dev);
|
||||
uip_input(&e1000->uip_dev);
|
||||
|
||||
/* If the above function invocation resulted in data that should be
|
||||
* sent out on the network, the field d_len will set to a value > 0.
|
||||
*/
|
||||
/* If the above function invocation resulted in data that should be
|
||||
* sent out on the network, the field d_len will set to a value > 0.
|
||||
*/
|
||||
|
||||
if (e1000->uip_dev.d_len > 0) {
|
||||
uip_arp_out(&e1000->uip_dev);
|
||||
e1000_transmit(e1000);
|
||||
}
|
||||
}
|
||||
else if (BUF->type == htons(UIP_ETHTYPE_ARP)) {
|
||||
uip_arp_arpin(&e1000->uip_dev);
|
||||
if (e1000->uip_dev.d_len > 0) {
|
||||
uip_arp_out(&e1000->uip_dev);
|
||||
e1000_transmit(e1000);
|
||||
}
|
||||
}
|
||||
else if (BUF->type == htons(UIP_ETHTYPE_ARP)) {
|
||||
uip_arp_arpin(&e1000->uip_dev);
|
||||
|
||||
/* If the above function invocation resulted in data that should be
|
||||
* sent out on the network, the field d_len will set to a value > 0.
|
||||
*/
|
||||
/* If the above function invocation resulted in data that should be
|
||||
* sent out on the network, the field d_len will set to a value > 0.
|
||||
*/
|
||||
|
||||
if (e1000->uip_dev.d_len > 0) {
|
||||
e1000_transmit(e1000);
|
||||
}
|
||||
}
|
||||
if (e1000->uip_dev.d_len > 0) {
|
||||
e1000_transmit(e1000);
|
||||
}
|
||||
}
|
||||
|
||||
next:
|
||||
e1000->rx_ring.desc[head].desc_status = 0;
|
||||
e1000->rx_ring.head = (head + 1) % CONFIG_E1000_N_RX_DESC;
|
||||
e1000->rx_ring.free++;
|
||||
head = e1000->rx_ring.head;
|
||||
cp = (unsigned char *)(e1000->rx_ring.buf + head * CONFIG_E1000_BUFF_SIZE);
|
||||
e1000->rx_ring.desc[head].desc_status = 0;
|
||||
e1000->rx_ring.head = (head + 1) % CONFIG_E1000_N_RX_DESC;
|
||||
e1000->rx_ring.free++;
|
||||
head = e1000->rx_ring.head;
|
||||
cp = (unsigned char *)(e1000->rx_ring.buf + head * CONFIG_E1000_BUFF_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -615,7 +616,7 @@ static void e1000_polltimer(int argc, uint32_t arg, ...)
|
|||
* the TX poll if he are unable to accept another packet for transmission.
|
||||
*/
|
||||
if (!e1000->tx_ring.desc[tail].desc_status)
|
||||
return;
|
||||
return;
|
||||
|
||||
/* If so, update TCP timing states and poll uIP for new XMIT data. Hmmm..
|
||||
* might be bug here. Does this mean if there is a transmit in progress,
|
||||
|
|
@ -651,8 +652,8 @@ static int e1000_ifup(struct uip_driver_s *dev)
|
|||
struct e1000_dev *e1000 = (struct e1000_dev *)dev->d_private;
|
||||
|
||||
ndbg("Bringing up: %d.%d.%d.%d\n",
|
||||
dev->d_ipaddr & 0xff, (dev->d_ipaddr >> 8) & 0xff,
|
||||
(dev->d_ipaddr >> 16) & 0xff, dev->d_ipaddr >> 24 );
|
||||
dev->d_ipaddr & 0xff, (dev->d_ipaddr >> 8) & 0xff,
|
||||
(dev->d_ipaddr >> 16) & 0xff, dev->d_ipaddr >> 24 );
|
||||
|
||||
/* Initialize PHYs, the Ethernet interface, and setup up Ethernet interrupts */
|
||||
e1000_init(e1000);
|
||||
|
|
@ -662,9 +663,9 @@ static int e1000_ifup(struct uip_driver_s *dev)
|
|||
(void)wd_start(e1000->txpoll, E1000_WDDELAY, e1000_polltimer, 1, (uint32_t)e1000);
|
||||
|
||||
if (e1000_inl(e1000, E1000_STATUS) & 2)
|
||||
e1000->bifup = true;
|
||||
e1000->bifup = true;
|
||||
else
|
||||
e1000->bifup = false;
|
||||
e1000->bifup = false;
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
|
@ -749,9 +750,9 @@ static int e1000_txavail(struct uip_driver_s *dev)
|
|||
/* Ignore the notification if the interface is not yet up */
|
||||
|
||||
if (e1000->bifup) {
|
||||
/* Check if there is room in the hardware to hold another outgoing packet. */
|
||||
if (e1000->tx_ring.desc[tail].desc_status)
|
||||
(void)uip_poll(&e1000->uip_dev, e1000_uiptxpoll);
|
||||
/* Check if there is room in the hardware to hold another outgoing packet. */
|
||||
if (e1000->tx_ring.desc[tail].desc_status)
|
||||
(void)uip_poll(&e1000->uip_dev, e1000_uiptxpoll);
|
||||
}
|
||||
|
||||
irqrestore(flags);
|
||||
|
|
@ -779,11 +780,11 @@ static int e1000_txavail(struct uip_driver_s *dev)
|
|||
#ifdef CONFIG_NET_IGMP
|
||||
static int e1000_addmac(struct uip_driver_s *dev, const uint8_t *mac)
|
||||
{
|
||||
struct e1000_dev *e1000 = (struct e1000_dev *)dev->d_private;
|
||||
struct e1000_dev *e1000 = (struct e1000_dev *)dev->d_private;
|
||||
|
||||
/* Add the MAC address to the hardware multicast routing table */
|
||||
/* Add the MAC address to the hardware multicast routing table */
|
||||
|
||||
return OK;
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -808,15 +809,15 @@ static int e1000_addmac(struct uip_driver_s *dev, const uint8_t *mac)
|
|||
#ifdef CONFIG_NET_IGMP
|
||||
static int e1000_rmmac(struct uip_driver_s *dev, const uint8_t *mac)
|
||||
{
|
||||
struct e1000_dev *e1000 = (struct e1000_dev *)dev->d_private;
|
||||
struct e1000_dev *e1000 = (struct e1000_dev *)dev->d_private;
|
||||
|
||||
/* Add the MAC address to the hardware multicast routing table */
|
||||
/* Add the MAC address to the hardware multicast routing table */
|
||||
|
||||
return OK;
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
irqreturn_t e1000_interrupt_handler(struct Trapframe *tf, void *dev_id)
|
||||
static irqreturn_t e1000_interrupt_handler(int irq, void *dev_id)
|
||||
{
|
||||
struct e1000_dev *e1000 = (struct e1000_dev *)dev_id;
|
||||
|
||||
|
|
@ -826,27 +827,27 @@ irqreturn_t e1000_interrupt_handler(struct Trapframe *tf, void *dev_id)
|
|||
|
||||
// not for me
|
||||
if (intr_cause == 0)
|
||||
return IRQ_NONE;
|
||||
return IRQ_NONE;
|
||||
|
||||
/* Handle interrupts according to status bit settings */
|
||||
|
||||
// Link status change
|
||||
if (intr_cause & (1<<2)) {
|
||||
if (e1000_inl(e1000, E1000_STATUS) & 2)
|
||||
e1000->bifup = true;
|
||||
else
|
||||
e1000->bifup = false;
|
||||
if (e1000_inl(e1000, E1000_STATUS) & 2)
|
||||
e1000->bifup = true;
|
||||
else
|
||||
e1000->bifup = false;
|
||||
}
|
||||
|
||||
/* Check if we received an incoming packet, if so, call skel_receive() */
|
||||
|
||||
// Rx-descriptor Timer expired
|
||||
if (intr_cause & (1<<7))
|
||||
e1000_receive(e1000);
|
||||
e1000_receive(e1000);
|
||||
|
||||
// Tx queue empty
|
||||
if (intr_cause & (1<<1))
|
||||
wd_cancel(e1000->txtimeout);
|
||||
wd_cancel(e1000->txtimeout);
|
||||
|
||||
/* Check is a packet transmission just completed. If so, call skel_txdone.
|
||||
* This may disable further Tx interrupts if there are no pending
|
||||
|
|
@ -855,17 +856,17 @@ irqreturn_t e1000_interrupt_handler(struct Trapframe *tf, void *dev_id)
|
|||
|
||||
// Tx-descriptor Written back
|
||||
if (intr_cause & (1<<0))
|
||||
uip_poll(&e1000->uip_dev, e1000_uiptxpoll);
|
||||
uip_poll(&e1000->uip_dev, e1000_uiptxpoll);
|
||||
|
||||
|
||||
// Rx-Descriptors Low
|
||||
if (intr_cause & (1<<4)) {
|
||||
int tail;
|
||||
tail = e1000->rx_ring.tail + e1000->rx_ring.free;
|
||||
tail %= CONFIG_E1000_N_RX_DESC;
|
||||
e1000->rx_ring.tail = tail;
|
||||
e1000->rx_ring.free = 0;
|
||||
e1000_outl(e1000, E1000_RDT, tail);
|
||||
int tail;
|
||||
tail = e1000->rx_ring.tail + e1000->rx_ring.free;
|
||||
tail %= CONFIG_E1000_N_RX_DESC;
|
||||
e1000->rx_ring.tail = tail;
|
||||
e1000->rx_ring.free = 0;
|
||||
e1000_outl(e1000, E1000_RDT, tail);
|
||||
}
|
||||
|
||||
return IRQ_HANDLED;
|
||||
|
|
@ -885,20 +886,21 @@ static pci_id_t e1000_id_table[] = {
|
|||
static int e1000_probe(uint16_t addr, pci_id_t id)
|
||||
{
|
||||
uint32_t mmio_base, mmio_size;
|
||||
uint32_t pci_cmd, size;
|
||||
int err, irq, flags;
|
||||
uint32_t size;
|
||||
int err;
|
||||
void *kmem, *omem;
|
||||
struct e1000_dev *dev;
|
||||
|
||||
// alloc e1000_dev memory
|
||||
dev = kzalloc(sizeof(struct e1000_dev));
|
||||
if (dev == NULL)
|
||||
return -1;
|
||||
if ((dev = kzalloc(sizeof(struct e1000_dev))) == NULL)
|
||||
return -1;
|
||||
|
||||
// save pci addr
|
||||
dev->pci_addr = addr;
|
||||
|
||||
// enable device
|
||||
err = pci_enable_device(addr, PCI_RESOURCE_MEM);
|
||||
if (err)
|
||||
goto error;
|
||||
if ((err = pci_enable_device(addr, PCI_BUS_MASTER)) < 0)
|
||||
goto error;
|
||||
|
||||
// get e1000 device type
|
||||
dev->pci_dev_id = id.join;
|
||||
|
|
@ -908,33 +910,20 @@ static int e1000_probe(uint16_t addr, pci_id_t id)
|
|||
mmio_size = pci_resource_len(addr, 0);
|
||||
err = rgmp_memmap_nocache(mmio_base, mmio_size, mmio_base);
|
||||
if (err)
|
||||
goto error;
|
||||
goto error;
|
||||
dev->phy_mem_base = mmio_base;
|
||||
dev->io_mem_base = mmio_base;
|
||||
dev->mem_size = mmio_size;
|
||||
|
||||
// make sure the controller's Bus Master capability is enabled
|
||||
pci_cmd = pci_config_readl(addr, PCI_COMMAND);
|
||||
pci_cmd |= (1<<2);
|
||||
pci_config_writel(addr, PCI_COMMAND, pci_cmd);
|
||||
|
||||
// MAC address
|
||||
memset(dev->dst_mac, 0xFF, 6);
|
||||
memcpy(dev->src_mac, (void *)(dev->io_mem_base+E1000_RA), 6);
|
||||
|
||||
// get e1000 IRQ
|
||||
flags = 0;
|
||||
irq = pci_enable_msi(addr);
|
||||
if (irq == 0) {
|
||||
irq = pci_read_irq(addr);
|
||||
flags |= IDC_SHARE;
|
||||
}
|
||||
dev->irq = irq;
|
||||
// IRQ setup
|
||||
dev->int_desc.handler = e1000_interrupt_handler;
|
||||
dev->int_desc.dev_id = dev;
|
||||
err = rgmp_request_irq(irq, &dev->int_desc, flags);
|
||||
if (err)
|
||||
goto err0;
|
||||
if ((err = pci_request_irq(addr, &dev->int_desc, 0)) < 0)
|
||||
goto err0;
|
||||
|
||||
// Here we alloc a big block of memory once and make it
|
||||
// aligned to page boundary and multiple of page size. This
|
||||
|
|
@ -942,15 +931,19 @@ static int e1000_probe(uint16_t addr, pci_id_t id)
|
|||
// should be mapped no-cache which will hugely reduce memory
|
||||
// access performance. The page size alloc will restrict
|
||||
// this bad effect only within the memory we alloc here.
|
||||
//
|
||||
// NEED FIX: the memalign may alloc memory continous in
|
||||
// virtual address but dis-continous in physical address
|
||||
// due to RGMP memory setup.
|
||||
size = CONFIG_E1000_N_TX_DESC * sizeof(struct tx_desc) +
|
||||
CONFIG_E1000_N_TX_DESC * CONFIG_E1000_BUFF_SIZE +
|
||||
CONFIG_E1000_N_RX_DESC * sizeof(struct rx_desc) +
|
||||
CONFIG_E1000_N_RX_DESC * CONFIG_E1000_BUFF_SIZE;
|
||||
CONFIG_E1000_N_TX_DESC * CONFIG_E1000_BUFF_SIZE +
|
||||
CONFIG_E1000_N_RX_DESC * sizeof(struct rx_desc) +
|
||||
CONFIG_E1000_N_RX_DESC * CONFIG_E1000_BUFF_SIZE;
|
||||
size = ROUNDUP(size, PGSIZE);
|
||||
omem = kmem = memalign(PGSIZE, size);
|
||||
if (kmem == NULL) {
|
||||
err = -ENOMEM;
|
||||
goto err1;
|
||||
err = -ENOMEM;
|
||||
goto err1;
|
||||
}
|
||||
rgmp_memremap_nocache((uintptr_t)kmem, size);
|
||||
|
||||
|
|
@ -991,7 +984,7 @@ static int e1000_probe(uint16_t addr, pci_id_t id)
|
|||
/* Register the device with the OS so that socket IOCTLs can be performed */
|
||||
err = netdev_register(&dev->uip_dev);
|
||||
if (err)
|
||||
goto err2;
|
||||
goto err2;
|
||||
|
||||
// insert into e1000_list
|
||||
dev->next = e1000_list.next;
|
||||
|
|
@ -1000,14 +993,14 @@ static int e1000_probe(uint16_t addr, pci_id_t id)
|
|||
|
||||
return 0;
|
||||
|
||||
err2:
|
||||
err2:
|
||||
rgmp_memremap((uintptr_t)omem, size);
|
||||
free(omem);
|
||||
err1:
|
||||
rgmp_free_irq(irq, &dev->int_desc);
|
||||
err0:
|
||||
err1:
|
||||
pci_free_irq(addr);
|
||||
err0:
|
||||
rgmp_memunmap(mmio_base, mmio_size);
|
||||
error:
|
||||
error:
|
||||
kfree(dev);
|
||||
cprintf("e1000 device probe fail: %d\n", err);
|
||||
return err;
|
||||
|
|
@ -1028,21 +1021,21 @@ void e1000_mod_exit(void)
|
|||
struct e1000_dev *dev;
|
||||
|
||||
size = CONFIG_E1000_N_TX_DESC * sizeof(struct tx_desc) +
|
||||
CONFIG_E1000_N_TX_DESC * CONFIG_E1000_BUFF_SIZE +
|
||||
CONFIG_E1000_N_RX_DESC * sizeof(struct rx_desc) +
|
||||
CONFIG_E1000_N_RX_DESC * CONFIG_E1000_BUFF_SIZE;
|
||||
CONFIG_E1000_N_TX_DESC * CONFIG_E1000_BUFF_SIZE +
|
||||
CONFIG_E1000_N_RX_DESC * sizeof(struct rx_desc) +
|
||||
CONFIG_E1000_N_RX_DESC * CONFIG_E1000_BUFF_SIZE;
|
||||
size = ROUNDUP(size, PGSIZE);
|
||||
|
||||
for (dev=e1000_list.next; dev!=NULL; dev=dev->next) {
|
||||
netdev_unregister(&dev->uip_dev);
|
||||
e1000_reset(dev);
|
||||
wd_delete(dev->txpoll);
|
||||
wd_delete(dev->txtimeout);
|
||||
rgmp_memremap((uintptr_t)dev->tx_ring.desc, size);
|
||||
free(dev->tx_ring.desc);
|
||||
rgmp_free_irq(dev->irq, &dev->int_desc);
|
||||
rgmp_memunmap((uintptr_t)dev->io_mem_base, dev->mem_size);
|
||||
kfree(dev);
|
||||
netdev_unregister(&dev->uip_dev);
|
||||
e1000_reset(dev);
|
||||
wd_delete(dev->txpoll);
|
||||
wd_delete(dev->txtimeout);
|
||||
rgmp_memremap((uintptr_t)dev->tx_ring.desc, size);
|
||||
free(dev->tx_ring.desc);
|
||||
pci_free_irq(dev->pci_addr);
|
||||
rgmp_memunmap((uintptr_t)dev->io_mem_base, dev->mem_size);
|
||||
kfree(dev);
|
||||
}
|
||||
|
||||
e1000_list.next = NULL;
|
||||
|
|
|
|||
|
|
@ -44,9 +44,7 @@
|
|||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <rgmp/types.h>
|
||||
#include <rgmp/trap.h>
|
||||
#include <rgmp/arch/arch.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
|
|
|
|||
|
|
@ -168,30 +168,30 @@ static int vnet_transmit(FAR struct vnet_driver_s *vnet)
|
|||
{
|
||||
int err;
|
||||
|
||||
/* Verify that the hardware is ready to send another packet. If we get
|
||||
* here, then we are committed to sending a packet; Higher level logic
|
||||
* must have assured that there is not transmission in progress.
|
||||
*/
|
||||
/* Verify that the hardware is ready to send another packet. If we get
|
||||
* here, then we are committed to sending a packet; Higher level logic
|
||||
* must have assured that there is not transmission in progress.
|
||||
*/
|
||||
|
||||
/* Increment statistics */
|
||||
/* Increment statistics */
|
||||
|
||||
/* Send the packet: address=vnet->sk_dev.d_buf, length=vnet->sk_dev.d_len */
|
||||
/* Send the packet: address=vnet->sk_dev.d_buf, length=vnet->sk_dev.d_len */
|
||||
err = vnet_xmit(vnet->vnet, (char *)vnet->sk_dev.d_buf, vnet->sk_dev.d_len);
|
||||
if (err) {
|
||||
/* Setup the TX timeout watchdog (perhaps restarting the timer) */
|
||||
//(void)wd_start(vnet->sk_txtimeout, VNET_TXTIMEOUT, vnet_txtimeout, 1, (uint32_t)vnet);
|
||||
/* Setup the TX timeout watchdog (perhaps restarting the timer) */
|
||||
//(void)wd_start(vnet->sk_txtimeout, VNET_TXTIMEOUT, vnet_txtimeout, 1, (uint32_t)vnet);
|
||||
|
||||
// When vnet_xmit fail, it means TX buffer is full. Watchdog
|
||||
// is of no use here because no TX done INT will happen. So
|
||||
// we reset the TX buffer directly.
|
||||
// When vnet_xmit fail, it means TX buffer is full. Watchdog
|
||||
// is of no use here because no TX done INT will happen. So
|
||||
// we reset the TX buffer directly.
|
||||
#ifdef CONFIG_DEBUG
|
||||
cprintf("VNET: TX buffer is full\n");
|
||||
cprintf("VNET: TX buffer is full\n");
|
||||
#endif
|
||||
return ERROR;
|
||||
return ERROR;
|
||||
}
|
||||
else {
|
||||
// this step may be unnecessary here
|
||||
vnet_txdone(vnet);
|
||||
// this step may be unnecessary here
|
||||
vnet_txdone(vnet);
|
||||
}
|
||||
|
||||
return OK;
|
||||
|
|
@ -223,29 +223,29 @@ static int vnet_transmit(FAR struct vnet_driver_s *vnet)
|
|||
|
||||
static int vnet_uiptxpoll(struct uip_driver_s *dev)
|
||||
{
|
||||
FAR struct vnet_driver_s *vnet = (FAR struct vnet_driver_s *)dev->d_private;
|
||||
FAR struct vnet_driver_s *vnet = (FAR struct vnet_driver_s *)dev->d_private;
|
||||
|
||||
/* If the polling resulted in data that should be sent out on the network,
|
||||
* the field d_len is set to a value > 0.
|
||||
*/
|
||||
/* If the polling resulted in data that should be sent out on the network,
|
||||
* the field d_len is set to a value > 0.
|
||||
*/
|
||||
|
||||
if (vnet->sk_dev.d_len > 0)
|
||||
if (vnet->sk_dev.d_len > 0)
|
||||
{
|
||||
uip_arp_out(&vnet->sk_dev);
|
||||
vnet_transmit(vnet);
|
||||
uip_arp_out(&vnet->sk_dev);
|
||||
vnet_transmit(vnet);
|
||||
|
||||
/* Check if there is room in the device to hold another packet. If not,
|
||||
* return a non-zero value to terminate the poll.
|
||||
*/
|
||||
if (vnet_is_txbuff_full(vnet->vnet))
|
||||
return 1;
|
||||
/* Check if there is room in the device to hold another packet. If not,
|
||||
* return a non-zero value to terminate the poll.
|
||||
*/
|
||||
if (vnet_is_txbuff_full(vnet->vnet))
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* If zero is returned, the polling will continue until all connections have
|
||||
* been examined.
|
||||
*/
|
||||
/* If zero is returned, the polling will continue until all connections have
|
||||
* been examined.
|
||||
*/
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -265,54 +265,53 @@ static int vnet_uiptxpoll(struct uip_driver_s *dev)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
void rtos_vnet_recv(struct rgmp_vnet *vnet_dummy, char *data, int len)
|
||||
void rtos_vnet_recv(struct rgmp_vnet *rgmp_vnet, char *data, int len)
|
||||
{
|
||||
// now only support 1 vnet
|
||||
struct vnet_driver_s *vnet = &g_vnet[0];
|
||||
struct vnet_driver_s *vnet = rgmp_vnet->priv;
|
||||
|
||||
do {
|
||||
/* Check for errors and update statistics */
|
||||
/* Check for errors and update statistics */
|
||||
|
||||
/* Check if the packet is a valid size for the uIP buffer configuration */
|
||||
if (len > CONFIG_NET_BUFSIZE || len < 14) {
|
||||
/* Check if the packet is a valid size for the uIP buffer configuration */
|
||||
if (len > CONFIG_NET_BUFSIZE || len < 14) {
|
||||
#ifdef CONFIG_DEBUG
|
||||
cprintf("VNET: receive invalid packet of size %d\n", len);
|
||||
cprintf("VNET: receive invalid packet of size %d\n", len);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Copy the data data from the hardware to vnet->sk_dev.d_buf. Set
|
||||
// amount of data in vnet->sk_dev.d_len
|
||||
memcpy(vnet->sk_dev.d_buf, data, len);
|
||||
vnet->sk_dev.d_len = len;
|
||||
// Copy the data data from the hardware to vnet->sk_dev.d_buf. Set
|
||||
// amount of data in vnet->sk_dev.d_len
|
||||
memcpy(vnet->sk_dev.d_buf, data, len);
|
||||
vnet->sk_dev.d_len = len;
|
||||
|
||||
/* We only accept IP packets of the configured type and ARP packets */
|
||||
/* We only accept IP packets of the configured type and ARP packets */
|
||||
|
||||
#ifdef CONFIG_NET_IPv6
|
||||
if (BUF->type == HTONS(UIP_ETHTYPE_IP6))
|
||||
if (BUF->type == HTONS(UIP_ETHTYPE_IP6))
|
||||
#else
|
||||
if (BUF->type == HTONS(UIP_ETHTYPE_IP))
|
||||
if (BUF->type == HTONS(UIP_ETHTYPE_IP))
|
||||
#endif
|
||||
{
|
||||
uip_arp_ipin(&vnet->sk_dev);
|
||||
uip_input(&vnet->sk_dev);
|
||||
{
|
||||
uip_arp_ipin(&vnet->sk_dev);
|
||||
uip_input(&vnet->sk_dev);
|
||||
|
||||
// If the above function invocation resulted in data that should be
|
||||
// sent out on the network, the field d_len will set to a value > 0.
|
||||
if (vnet->sk_dev.d_len > 0) {
|
||||
uip_arp_out(&vnet->sk_dev);
|
||||
vnet_transmit(vnet);
|
||||
}
|
||||
}
|
||||
else if (BUF->type == htons(UIP_ETHTYPE_ARP)) {
|
||||
uip_arp_arpin(&vnet->sk_dev);
|
||||
// If the above function invocation resulted in data that should be
|
||||
// sent out on the network, the field d_len will set to a value > 0.
|
||||
if (vnet->sk_dev.d_len > 0) {
|
||||
uip_arp_out(&vnet->sk_dev);
|
||||
vnet_transmit(vnet);
|
||||
}
|
||||
}
|
||||
else if (BUF->type == htons(UIP_ETHTYPE_ARP)) {
|
||||
uip_arp_arpin(&vnet->sk_dev);
|
||||
|
||||
// If the above function invocation resulted in data that should be
|
||||
// sent out on the network, the field d_len will set to a value > 0.
|
||||
if (vnet->sk_dev.d_len > 0) {
|
||||
vnet_transmit(vnet);
|
||||
}
|
||||
}
|
||||
// If the above function invocation resulted in data that should be
|
||||
// sent out on the network, the field d_len will set to a value > 0.
|
||||
if (vnet->sk_dev.d_len > 0) {
|
||||
vnet_transmit(vnet);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (0); /* While there are more packets to be processed */
|
||||
}
|
||||
|
|
@ -336,17 +335,17 @@ void rtos_vnet_recv(struct rgmp_vnet *vnet_dummy, char *data, int len)
|
|||
|
||||
static void vnet_txdone(FAR struct vnet_driver_s *vnet)
|
||||
{
|
||||
/* Check for errors and update statistics */
|
||||
/* Check for errors and update statistics */
|
||||
|
||||
/* If no further xmits are pending, then cancel the TX timeout and
|
||||
* disable further Tx interrupts.
|
||||
*/
|
||||
/* If no further xmits are pending, then cancel the TX timeout and
|
||||
* disable further Tx interrupts.
|
||||
*/
|
||||
|
||||
//wd_cancel(vnet->sk_txtimeout);
|
||||
//wd_cancel(vnet->sk_txtimeout);
|
||||
|
||||
/* Then poll uIP for new XMIT data */
|
||||
/* Then poll uIP for new XMIT data */
|
||||
|
||||
(void)uip_poll(&vnet->sk_dev, vnet_uiptxpoll);
|
||||
(void)uip_poll(&vnet->sk_dev, vnet_uiptxpoll);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -370,15 +369,15 @@ static void vnet_txdone(FAR struct vnet_driver_s *vnet)
|
|||
|
||||
static void vnet_txtimeout(int argc, uint32_t arg, ...)
|
||||
{
|
||||
FAR struct vnet_driver_s *vnet = (FAR struct vnet_driver_s *)arg;
|
||||
FAR struct vnet_driver_s *vnet = (FAR struct vnet_driver_s *)arg;
|
||||
|
||||
/* Increment statistics and dump debug info */
|
||||
/* Increment statistics and dump debug info */
|
||||
|
||||
/* Then reset the hardware */
|
||||
/* Then reset the hardware */
|
||||
|
||||
/* Then poll uIP for new XMIT data */
|
||||
/* Then poll uIP for new XMIT data */
|
||||
|
||||
(void)uip_poll(&vnet->sk_dev, vnet_uiptxpoll);
|
||||
(void)uip_poll(&vnet->sk_dev, vnet_uiptxpoll);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -401,28 +400,28 @@ static void vnet_txtimeout(int argc, uint32_t arg, ...)
|
|||
|
||||
static void vnet_polltimer(int argc, uint32_t arg, ...)
|
||||
{
|
||||
FAR struct vnet_driver_s *vnet = (FAR struct vnet_driver_s *)arg;
|
||||
FAR struct vnet_driver_s *vnet = (FAR struct vnet_driver_s *)arg;
|
||||
|
||||
/* Check if there is room in the send another TX packet. We cannot perform
|
||||
* the TX poll if he are unable to accept another packet for transmission.
|
||||
*/
|
||||
if (vnet_is_txbuff_full(vnet->vnet)) {
|
||||
/* Check if there is room in the send another TX packet. We cannot perform
|
||||
* the TX poll if he are unable to accept another packet for transmission.
|
||||
*/
|
||||
if (vnet_is_txbuff_full(vnet->vnet)) {
|
||||
#ifdef CONFIG_DEBUG
|
||||
cprintf("VNET: TX buffer is full\n");
|
||||
cprintf("VNET: TX buffer is full\n");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/* If so, update TCP timing states and poll uIP for new XMIT data. Hmmm..
|
||||
* might be bug here. Does this mean if there is a transmit in progress,
|
||||
* we will missing TCP time state updates?
|
||||
*/
|
||||
/* If so, update TCP timing states and poll uIP for new XMIT data. Hmmm..
|
||||
* might be bug here. Does this mean if there is a transmit in progress,
|
||||
* we will missing TCP time state updates?
|
||||
*/
|
||||
|
||||
(void)uip_timer(&vnet->sk_dev, vnet_uiptxpoll, VNET_POLLHSEC);
|
||||
(void)uip_timer(&vnet->sk_dev, vnet_uiptxpoll, VNET_POLLHSEC);
|
||||
|
||||
/* Setup the watchdog poll timer again */
|
||||
/* Setup the watchdog poll timer again */
|
||||
|
||||
(void)wd_start(vnet->sk_txpoll, VNET_WDDELAY, vnet_polltimer, 1, arg);
|
||||
(void)wd_start(vnet->sk_txpoll, VNET_WDDELAY, vnet_polltimer, 1, arg);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -444,20 +443,20 @@ static void vnet_polltimer(int argc, uint32_t arg, ...)
|
|||
|
||||
static int vnet_ifup(struct uip_driver_s *dev)
|
||||
{
|
||||
FAR struct vnet_driver_s *vnet = (FAR struct vnet_driver_s *)dev->d_private;
|
||||
FAR struct vnet_driver_s *vnet = (FAR struct vnet_driver_s *)dev->d_private;
|
||||
|
||||
ndbg("Bringing up: %d.%d.%d.%d\n",
|
||||
dev->d_ipaddr & 0xff, (dev->d_ipaddr >> 8) & 0xff,
|
||||
(dev->d_ipaddr >> 16) & 0xff, dev->d_ipaddr >> 24 );
|
||||
ndbg("Bringing up: %d.%d.%d.%d\n",
|
||||
dev->d_ipaddr & 0xff, (dev->d_ipaddr >> 8) & 0xff,
|
||||
(dev->d_ipaddr >> 16) & 0xff, dev->d_ipaddr >> 24 );
|
||||
|
||||
/* Initialize PHYs, the Ethernet interface, and setup up Ethernet interrupts */
|
||||
/* Initialize PHYs, the Ethernet interface, and setup up Ethernet interrupts */
|
||||
|
||||
/* Set and activate a timer process */
|
||||
/* Set and activate a timer process */
|
||||
|
||||
(void)wd_start(vnet->sk_txpoll, VNET_WDDELAY, vnet_polltimer, 1, (uint32_t)vnet);
|
||||
(void)wd_start(vnet->sk_txpoll, VNET_WDDELAY, vnet_polltimer, 1, (uint32_t)vnet);
|
||||
|
||||
vnet->sk_bifup = true;
|
||||
return OK;
|
||||
vnet->sk_bifup = true;
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -478,28 +477,28 @@ static int vnet_ifup(struct uip_driver_s *dev)
|
|||
|
||||
static int vnet_ifdown(struct uip_driver_s *dev)
|
||||
{
|
||||
FAR struct vnet_driver_s *vnet = (FAR struct vnet_driver_s *)dev->d_private;
|
||||
irqstate_t flags;
|
||||
FAR struct vnet_driver_s *vnet = (FAR struct vnet_driver_s *)dev->d_private;
|
||||
irqstate_t flags;
|
||||
|
||||
/* Disable the Ethernet interrupt */
|
||||
/* Disable the Ethernet interrupt */
|
||||
|
||||
flags = irqsave();
|
||||
flags = irqsave();
|
||||
|
||||
/* Cancel the TX poll timer and TX timeout timers */
|
||||
/* Cancel the TX poll timer and TX timeout timers */
|
||||
|
||||
wd_cancel(vnet->sk_txpoll);
|
||||
//wd_cancel(vnet->sk_txtimeout);
|
||||
wd_cancel(vnet->sk_txpoll);
|
||||
//wd_cancel(vnet->sk_txtimeout);
|
||||
|
||||
/* Put the the EMAC is its reset, non-operational state. This should be
|
||||
* a known configuration that will guarantee the vnet_ifup() always
|
||||
* successfully brings the interface back up.
|
||||
*/
|
||||
/* Put the the EMAC is its reset, non-operational state. This should be
|
||||
* a known configuration that will guarantee the vnet_ifup() always
|
||||
* successfully brings the interface back up.
|
||||
*/
|
||||
|
||||
/* Mark the device "down" */
|
||||
/* Mark the device "down" */
|
||||
|
||||
vnet->sk_bifup = false;
|
||||
irqrestore(flags);
|
||||
return OK;
|
||||
vnet->sk_bifup = false;
|
||||
irqrestore(flags);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -523,35 +522,35 @@ static int vnet_ifdown(struct uip_driver_s *dev)
|
|||
|
||||
static int vnet_txavail(struct uip_driver_s *dev)
|
||||
{
|
||||
FAR struct vnet_driver_s *vnet = (FAR struct vnet_driver_s *)dev->d_private;
|
||||
irqstate_t flags;
|
||||
FAR struct vnet_driver_s *vnet = (FAR struct vnet_driver_s *)dev->d_private;
|
||||
irqstate_t flags;
|
||||
|
||||
/* Disable interrupts because this function may be called from interrupt
|
||||
* level processing.
|
||||
*/
|
||||
/* Disable interrupts because this function may be called from interrupt
|
||||
* level processing.
|
||||
*/
|
||||
|
||||
flags = irqsave();
|
||||
flags = irqsave();
|
||||
|
||||
/* Ignore the notification if the interface is not yet up */
|
||||
/* Ignore the notification if the interface is not yet up */
|
||||
|
||||
if (vnet->sk_bifup)
|
||||
if (vnet->sk_bifup)
|
||||
{
|
||||
/* Check if there is room in the hardware to hold another outgoing packet. */
|
||||
if (vnet_is_txbuff_full(vnet->vnet)) {
|
||||
/* Check if there is room in the hardware to hold another outgoing packet. */
|
||||
if (vnet_is_txbuff_full(vnet->vnet)) {
|
||||
#ifdef CONFIG_DEBUG
|
||||
cprintf("VNET: TX buffer is full\n");
|
||||
cprintf("VNET: TX buffer is full\n");
|
||||
#endif
|
||||
goto out;
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* If so, then poll uIP for new XMIT data */
|
||||
/* If so, then poll uIP for new XMIT data */
|
||||
|
||||
(void)uip_poll(&vnet->sk_dev, vnet_uiptxpoll);
|
||||
(void)uip_poll(&vnet->sk_dev, vnet_uiptxpoll);
|
||||
}
|
||||
|
||||
out:
|
||||
irqrestore(flags);
|
||||
return OK;
|
||||
out:
|
||||
irqrestore(flags);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
@ -575,11 +574,11 @@ static int vnet_txavail(struct uip_driver_s *dev)
|
|||
#ifdef CONFIG_NET_IGMP
|
||||
static int vnet_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
|
||||
{
|
||||
FAR struct vnet_driver_s *vnet = (FAR struct vnet_driver_s *)dev->d_private;
|
||||
FAR struct vnet_driver_s *vnet = (FAR struct vnet_driver_s *)dev->d_private;
|
||||
|
||||
/* Add the MAC address to the hardware multicast routing table */
|
||||
/* Add the MAC address to the hardware multicast routing table */
|
||||
|
||||
return OK;
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -604,11 +603,11 @@ static int vnet_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
|
|||
#ifdef CONFIG_NET_IGMP
|
||||
static int vnet_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
|
||||
{
|
||||
FAR struct vnet_driver_s *vnet = (FAR struct vnet_driver_s *)dev->d_private;
|
||||
FAR struct vnet_driver_s *vnet = (FAR struct vnet_driver_s *)dev->d_private;
|
||||
|
||||
/* Add the MAC address to the hardware multicast routing table */
|
||||
/* Add the MAC address to the hardware multicast routing table */
|
||||
|
||||
return OK;
|
||||
return OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -633,41 +632,41 @@ static int vnet_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac)
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
void vnet_initialize(void)
|
||||
int vnet_init(struct rgmp_vnet *vnet)
|
||||
{
|
||||
struct vnet_driver_s *priv;
|
||||
struct rgmp_vnet *vnet = vnet_list.next;
|
||||
int i;
|
||||
struct vnet_driver_s *priv;
|
||||
static int i = 0;
|
||||
|
||||
for (i=0; i<CONFIG_VNET_NINTERFACES; i++) {
|
||||
if (vnet == NULL)
|
||||
break;
|
||||
priv = &g_vnet[i];
|
||||
if (i >= CONFIG_VNET_NINTERFACES)
|
||||
return -1;
|
||||
|
||||
/* Initialize the driver structure */
|
||||
priv = &g_vnet[i++];
|
||||
|
||||
memset(priv, 0, sizeof(struct vnet_driver_s));
|
||||
priv->sk_dev.d_ifup = vnet_ifup; /* I/F down callback */
|
||||
priv->sk_dev.d_ifdown = vnet_ifdown; /* I/F up (new IP address) callback */
|
||||
priv->sk_dev.d_txavail = vnet_txavail; /* New TX data callback */
|
||||
/* Initialize the driver structure */
|
||||
|
||||
memset(priv, 0, sizeof(struct vnet_driver_s));
|
||||
priv->sk_dev.d_ifup = vnet_ifup; /* I/F down callback */
|
||||
priv->sk_dev.d_ifdown = vnet_ifdown; /* I/F up (new IP address) callback */
|
||||
priv->sk_dev.d_txavail = vnet_txavail; /* New TX data callback */
|
||||
#ifdef CONFIG_NET_IGMP
|
||||
priv->sk_dev.d_addmac = vnet_addmac; /* Add multicast MAC address */
|
||||
priv->sk_dev.d_rmmac = vnet_rmmac; /* Remove multicast MAC address */
|
||||
priv->sk_dev.d_addmac = vnet_addmac; /* Add multicast MAC address */
|
||||
priv->sk_dev.d_rmmac = vnet_rmmac; /* Remove multicast MAC address */
|
||||
#endif
|
||||
priv->sk_dev.d_private = (void*)g_vnet; /* Used to recover private state from dev */
|
||||
priv->sk_dev.d_private = (void*)priv; /* Used to recover private state from dev */
|
||||
|
||||
/* Create a watchdog for timing polling for and timing of transmisstions */
|
||||
/* Create a watchdog for timing polling for and timing of transmisstions */
|
||||
|
||||
priv->sk_txpoll = wd_create(); /* Create periodic poll timer */
|
||||
//priv->sk_txtimeout = wd_create(); /* Create TX timeout timer */
|
||||
priv->sk_txpoll = wd_create(); /* Create periodic poll timer */
|
||||
//priv->sk_txtimeout = wd_create(); /* Create TX timeout timer */
|
||||
|
||||
priv->vnet = vnet;
|
||||
priv->vnet = vnet;
|
||||
vnet->priv = priv;
|
||||
|
||||
/* Register the device with the OS */
|
||||
/* Register the device with the OS */
|
||||
|
||||
(void)netdev_register(&priv->sk_dev);
|
||||
vnet = vnet->next;
|
||||
}
|
||||
(void)netdev_register(&priv->sk_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NET && CONFIG_NET_VNET */
|
||||
|
|
|
|||
|
|
@ -223,6 +223,13 @@ config MEMSET_64BIT
|
|||
Compiles memset() for architectures that suppport 64-bit operations
|
||||
efficiently.
|
||||
|
||||
config ARCH_STRCHR
|
||||
bool "strchr()"
|
||||
default n
|
||||
---help---
|
||||
Select this option if the architecture provides an optimized version
|
||||
of strchr().
|
||||
|
||||
config ARCH_STRCMP
|
||||
bool "strcmp()"
|
||||
default n
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CONFIG_ARCH_STRCHR
|
||||
FAR char *strchr(FAR const char *s, int c)
|
||||
{
|
||||
if (s)
|
||||
|
|
@ -74,3 +75,4 @@ FAR char *strchr(FAR const char *s, int c)
|
|||
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue