Merge remote-tracking branch 'origin/next' into bsongis/9XR-PRO_port

Conflicts:
	companion/src/eeprominterface.cpp
	companion/src/eeprominterface.h
	companion/src/firmwares/opentx/opentxeeprom.cpp
	companion/src/firmwares/opentx/opentxinterface.cpp
	companion/src/firmwares/opentx/opentxinterface.h
	companion/src/mdichild.cpp
	radio/src/Makefile
This commit is contained in:
bsongis
2014-05-11 22:48:48 +02:00
477 changed files with 116230 additions and 71400 deletions
+3 -3
View File
@@ -38,7 +38,7 @@
volatile uint16_t Analog_values[NUMBER_ANALOG];
#if defined(TARANIS_STICKS)
#if defined(FRSKY_STICKS)
const char ana_direction[NUMBER_ANALOG] = {1, 1, 0, 1 ,0 ,1 ,0, 0, 0};
#endif
@@ -118,12 +118,12 @@ void adcRead()
}
// adc direction correct
#if defined(TARANIS_STICKS)
#if defined(FRSKY_STICKS)
uint32_t i ;
for (i=0; i<NUMBER_ANALOG; i++) {
if (ana_direction[i]) {
Analog_values[i] = 4096-Analog_values[i];
}
}
#endif
#endif
}
+1 -1
View File
@@ -111,7 +111,7 @@ extern "C" void DAC_IRQHandler()
{
AudioBuffer *nextBuffer = audioQueue.getNextFilledBuffer();
if (nextBuffer) {
DACC->DACC_TNPR = CONVERT_PTR(nextBuffer->data);
DACC->DACC_TNPR = CONVERT_PTR_UINT(nextBuffer->data);
DACC->DACC_TNCR = nextBuffer->size/2;
}
else {
+6 -7
View File
@@ -314,15 +314,14 @@ extern "C" void TC3_IRQHandler() //capture ppm in at 2MHz
ppmInState = 1; // triggered
}
else {
if (ppmInState && ppmInState<=16)
{
if (val>800 && val<2200) // if valid pulse-width range
{
g_ppmIns[ppmInState++ - 1] =
(int16_t)(val - 1500)*(g_eeGeneral.PPM_Multiplier+10)/10; //+-500 != 512, but close enough.
if (ppmInState>0 && ppmInState<=16) {
if (val>800 && val<2200) { // if valid pulse-width range
ppmInValid = 100;
g_ppmIns[ppmInState++ - 1] = (int16_t)(val - 1500)*(g_eeGeneral.PPM_Multiplier+10)/10; //+-500 != 512, but close enough.
}
else
else {
ppmInState = 0; // not triggered
}
}
}
+10 -1
View File
@@ -43,6 +43,10 @@
extern uint16_t ResetReason;
#define BOOTLOADER_SIZE 0x8000
#define FIRMWARE_SIZE (256*1024)
#define FIRMWARE_ADDRESS 0x00400000
#if defined(REVA)
#define GPIO_BUTTON_MENU PIOB->PIO_PDSR
#define GPIO_BUTTON_EXIT PIOA->PIO_PDSR
@@ -153,6 +157,10 @@ extern uint16_t sessionTimer;
void setSticksGain(uint8_t gains);
// Write Flash driver
#define FLASH_PAGESIZE 256
void writeFlash(uint32_t * address, uint32_t * buffer);
// Keys driver
extern uint32_t readKeys();
extern uint32_t readTrims();
@@ -230,8 +238,9 @@ extern int8_t Coproc_temp;
extern int8_t Coproc_maxtemp;
// Haptic driver
void hapticOff(void) ;
void hapticOff(void);
void hapticOn(uint32_t pwmPercent);
#define HAPTIC_OFF() hapticOff()
// BlueTooth driver
#if defined(BLUETOOTH)
+73
View File
@@ -0,0 +1,73 @@
#include "../../opentx.h"
uint32_t (*IAP_Function)(uint32_t, uint32_t);
void writeFlash(uint32_t *address, uint32_t *buffer) // size is 256 bytes
{
uint32_t FlashSectorNum;
uint32_t flash_cmd = 0;
// Always initialise this here, setting a default doesn't seem to work
IAP_Function = (uint32_t (*)(uint32_t, uint32_t)) *(( uint32_t *)0x00800008);
FlashSectorNum = (uint32_t) address;
FlashSectorNum >>= 8;// page size is 256 bytes
FlashSectorNum &= 2047;// max page number
/* Send data to the sector here */
for (int i=0; i<FLASH_PAGESIZE/4; i++) {
*address++ = *buffer++;
}
/* build the command to send to EEFC */
flash_cmd = (0x5A << 24) | (FlashSectorNum << 8) | 0x03; //AT91C_MC_FCMD_EWP ;
__disable_irq();
/* Call the IAP function with appropriate command */
i = IAP_Function(0, flash_cmd);
__enable_irq();
}
uint32_t readLockBits()
{
// Always initialise this here, setting a default doesn't seem to work
IAP_Function = (uint32_t (*)(uint32_t, uint32_t)) *(( uint32_t *)0x00800008);
uint32_t flash_cmd = (0x5A << 24) | 0x0A;//AT91C_MC_FCMD_GLB ;
__disable_irq();
(void) IAP_Function( 0, flash_cmd );
__enable_irq();
return EFC->EEFC_FRR;
}
void clearLockBits()
{
uint32_t i;
uint32_t flash_cmd = 0;
// Always initialise this here, setting a default doesn't seem to work
IAP_Function = (uint32_t (*)(uint32_t, uint32_t)) *(( uint32_t *)0x00800008);
for ( i = 0; i < 16; i += 1 )
{
flash_cmd = (0x5A << 24) | ((128*i) << 8) | 0x09; //AT91C_MC_FCMD_CLB ;
__disable_irq();
/* Call the IAP function with appropriate command */
(void) IAP_Function( 0, flash_cmd );
__enable_irq();
}
}
uint32_t isFirmwareStart(const void * buffer)
{
const uint32_t * block = (const uint32_t *)buffer;
if ((block[0] & 0xFFFE3000) != 0x20000000 ) {
return 0;
}
if ((block[1] & 0xFFF80000) != 0x00400000) {
return 0;
}
if ((block[2] & 0xFFF80000) != 0x00400000) {
return 0;
}
return 1;
}
+2 -2
View File
@@ -167,7 +167,7 @@ extern "C" void PWM_IRQHandler(void)
else {
// Kick off serial output here
sscptr = SSC;
sscptr->SSC_TPR = CONVERT_PTR(pxxStream[0]);
sscptr->SSC_TPR = CONVERT_PTR_UINT(pxxStream[0]);
sscptr->SSC_TCR = (uint8_t *)pxxStreamPtr[0] - (uint8_t *)pxxStream[0];
sscptr->SSC_PTCR = SSC_PTCR_TXTEN; // Start transfers
}
@@ -191,7 +191,7 @@ extern "C" void PWM_IRQHandler(void)
else {
// Kick off serial output here
sscptr = SSC;
sscptr->SSC_TPR = CONVERT_PTR(dsm2Stream);
sscptr->SSC_TPR = CONVERT_PTR_UINT(dsm2Stream);
sscptr->SSC_TCR = (uint8_t *)dsm2StreamPtr - (uint8_t *)dsm2Stream;
sscptr->SSC_PTCR = SSC_PTCR_TXTEN; // Start transfers
}
+9 -6
View File
@@ -71,9 +71,15 @@ SECTIONS
*/
.text :
{
_stext = .; /* Provide the name for the start of this section */
FILL(0xFFFF)
CREATE_OBJECT_SYMBOLS
CREATE_OBJECT_SYMBOLS
*(.bootrodata)
*(.bootrodata.*)
. = ALIGN(32768); /* Align the start of the exidx part */
_stext = .; /* Provide the name for the start of this section */
KEEP(*(.vectors))
*(.text)
@@ -129,11 +135,8 @@ SECTIONS
. = ALIGN(4); /* Align the end of the section */
} > RAM
_ebss = .; /* Provide the name for the end of this section */
_ebss = .; /* Provide the name for the end of this section */
. = ALIGN(4); /* Align the end of the section */
__end = .;
_end = .;
/*
* The ".stack" section is our stack.
@@ -54,7 +54,7 @@ static SBCInquiryData inquiryData = {
SBC_PERIPHERAL_DEVICE_CONNECTED,// Peripheral device is connected
0x00, // Reserved bits
0x01, // Media is removable
SBC_SPC_VERSION_4, // SPC-4 supported
0x02, // SBC_SPC_VERSION_4, // SPC-4 supported
0x2, // Response data format, must be 0x2
0, // Hierarchical addressing not supported
0, // ACA not supported
@@ -94,6 +94,8 @@
#define SBC_VERIFY_10 0x2F
/// Request a list of the possible capacities that can be formatted on medium
#define SBC_READ_FORMAT_CAPACITIES 0x23
#define SBC_START_STOP 0x19
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
@@ -620,6 +622,21 @@ typedef struct {
} __attribute__ ((packed)) SBCReadWriteErrorRecovery; // GCC
//------------------------------------------------------------------------------
/// \brief start/stop command
/// \see
//------------------------------------------------------------------------------
typedef struct {
unsigned char bModeDataLength; //!< Length of mode data to follow
unsigned char bImmediate:1, //!<
bReserved1:7; //!< Reserved bits
unsigned char pReserved[2]; //!< Reserved bytes
unsigned char startStop:1, //!< DPO/FUA bits supported ?
eject:1, //!< Reserved bits
bReserved2:6; //!< Is medium write-protected ?
} __attribute__ ((packed)) SBCStartStop; // GCC
//------------------------------------------------------------------------------
/// \brief Generic structure for holding information about SBC commands
/// \see SBCInquiry
@@ -642,6 +659,7 @@ typedef union {
SBCWrite10 write10; //!< WRITE (10) command
SBCMediumRemoval mediumRemoval; //!< PREVENT/ALLOW MEDIUM REMOVAL command
SBCModeSense6 modeSense6; //!< MODE SENSE (6) command
SBCStartStop startStopCmd; //!< START-STOP command
} SBCCommand;
@@ -1430,7 +1430,7 @@ unsigned char SBC_GetCommandInformation(void *command,
//------------------------------------
case SBC_PREVENT_ALLOW_MEDIUM_REMOVAL:
case 0x1B:
case SBC_START_STOP:
//------------------------------------
(*type) = MSDD_NO_TRANSFER;
break;
@@ -1590,7 +1590,6 @@ unsigned char SBC_ProcessCommand(MSDLun *lun,
//------------------------------------
case SBC_PREVENT_ALLOW_MEDIUM_REMOVAL:
case 0x1B:
//------------------------------------
TRACE_INFO_WP("PrevAllowRem ");
@@ -1600,6 +1599,19 @@ unsigned char SBC_ProcessCommand(MSDLun *lun,
result = MSDD_STATUS_SUCCESS;
break;
case SBC_START_STOP:
TRACE_INFO_WP("StartStop ");
result = command->startStopCmd.startStop ;
if (result == 0) {
lun->status = LUN_EJECTED ;
}
else {
lun->status = LUN_CHANGED ;
}
result = MSDD_STATUS_SUCCESS;
break;
#if 0
//------------------------------------
case SBC_READ_FORMAT_CAPACITIES: