Contiki-NG
Functions
platform.c File Reference

    COOJA Contiki mote main file.
More...

#include <jni.h>
#include <stdio.h>
#include <string.h>
#include "contiki.h"
#include "sys/cc.h"
#include "sys/clock.h"
#include "sys/etimer.h"
#include "sys/cooja_mt.h"
#include "sys/log.h"
#include "lib/random.h"
#include "lib/simEnvChange.h"
#include "net/netstack.h"
#include "net/queuebuf.h"
#include "dev/eeprom.h"
#include "dev/serial-line.h"
#include "dev/cooja-radio.h"
#include "dev/button-sensor.h"
#include "dev/pir-sensor.h"
#include "dev/vib-sensor.h"
#include "dev/moteid.h"
#include "sys/node-id.h"
#include "services/rpl-border-router/rpl-border-router.h"
#include "net/ipv6/uip.h"
#include "net/ipv6/uip-ds6.h"

Go to the source code of this file.

Functions

void platform_init_stage_one ()
 Basic (Stage 1) platform driver initialisation. More...
 
void platform_init_stage_two ()
 Stage 2 of platform driver initialisation. More...
 
void platform_init_stage_three ()
 Final stage of platform driver initialisation. More...
 
void platform_main_loop ()
 The platform's main loop, if provided. More...
 
JNIEXPORT void JNICALL Java_org_contikios_cooja_corecomm_CLASSNAME_init (JNIEnv *env, jobject obj)
 Initialize a mote by starting processes etc. More...
 
JNIEXPORT void JNICALL Java_org_contikios_cooja_corecomm_CLASSNAME_getMemory (JNIEnv *env, jobject obj, jint rel_addr, jint length, jbyteArray mem_arr)
 Get a segment from the process memory. More...
 
JNIEXPORT void JNICALL Java_org_contikios_cooja_corecomm_CLASSNAME_setMemory (JNIEnv *env, jobject obj, jint rel_addr, jint length, jbyteArray mem_arr)
 Replace a segment of the process memory with given byte array. More...
 
JNIEXPORT void JNICALL Java_org_contikios_cooja_corecomm_CLASSNAME_tick (JNIEnv *env, jobject obj)
 Let mote execute one "block" of code (tick mote). More...
 
JNIEXPORT void JNICALL Java_org_contikios_cooja_corecomm_CLASSNAME_setReferenceAddress (JNIEnv *env, jobject obj, jint addr)
 Set the relative memory address of the reference variable. More...
 

Detailed Description

    COOJA Contiki mote main file.
Author
Fredrik Osterlind fros@.nosp@m.sics.nosp@m..se

Definition in file platform.c.

Function Documentation

◆ Java_org_contikios_cooja_corecomm_CLASSNAME_getMemory()

JNIEXPORT void JNICALL Java_org_contikios_cooja_corecomm_CLASSNAME_getMemory ( JNIEnv *  env,
jobject  obj,
jint  rel_addr,
jint  length,
jbyteArray  mem_arr 
)

Get a segment from the process memory.

Parameters
envJNI Environment interface pointer
objunused
rel_addrStart address of segment
lengthSize of memory segment
mem_arrByte array destination for the fetched memory segment
Returns
Java byte array containing a copy of memory segment.
        Fetches a memory segment from the process memory starting at
        (rel_addr), with size (length). This function does not perform
        ANY error checking, and the process may crash if addresses are
        not available/readable.

        This is a JNI function and should only be called via the
        responsible Java part (MoteType.java).

Definition at line 257 of file platform.c.

◆ Java_org_contikios_cooja_corecomm_CLASSNAME_init()

JNIEXPORT void JNICALL Java_org_contikios_cooja_corecomm_CLASSNAME_init ( JNIEnv *  env,
jobject  obj 
)

Initialize a mote by starting processes etc.

Parameters
envJNI Environment interface pointer
objunused
        This function initializes a mote by starting certain
        processes and setting up the environment.

        This is a JNI function and should only be called via the
        responsible Java part (MoteType.java).

Definition at line 232 of file platform.c.

◆ Java_org_contikios_cooja_corecomm_CLASSNAME_setMemory()

JNIEXPORT void JNICALL Java_org_contikios_cooja_corecomm_CLASSNAME_setMemory ( JNIEnv *  env,
jobject  obj,
jint  rel_addr,
jint  length,
jbyteArray  mem_arr 
)

Replace a segment of the process memory with given byte array.

Parameters
envJNI Environment interface pointer
objunused
rel_addrStart address of segment
lengthSize of memory segment
mem_arrByte array contaning new memory
        Replaces a process memory segment with given byte array.
        This function does not perform ANY error checking, and the
        process may crash if addresses are not available/writable.

        This is a JNI function and should only be called via the
        responsible Java part (MoteType.java).

Definition at line 284 of file platform.c.

◆ Java_org_contikios_cooja_corecomm_CLASSNAME_setReferenceAddress()

JNIEXPORT void JNICALL Java_org_contikios_cooja_corecomm_CLASSNAME_setReferenceAddress ( JNIEnv *  env,
jobject  obj,
jint  addr 
)

Set the relative memory address of the reference variable.

Parameters
envJNI Environment interface pointer
objunused
addrRelative memory address
        This is a JNI function and should only be called via the
        responsible Java part (MoteType.java).

Definition at line 356 of file platform.c.

◆ Java_org_contikios_cooja_corecomm_CLASSNAME_tick()

JNIEXPORT void JNICALL Java_org_contikios_cooja_corecomm_CLASSNAME_tick ( JNIEnv *  env,
jobject  obj 
)

Let mote execute one "block" of code (tick mote).

Parameters
envJNI Environment interface pointer
objunused
        Let mote defined by the active contiki processes and current
        process memory execute some program code. This code must not block
        or else this function will never return. A typical contiki
        process will return when it executes PROCESS_WAIT..() statements.

        Before the control is left to contiki processes, any messages
        from the Java part are handled. These may for example be
        incoming network data. After the contiki processes return control,
        messages to the Java part are also handled (those which may need
        special attention).

        This is a JNI function and should only be called via the
        responsible Java part (MoteType.java).

Definition at line 313 of file platform.c.

References etimer_pending(), and etimer_request_poll().