mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
cleanup 'n' updates
This commit is contained in:
parent
8cc876d02a
commit
0bc08a48d8
@ -129,10 +129,10 @@ int32_t GPSInitialize(void)
|
||||
|
||||
HwSettingsOptionalModulesGet(optionalModules);
|
||||
|
||||
if (optionalModules[HWSETTINGS_OPTIONALMODULES_GPS] == HWSETTINGS_OPTIONALMODULES_ENABLED)
|
||||
//if (optionalModules[HWSETTINGS_OPTIONALMODULES_GPS] == HWSETTINGS_OPTIONALMODULES_ENABLED)
|
||||
gpsEnabled = true;
|
||||
else
|
||||
gpsEnabled = false;
|
||||
//else
|
||||
// gpsEnabled = false;
|
||||
#endif
|
||||
|
||||
if (gpsPort && gpsEnabled) {
|
||||
@ -144,7 +144,7 @@ int32_t GPSInitialize(void)
|
||||
#ifdef PIOS_GPS_SETS_HOMELOCATION
|
||||
HomeLocationInitialize();
|
||||
#endif
|
||||
updateSettings();
|
||||
//updateSettings();
|
||||
|
||||
gps_rx_buffer = pvPortMalloc(NMEA_MAX_PACKET_LENGTH);
|
||||
PIOS_Assert(gps_rx_buffer);
|
||||
@ -407,4 +407,4 @@ static void updateSettings()
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
*/
|
@ -73,9 +73,10 @@ static void osdgenTask(void *parameters);
|
||||
|
||||
// ****************
|
||||
// Private constants
|
||||
xSemaphoreHandle osdSemaphore;
|
||||
#define LONG_TIME 0xffff
|
||||
xSemaphoreHandle osdSemaphore = NULL;
|
||||
|
||||
#define STACK_SIZE_BYTES 1024
|
||||
#define STACK_SIZE_BYTES 1096
|
||||
|
||||
#define TASK_PRIORITY (tskIDLE_PRIORITY + 4)
|
||||
#define UPDATE_PERIOD 100
|
||||
@ -2288,26 +2289,33 @@ static void osdgenTask(void *parameters)
|
||||
// intro
|
||||
for(int i=0; i<125; i++)
|
||||
{
|
||||
clearGraphics();
|
||||
introGraphics();
|
||||
xSemaphoreTake(osdSemaphore, portMAX_DELAY);
|
||||
if( xSemaphoreTake( osdSemaphore, LONG_TIME ) == pdTRUE )
|
||||
{
|
||||
clearGraphics();
|
||||
introGraphics();
|
||||
}
|
||||
}
|
||||
for(int i=0; i<125; i++)
|
||||
{
|
||||
clearGraphics();
|
||||
introGraphics();
|
||||
introText();
|
||||
xSemaphoreTake(osdSemaphore, portMAX_DELAY);
|
||||
if( xSemaphoreTake( osdSemaphore, LONG_TIME ) == pdTRUE )
|
||||
{
|
||||
clearGraphics();
|
||||
introGraphics();
|
||||
introText();
|
||||
}
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
GPSPositionGet(&gpsData);
|
||||
AttitudeActualGet(&attitude);
|
||||
setAttitudeOsd((int16_t)attitude.Pitch,(int16_t)attitude.Roll,(int16_t)attitude.Yaw);
|
||||
setGpsOsd(gpsData.Status,gpsData.Latitude,gpsData.Longitude,gpsData.Altitude,gpsData.Groundspeed);
|
||||
updateOnceEveryFrame();
|
||||
xSemaphoreTake(osdSemaphore, portMAX_DELAY);
|
||||
if( xSemaphoreTake( osdSemaphore, LONG_TIME ) == pdTRUE )
|
||||
{
|
||||
GPSPositionGet(&gpsData);
|
||||
AttitudeActualGet(&attitude);
|
||||
setAttitudeOsd((int16_t)attitude.Pitch,(int16_t)attitude.Roll,(int16_t)attitude.Yaw);
|
||||
setGpsOsd(gpsData.Status,gpsData.Latitude,gpsData.Longitude,gpsData.Altitude,gpsData.Groundspeed);
|
||||
updateOnceEveryFrame();
|
||||
}
|
||||
//xSemaphoreTake(osdSemaphore, portMAX_DELAY);
|
||||
//vTaskDelayUntil(&lastSysTime, 10 / portTICK_RATE_MS);
|
||||
}
|
||||
}
|
||||
|
@ -105,14 +105,21 @@ SRC += $(OPSYSTEM)/pios_usb_board_data.c
|
||||
SRC += $(OPSYSTEM)/fonts.c
|
||||
SRC += $(OPSYSTEM)/font_outlined8x14.c
|
||||
SRC += $(OPSYSTEM)/font_outlined8x8.c
|
||||
SRC += $(FLIGHTLIB)/fifo_buffer.c
|
||||
SRC += $(OPSYSTEM)/alarms.c
|
||||
SRC += $(OPSYSTEM)/taskmonitor.c
|
||||
#SRC += $(OPSYSTEM)/taskmonitor.c
|
||||
SRC += $(OPUAVTALK)/uavtalk.c
|
||||
SRC += $(OPUAVOBJ)/uavobjectmanager.c
|
||||
SRC += $(OPUAVOBJ)/eventdispatcher.c
|
||||
#SRC += $(OPSYSTEM)/pios_usb_hid_desc.c
|
||||
|
||||
#ifeq ($(DEBUG),YES)
|
||||
SRC += $(OPSYSTEM)/dcc_stdio.c
|
||||
SRC += $(OPSYSTEM)/cm3_fault_handlers.c
|
||||
#endif
|
||||
|
||||
SRC += $(FLIGHTLIB)/fifo_buffer.c
|
||||
SRC += $(FLIGHTLIB)/taskmonitor.c
|
||||
|
||||
## UAVOBJECTS
|
||||
#SRC += $(OPUAVSYNTHDIR)/accessorydesired.c
|
||||
SRC += $(OPUAVSYNTHDIR)/objectpersistence.c
|
||||
|
87
flight/OSD/System/cm3_fault_handlers.c
Normal file
87
flight/OSD/System/cm3_fault_handlers.c
Normal file
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* cm3_fault_handlers.c
|
||||
*
|
||||
* Created on: Apr 24, 2011
|
||||
* Author: msmith
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "dcc_stdio.h"
|
||||
#ifdef STM32F4XX
|
||||
# include "stm32f4xx.h"
|
||||
#endif
|
||||
#ifdef STM32F2XX
|
||||
# include "stm32f2xx.h"
|
||||
#endif
|
||||
|
||||
#define FAULT_TRAMPOLINE(_vec) \
|
||||
__attribute__((naked, no_instrument_function)) \
|
||||
void \
|
||||
_vec##_Handler(void) \
|
||||
{ \
|
||||
__asm( ".syntax unified\n" \
|
||||
"MOVS R0, #4 \n" \
|
||||
"MOV R1, LR \n" \
|
||||
"TST R0, R1 \n" \
|
||||
"BEQ 1f \n" \
|
||||
"MRS R0, PSP \n" \
|
||||
"B " #_vec "_Handler2 \n" \
|
||||
"1: \n" \
|
||||
"MRS R0, MSP \n" \
|
||||
"B " #_vec "_Handler2 \n" \
|
||||
".syntax divided\n"); \
|
||||
} \
|
||||
struct hack
|
||||
|
||||
struct cm3_frame {
|
||||
uint32_t r0;
|
||||
uint32_t r1;
|
||||
uint32_t r2;
|
||||
uint32_t r3;
|
||||
uint32_t r12;
|
||||
uint32_t lr;
|
||||
uint32_t pc;
|
||||
uint32_t psr;
|
||||
};
|
||||
|
||||
FAULT_TRAMPOLINE(HardFault);
|
||||
FAULT_TRAMPOLINE(BusFault);
|
||||
FAULT_TRAMPOLINE(UsageFault);
|
||||
|
||||
/* this is a hackaround to avoid an issue where dereferencing SCB seems to result in bad codegen and a link error */
|
||||
#define SCB_REG(_reg) (*(uint32_t *)&(SCB->_reg))
|
||||
|
||||
void
|
||||
HardFault_Handler2(struct cm3_frame *frame)
|
||||
{
|
||||
dbg_write_str("\nHARD FAULT");
|
||||
dbg_write_hex32(frame->pc);
|
||||
dbg_write_char('\n');
|
||||
dbg_write_hex32(SCB_REG(HFSR));
|
||||
dbg_write_char('\n');
|
||||
for (;;);
|
||||
}
|
||||
|
||||
void
|
||||
BusFault_Handler2(struct cm3_frame *frame)
|
||||
{
|
||||
dbg_write_str("\nBUS FAULT");
|
||||
dbg_write_hex32(frame->pc);
|
||||
dbg_write_char('\n');
|
||||
dbg_write_hex32(SCB_REG(CFSR));
|
||||
dbg_write_char('\n');
|
||||
dbg_write_hex32(SCB_REG(BFAR));
|
||||
dbg_write_char('\n');
|
||||
for (;;);
|
||||
}
|
||||
|
||||
void
|
||||
UsageFault_Handler2(struct cm3_frame *frame)
|
||||
{
|
||||
dbg_write_str("\nUSAGE FAULT");
|
||||
dbg_write_hex32(frame->pc);
|
||||
dbg_write_char('\n');
|
||||
dbg_write_hex32(SCB_REG(CFSR));
|
||||
dbg_write_char('\n');
|
||||
for (;;);
|
||||
}
|
149
flight/OSD/System/dcc_stdio.c
Normal file
149
flight/OSD/System/dcc_stdio.c
Normal file
@ -0,0 +1,149 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Dominic Rath *
|
||||
* Dominic.Rath@gmx.de *
|
||||
* Copyright (C) 2008 by Spencer Oliver *
|
||||
* spen@spen-soft.co.uk *
|
||||
* Copyright (C) 2008 by Frederik Kriewtz *
|
||||
* frederik@kriewitz.eu *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "dcc_stdio.h"
|
||||
|
||||
#define TARGET_REQ_TRACEMSG 0x00
|
||||
#define TARGET_REQ_DEBUGMSG_ASCII 0x01
|
||||
#define TARGET_REQ_DEBUGMSG_HEXMSG(size) (0x01 | ((size & 0xff) << 8))
|
||||
#define TARGET_REQ_DEBUGCHAR 0x02
|
||||
|
||||
/* we use the cortex_m3 DCRDR reg to simulate a arm7_9 dcc channel
|
||||
* DCRDR[7:0] is used by target for status
|
||||
* DCRDR[15:8] is used by target for write buffer
|
||||
* DCRDR[23:16] is used for by host for status
|
||||
* DCRDR[31:24] is used for by host for write buffer */
|
||||
|
||||
#define NVIC_DBG_DATA_R (*((volatile unsigned short *)0xE000EDF8))
|
||||
|
||||
#define BUSY 1
|
||||
|
||||
void dbg_write(unsigned long dcc_data)
|
||||
{
|
||||
int len = 4;
|
||||
|
||||
while (len--)
|
||||
{
|
||||
/* wait for data ready */
|
||||
while (NVIC_DBG_DATA_R & BUSY);
|
||||
|
||||
/* write our data and set write flag - tell host there is data*/
|
||||
NVIC_DBG_DATA_R = (unsigned short)(((dcc_data & 0xff) << 8) | BUSY);
|
||||
dcc_data >>= 8;
|
||||
}
|
||||
}
|
||||
|
||||
void dbg_trace_point(unsigned long number)
|
||||
{
|
||||
dbg_write(TARGET_REQ_TRACEMSG | (number << 8));
|
||||
}
|
||||
|
||||
void dbg_write_u32(const unsigned long *val, long len)
|
||||
{
|
||||
dbg_write(TARGET_REQ_DEBUGMSG_HEXMSG(4) | ((len & 0xffff) << 16));
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
dbg_write(*val);
|
||||
|
||||
val++;
|
||||
len--;
|
||||
}
|
||||
}
|
||||
|
||||
void dbg_write_u16(const unsigned short *val, long len)
|
||||
{
|
||||
unsigned long dcc_data;
|
||||
|
||||
dbg_write(TARGET_REQ_DEBUGMSG_HEXMSG(2) | ((len & 0xffff) << 16));
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
dcc_data = val[0]
|
||||
| ((len > 1) ? val[1] << 16: 0x0000);
|
||||
|
||||
dbg_write(dcc_data);
|
||||
|
||||
val += 2;
|
||||
len -= 2;
|
||||
}
|
||||
}
|
||||
|
||||
void dbg_write_u8(const unsigned char *val, long len)
|
||||
{
|
||||
unsigned long dcc_data;
|
||||
|
||||
dbg_write(TARGET_REQ_DEBUGMSG_HEXMSG(1) | ((len & 0xffff) << 16));
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
dcc_data = val[0]
|
||||
| ((len > 1) ? val[1] << 8 : 0x00)
|
||||
| ((len > 2) ? val[2] << 16 : 0x00)
|
||||
| ((len > 3) ? val[3] << 24 : 0x00);
|
||||
|
||||
dbg_write(dcc_data);
|
||||
|
||||
val += 4;
|
||||
len -= 4;
|
||||
}
|
||||
}
|
||||
|
||||
void dbg_write_str(const char *msg)
|
||||
{
|
||||
long len;
|
||||
unsigned long dcc_data;
|
||||
|
||||
for (len = 0; msg[len] && (len < 65536); len++);
|
||||
|
||||
dbg_write(TARGET_REQ_DEBUGMSG_ASCII | ((len & 0xffff) << 16));
|
||||
|
||||
while (len > 0)
|
||||
{
|
||||
dcc_data = msg[0]
|
||||
| ((len > 1) ? msg[1] << 8 : 0x00)
|
||||
| ((len > 2) ? msg[2] << 16 : 0x00)
|
||||
| ((len > 3) ? msg[3] << 24 : 0x00);
|
||||
dbg_write(dcc_data);
|
||||
|
||||
msg += 4;
|
||||
len -= 4;
|
||||
}
|
||||
}
|
||||
|
||||
void dbg_write_char(char msg)
|
||||
{
|
||||
dbg_write(TARGET_REQ_DEBUGCHAR | ((msg & 0xff) << 16));
|
||||
}
|
||||
|
||||
void dbg_write_hex32(const unsigned long val)
|
||||
{
|
||||
static const char hextab[] = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7',
|
||||
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
|
||||
};
|
||||
|
||||
for (int shift = 28; shift >= 0; shift -= 4)
|
||||
dbg_write_char(hextab[(val >> shift) & 0xf]);
|
||||
}
|
@ -9,7 +9,7 @@
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html.
|
||||
*----------------------------------------------------------*/
|
||||
@ -23,47 +23,53 @@
|
||||
|
||||
/* Notes: We use 5 task priorities */
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_MALLOC_FAILED_HOOK 1
|
||||
#define configCPU_CLOCK_HZ ( ( unsigned long ) 56000000 )
|
||||
#define configTICK_RATE_HZ ( ( portTickType ) 1000 )
|
||||
#define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 48 )
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 22 * 256) )
|
||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 0
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_COUNTING_SEMAPHORES 0
|
||||
#define configUSE_ALTERNATIVE_API 0
|
||||
#define configQUEUE_REGISTRY_SIZE 10
|
||||
#define configCPU_CLOCK_HZ (SYSCLK_FREQ) // really the NVIC clock ...
|
||||
#define configTICK_RATE_HZ ((portTickType )1000)
|
||||
#define configMAX_PRIORITIES ((unsigned portBASE_TYPE)5)
|
||||
#define configMINIMAL_STACK_SIZE ((unsigned short)512)
|
||||
#define configTOTAL_HEAP_SIZE ((size_t)(180 * 1024)) // this is minimum, not total
|
||||
#define configMAX_TASK_NAME_LEN (16)
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 0
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configUSE_COUNTING_SEMAPHORES 0
|
||||
#define configUSE_ALTERNATIVE_API 0
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configQUEUE_REGISTRY_SIZE 10
|
||||
|
||||
#define configUSE_TIMERS 1
|
||||
#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) /* run timers at max priority */
|
||||
#define configTIMER_QUEUE_LENGTH 10
|
||||
#define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE
|
||||
|
||||
/* Co-routine definitions. */
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
#define configUSE_CO_ROUTINES 0
|
||||
//#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. */
|
||||
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 1
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_xTaskGetSchedulerState 1
|
||||
#define INCLUDE_xTaskGetCurrentTaskHandle 1
|
||||
#define INCLUDE_uxTaskGetStackHighWaterMark 1
|
||||
|
||||
/* This is the raw value as per the Cortex-M3 NVIC. Values can be 255
|
||||
(lowest) to 1 (highest maskable) to 0 (highest non-maskable). */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY 15 << 4 /* equivalent to NVIC priority 15 */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 0 << 4 /* equivalent to NVIC priority 3 */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY 15 << 4 /* equivalent to NVIC priority 15 */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY 3 << 4 /* equivalent to NVIC priority 3 */
|
||||
|
||||
/* This is the value being used as per the ST library which permits 16
|
||||
priority values, 0 to 15. This must correspond to the
|
||||
@ -71,25 +77,23 @@ configKERNEL_INTERRUPT_PRIORITY setting. Here 15 corresponds to the lowest
|
||||
NVIC value of 255. */
|
||||
#define configLIBRARY_KERNEL_INTERRUPT_PRIORITY 15
|
||||
|
||||
#if !defined(ARCH_POSIX) && !defined(ARCH_WIN32)
|
||||
#define CHECK_IRQ_STACK
|
||||
#endif
|
||||
|
||||
/* Enable run time stats collection */
|
||||
#if defined(DIAGNOSTICS)
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define INCLUDE_uxTaskGetRunTime 1
|
||||
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#define INCLUDE_uxTaskGetRunTime 1
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()\
|
||||
do {\
|
||||
(*(unsigned long *)0xe000edfc) |= (1<<24);/* DEMCR |= DEMCR_TRCENA */\
|
||||
(*(unsigned long *)0xe0001000) |= 1; /* DWT_CTRL |= DWT_CYCCNT_ENA */\
|
||||
} while(0)
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() (*(unsigned long *)0xe0001004)/* DWT_CYCCNT */
|
||||
#else
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 1
|
||||
#endif
|
||||
/*
|
||||
* Once we move to CMSIS2 we can at least use:
|
||||
*
|
||||
* CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk;
|
||||
*
|
||||
* (still nothing for the DWT registers, surprisingly)
|
||||
*/
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() \
|
||||
do { \
|
||||
(*(unsigned long *)0xe000edfc) |= (1<<24); /* DEMCR |= DEMCR_TRCENA */ \
|
||||
(*(unsigned long *)0xe0001000) |= 1; /* DWT_CTRL |= DWT_CYCCNT_ENA */ \
|
||||
} while(0)
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() (*(unsigned long *)0xe0001004) /* DWT_CYCCNT */
|
||||
|
||||
|
||||
/**
|
||||
|
36
flight/OSD/System/inc/dcc_stdio.h
Normal file
36
flight/OSD/System/inc/dcc_stdio.h
Normal file
@ -0,0 +1,36 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2008 by Dominic Rath *
|
||||
* Dominic.Rath@gmx.de *
|
||||
* Copyright (C) 2008 by Spencer Oliver *
|
||||
* spen@spen-soft.co.uk *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the *
|
||||
* Free Software Foundation, Inc., *
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef DCC_STDIO_H
|
||||
#define DCC_STDIO_H
|
||||
|
||||
void dbg_trace_point(unsigned long number);
|
||||
|
||||
void dbg_write_u32(const unsigned long *val, long len);
|
||||
void dbg_write_u16(const unsigned short *val, long len);
|
||||
void dbg_write_u8(const unsigned char *val, long len);
|
||||
|
||||
void dbg_write_str(const char *msg);
|
||||
void dbg_write_char(char msg);
|
||||
void dbg_write_hex32(const unsigned long val);
|
||||
|
||||
#endif /* DCC_STDIO_H */
|
@ -1,43 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup OpenPilotSystem OpenPilot System
|
||||
* @{
|
||||
* @addtogroup OpenPilotLibraries OpenPilot System Libraries
|
||||
* @{
|
||||
* @file taskmonitor.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Include file of the task monitoring library
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef TASKMONITOR_H
|
||||
#define TASKMONITOR_H
|
||||
|
||||
#include "taskinfo.h"
|
||||
|
||||
int32_t TaskMonitorInitialize(void);
|
||||
int32_t TaskMonitorAdd(TaskInfoRunningElem task, xTaskHandle handle);
|
||||
int32_t TaskMonitorRemove(TaskInfoRunningElem task);
|
||||
void TaskMonitorUpdateAll(void);
|
||||
|
||||
#endif // TASKMONITOR_H
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
@ -186,21 +186,6 @@ void processReset(void)
|
||||
RCC_ClearFlag();
|
||||
}
|
||||
|
||||
/*static void updateOnceEveryFrame() {
|
||||
#ifdef TEXT_ENABLED
|
||||
clearText();
|
||||
for (uint8_t i = 0; i < TEXT_LINES; ++i) {
|
||||
updateText(i);
|
||||
}
|
||||
#endif //TEXT_ENABLED
|
||||
|
||||
#ifdef GRAPICSENABLED
|
||||
clearGraphics();
|
||||
updateGrapics();
|
||||
#endif //GRAPICSENABLED
|
||||
}
|
||||
*/
|
||||
|
||||
int main()
|
||||
{
|
||||
int result;
|
||||
@ -221,35 +206,10 @@ int main()
|
||||
&initTaskHandle);
|
||||
PIOS_Assert(result == pdPASS);
|
||||
|
||||
// turn all the leds off
|
||||
//USB_LED_OFF;
|
||||
|
||||
|
||||
#if defined(PIOS_COM_DEBUG)
|
||||
DEBUG_PRINTF("\r\n");
|
||||
#endif
|
||||
|
||||
// *************
|
||||
// Main executive loop
|
||||
clearGraphics();
|
||||
introGraphics();
|
||||
PIOS_DELAY_WaitmS(1000);
|
||||
//clearText();
|
||||
introText();
|
||||
PIOS_DELAY_WaitmS(1000);
|
||||
/*for(int i=0;i<10000;i++){
|
||||
updateTextPixmap(activeTextId);
|
||||
PIOS_DELAY_WaituS(10);
|
||||
}*/
|
||||
|
||||
/* swap the stack to use the IRQ stack */
|
||||
//Stack_Change();
|
||||
|
||||
/* Start the FreeRTOS scheduler which should never returns.*/
|
||||
vTaskStartScheduler();
|
||||
|
||||
/* If all is well we will never reach here as the scheduler will now be running. */
|
||||
|
||||
/* Do some indication to user that something bad just happened */
|
||||
PIOS_LED_Off(PIOS_LED_HEARTBEAT); \
|
||||
for(;;) { \
|
||||
@ -258,45 +218,6 @@ int main()
|
||||
};
|
||||
|
||||
return 0;
|
||||
/*
|
||||
for (;;)
|
||||
{
|
||||
#ifdef TEXT_ENABLED
|
||||
if (update == 2) {
|
||||
update = 0;
|
||||
#ifdef TEXT_INVERTED_ENABLED
|
||||
clearTextInverted();
|
||||
#endif //TEXT_INVERTED_ENABLED
|
||||
updateTextPixmap(activeTextId);
|
||||
}
|
||||
else if (update == 1) {
|
||||
#else
|
||||
if (update == 1) {
|
||||
#endif //TEXTENABLED
|
||||
update = 0;
|
||||
updateOnceEveryFrame();
|
||||
}
|
||||
|
||||
#if defined(USE_WATCHDOG)
|
||||
processWatchdog(); // process the watchdog
|
||||
#endif
|
||||
}
|
||||
|
||||
// *************
|
||||
// we should never arrive here
|
||||
|
||||
// disable all interrupts
|
||||
PIOS_IRQ_Disable();
|
||||
|
||||
// turn off all leds
|
||||
USB_LED_OFF;
|
||||
|
||||
|
||||
PIOS_SYS_Reset();
|
||||
|
||||
while (1);
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -288,7 +288,7 @@ static const struct pios_exti_cfg pios_exti_hsync_cfg __exti_config = {
|
||||
.irq = {
|
||||
.init = {
|
||||
.NVIC_IRQChannel = EXTI0_IRQn,
|
||||
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGH,
|
||||
.NVIC_IRQChannelPreemptionPriority = PIOS_IRQ_PRIO_HIGHEST,
|
||||
.NVIC_IRQChannelSubPriority = 0,
|
||||
.NVIC_IRQChannelCmd = ENABLE,
|
||||
},
|
||||
@ -582,7 +582,7 @@ void PIOS_VIDEO_DMA_Handler(void)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(PIOS_INCLUDE_ADC)
|
||||
/*
|
||||
* ADC system
|
||||
*/
|
||||
@ -627,6 +627,7 @@ struct pios_adc_dev pios_adc_devs[] = {
|
||||
|
||||
uint8_t pios_adc_num_devices = NELEMENTS(pios_adc_devs);
|
||||
|
||||
#endif
|
||||
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
#define DAC_DHR12R2_ADDRESS 0x40007414
|
||||
@ -926,7 +927,7 @@ const struct pios_usb_cdc_cfg pios_usb_cdc_cfg = {
|
||||
#define PIOS_COM_TELEM_RF_RX_BUF_LEN 512
|
||||
#define PIOS_COM_TELEM_RF_TX_BUF_LEN 512
|
||||
|
||||
#define PIOS_COM_GPS_RX_BUF_LEN 32
|
||||
#define PIOS_COM_GPS_RX_BUF_LEN 127
|
||||
|
||||
#define PIOS_COM_TELEM_USB_RX_BUF_LEN 65
|
||||
#define PIOS_COM_TELEM_USB_TX_BUF_LEN 65
|
||||
@ -1147,7 +1148,7 @@ void PIOS_Board_Init(void) {
|
||||
#if defined(PIOS_INCLUDE_COM_TELEM)
|
||||
{ /* Eventually add switch for this port function */
|
||||
uint32_t pios_usart_telem_rf_id;
|
||||
if (PIOS_USART_Init(&pios_usart_telem_rf_id, &pios_usart_gps_cfg)) {
|
||||
if (PIOS_USART_Init(&pios_usart_telem_rf_id, &pios_usart_telem_main_cfg)) {
|
||||
PIOS_Assert(0);
|
||||
}
|
||||
|
||||
|
@ -1,150 +0,0 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
* @addtogroup OpenPilotSystem OpenPilot System
|
||||
* @{
|
||||
* @addtogroup OpenPilotLibraries OpenPilot System Libraries
|
||||
* @{
|
||||
* @file taskmonitor.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Task monitoring library
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "openpilot.h"
|
||||
//#include "taskmonitor.h"
|
||||
|
||||
// Private constants
|
||||
|
||||
// Private types
|
||||
|
||||
// Private variables
|
||||
static xSemaphoreHandle lock;
|
||||
static xTaskHandle handles[TASKINFO_RUNNING_NUMELEM];
|
||||
static uint32_t lastMonitorTime;
|
||||
|
||||
// Private functions
|
||||
|
||||
/**
|
||||
* Initialize library
|
||||
*/
|
||||
int32_t TaskMonitorInitialize(void)
|
||||
{
|
||||
lock = xSemaphoreCreateRecursiveMutex();
|
||||
memset(handles, 0, sizeof(xTaskHandle)*TASKINFO_RUNNING_NUMELEM);
|
||||
lastMonitorTime = 0;
|
||||
#if defined(DIAGNOSTICS)
|
||||
lastMonitorTime = portGET_RUN_TIME_COUNTER_VALUE();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a task handle with the library
|
||||
*/
|
||||
int32_t TaskMonitorAdd(TaskInfoRunningElem task, xTaskHandle handle)
|
||||
{
|
||||
if (task < TASKINFO_RUNNING_NUMELEM)
|
||||
{
|
||||
xSemaphoreTakeRecursive(lock, portMAX_DELAY);
|
||||
handles[task] = handle;
|
||||
xSemaphoreGiveRecursive(lock);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a task handle from the library
|
||||
*/
|
||||
int32_t TaskMonitorRemove(TaskInfoRunningElem task)
|
||||
{
|
||||
if (task < TASKINFO_RUNNING_NUMELEM)
|
||||
{
|
||||
xSemaphoreTakeRecursive(lock, portMAX_DELAY);
|
||||
handles[task] = 0;
|
||||
xSemaphoreGiveRecursive(lock);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the status of all tasks
|
||||
*/
|
||||
void TaskMonitorUpdateAll(void)
|
||||
{
|
||||
#if defined(DIAGNOSTICS)
|
||||
TaskInfoData data;
|
||||
int n;
|
||||
|
||||
// Lock
|
||||
xSemaphoreTakeRecursive(lock, portMAX_DELAY);
|
||||
|
||||
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
||||
uint32_t currentTime;
|
||||
uint32_t deltaTime;
|
||||
|
||||
/*
|
||||
* Calculate the amount of elapsed run time between the last time we
|
||||
* measured and now. Scale so that we can convert task run times
|
||||
* directly to percentages.
|
||||
*/
|
||||
currentTime = portGET_RUN_TIME_COUNTER_VALUE();
|
||||
deltaTime = ((currentTime - lastMonitorTime) / 100) ? : 1; /* avoid divide-by-zero if the interval is too small */
|
||||
lastMonitorTime = currentTime;
|
||||
#endif
|
||||
|
||||
// Update all task information
|
||||
for (n = 0; n < TASKINFO_RUNNING_NUMELEM; ++n)
|
||||
{
|
||||
if (handles[n] != 0)
|
||||
{
|
||||
data.Running[n] = TASKINFO_RUNNING_TRUE;
|
||||
#if defined(ARCH_POSIX) || defined(ARCH_WIN32)
|
||||
data.StackRemaining[n] = 10000;
|
||||
#else
|
||||
data.StackRemaining[n] = uxTaskGetStackHighWaterMark(handles[n]) * 4;
|
||||
#if ( configGENERATE_RUN_TIME_STATS == 1 )
|
||||
/* Generate run time stats */
|
||||
data.RunningTime[n] = uxTaskGetRunTime(handles[n]) / deltaTime;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
data.Running[n] = TASKINFO_RUNNING_FALSE;
|
||||
data.StackRemaining[n] = 0;
|
||||
data.RunningTime[n] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Update object
|
||||
TaskInfoSet(&data);
|
||||
|
||||
// Done
|
||||
xSemaphoreGiveRecursive(lock);
|
||||
#endif
|
||||
}
|
@ -101,7 +101,7 @@ void PIOS_Hsync_ISR() {
|
||||
//PIOS_LED_On(LED2);
|
||||
if(gLineType == LINE_TYPE_GRAPHICS)
|
||||
{
|
||||
for(int g=0;g<130;g++)
|
||||
for(int g=0;g<110;g++)
|
||||
{
|
||||
asm("nop");
|
||||
}
|
||||
@ -149,6 +149,7 @@ void PIOS_Vsync_ISR() {
|
||||
//PIOS_LED_Toggle(LED3);
|
||||
|
||||
//if(gActiveLine > 200)
|
||||
xHigherPriorityTaskWoken = pdFALSE;
|
||||
m_osdLines = gActiveLine;
|
||||
{
|
||||
gActiveLine = 0;
|
||||
@ -157,9 +158,10 @@ void PIOS_Vsync_ISR() {
|
||||
{
|
||||
swap_buffers();
|
||||
Vsync_update=0;
|
||||
xSemaphoreGiveFromISR(osdSemaphore, &xHigherPriorityTaskWoken);
|
||||
xHigherPriorityTaskWoken = xSemaphoreGiveFromISR(osdSemaphore, &xHigherPriorityTaskWoken);
|
||||
}
|
||||
}
|
||||
portEND_SWITCHING_ISR(xHigherPriorityTaskWoken); //portEND_SWITCHING_ISR(xHigherPriorityTaskWoken);
|
||||
}
|
||||
|
||||
uint16_t PIOS_Video_GetOSDLines(void) {
|
||||
@ -228,29 +230,14 @@ void PIOS_Video_Init(const struct pios_video_cfg * cfg){
|
||||
NVIC_Init(&cfg->level.dma.irq.init);
|
||||
NVIC_Init(&cfg->mask.dma.irq.init);
|
||||
|
||||
|
||||
|
||||
/* Enable SPI interrupts to DMA */
|
||||
SPI_I2S_DMACmd(cfg->level.regs, SPI_I2S_DMAReq_Tx, ENABLE);
|
||||
SPI_I2S_DMACmd(cfg->mask.regs, SPI_I2S_DMAReq_Tx, ENABLE);
|
||||
|
||||
/* Initialize the GPIO pins */
|
||||
//SYSCFG_EXTILineConfig(cfg->vsync.port_source, cfg->vsync.pin_source);
|
||||
//SYSCFG_EXTILineConfig(cfg->hsync.port_source, cfg->hsync.pin_source);
|
||||
|
||||
/* Configure Video Sync pin input floating */
|
||||
//GPIO_Init(cfg->vsync_io.gpio, (GPIO_InitTypeDef*)&(cfg->vsync_io.init));
|
||||
//GPIO_Init(cfg->hsync_io.gpio, (GPIO_InitTypeDef*)&(cfg->hsync_io.init));
|
||||
|
||||
/* Configure the Video Line interrupt */
|
||||
PIOS_EXTI_Init(cfg->hsync);
|
||||
PIOS_EXTI_Init(cfg->vsync);
|
||||
//EXTI_Init(&cfg->vsync.init);
|
||||
//EXTI_Init(&cfg->hsync.init);
|
||||
|
||||
/* Enable and set EXTI Interrupt to the lowest priority */
|
||||
//NVIC_Init(&cfg->vsync_irq.init);
|
||||
//NVIC_Init(&cfg->hsync_irq.init);
|
||||
|
||||
draw_buffer_level = buffer0_level;
|
||||
draw_buffer_mask = buffer0_mask;
|
||||
|
Loading…
x
Reference in New Issue
Block a user