WPILib Reorganization

This is a major restructuring of the WPILib repository to simply build
procedures and remove the remnants of Maven from everything except the
eclipse plugins. Gradle files have been largely simplified or rewritten,
taking advantage of splitting up parts of the build into separate build
files for ease of reading.

The eclipse plugins are now in a separate project, as is ntcore. All
dependencies are resolved via Maven dependencies, with the
Jenkins-maintained WPILib repo. Project structures have also been
simplified: we no longer have separate subprojects inside wpilibc and
wpilibj. Where possible, these changes hav been done with git renames,
to make sure we still have full history for all repositories. Other
unrelated subprojects have also been broken out: OutlineViewer is now a
separate project.

Change-Id: Ib4e2a6e1a2f66427a14f16612b0e0d69ed661878
This commit is contained in:
Fredric Silberberg
2015-09-24 20:26:49 -04:00
parent c20d34c2b6
commit 6d854afb0e
1769 changed files with 2278 additions and 333177 deletions

View File

@@ -0,0 +1,174 @@
#include <jni.h>
#include <assert.h>
#include "Log.hpp"
#include "edu_wpi_first_wpilibj_hal_SPIJNI.h"
#include "HAL/Digital.hpp"
#include "HALUtil.h"
// set the logging level
TLogLevel spiJNILogLevel = logWARNING;
#define SPIJNI_LOG(level) \
if (level > spiJNILogLevel) ; \
else Log().Get(level)
extern "C" {
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiInitialize
* Signature: (B)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiInitialize
(JNIEnv * env, jclass, jbyte port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiInitialize";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
int32_t status = 0;
spiInitialize(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiTransaction
* Signature: (BLjava/nio/ByteBuffer;Ljava/nio/ByteBuffer;B)I
*/
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiTransaction
(JNIEnv * env, jclass, jbyte port, jobject dataToSend, jobject dataReceived, jbyte size)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiTransaction";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
uint8_t* dataToSendPtr = nullptr;
if (dataToSend != 0) {
dataToSendPtr = (uint8_t*)env->GetDirectBufferAddress(dataToSend);
}
uint8_t* dataReceivedPtr = (uint8_t*)env->GetDirectBufferAddress(dataReceived);
SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size;
SPIJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr;
SPIJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr;
jint retVal = spiTransaction(port, dataToSendPtr, dataReceivedPtr, size);
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal;
}
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiWrite
* Signature: (BLjava/nio/ByteBuffer;B)I
*/
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiWrite
(JNIEnv * env, jclass, jbyte port, jobject dataToSend, jbyte size)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiWrite";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
uint8_t* dataToSendPtr = nullptr;
if (dataToSend != 0) {
dataToSendPtr = (uint8_t*)env->GetDirectBufferAddress(dataToSend);
}
SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size;
SPIJNI_LOG(logDEBUG) << "DataToSendPtr = " << dataToSendPtr;
jint retVal = spiWrite(port, dataToSendPtr, size);
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal;
}
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiRead
* Signature: (BLjava/nio/ByteBuffer;B)I
*/
JNIEXPORT jint JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiRead
(JNIEnv * env, jclass, jbyte port, jobject dataReceived, jbyte size)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiRead";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
uint8_t* dataReceivedPtr = (uint8_t*)env->GetDirectBufferAddress(dataReceived);
SPIJNI_LOG(logDEBUG) << "Size = " << (jint)size;
SPIJNI_LOG(logDEBUG) << "DataReceivedPtr = " << dataReceivedPtr;
jint retVal = spiRead(port, (uint8_t*)dataReceivedPtr, size);
SPIJNI_LOG(logDEBUG) << "ReturnValue = " << (jint)retVal;
return retVal;
}
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiClose
* Signature: (B)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiClose
(JNIEnv *, jclass, jbyte port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiClose";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
spiClose(port);
}
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiSetSpeed
* Signature: (BI)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetSpeed
(JNIEnv *, jclass, jbyte port, jint speed)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetSpeed";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
SPIJNI_LOG(logDEBUG) << "Speed = " << (jint) speed;
spiSetSpeed(port, speed);
}
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiSetOpts
* Signature: (BIII)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetOpts
(JNIEnv *, jclass, jbyte port, jint msb_first, jint sample_on_trailing, jint clk_idle_high)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetOpts";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
SPIJNI_LOG(logDEBUG) << "msb_first = " << msb_first;
SPIJNI_LOG(logDEBUG) << "sample_on_trailing = " << sample_on_trailing;
SPIJNI_LOG(logDEBUG) << "clk_idle_high = " << clk_idle_high;
spiSetOpts(port, msb_first, sample_on_trailing, clk_idle_high);
}
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiSetChipSelectActiveHigh
* Signature: (B)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveHigh
(JNIEnv * env, jclass, jbyte port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetCSActiveHigh";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
int32_t status = 0;
spiSetChipSelectActiveHigh(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
/*
* Class: edu_wpi_first_wpilibj_hal_SPIJNI
* Method: spiSetChipSelectActiveLow
* Signature: (B)V
*/
JNIEXPORT void JNICALL Java_edu_wpi_first_wpilibj_hal_SPIJNI_spiSetChipSelectActiveLow
(JNIEnv * env, jclass, jbyte port)
{
SPIJNI_LOG(logDEBUG) << "Calling SPIJNI spiSetCSActiveLow";
SPIJNI_LOG(logDEBUG) << "Port = " << (jint) port;
int32_t status = 0;
spiSetChipSelectActiveLow(port, &status);
SPIJNI_LOG(logDEBUG) << "Status = " << status;
CheckStatus(env, status);
}
} // extern "C"