Commit Graph

52 Commits

Author SHA1 Message Date
Lucas De Marchi 9aa49cda93 Global: remove system_initializing() from scheduler
This is not used anymore.
2016-02-12 23:42:34 -02:00
Lucas De Marchi 6d7678d2a3 AP_HAL_PX4: fix passing callback to member function
This is the same approach as done for AP_HAL_Linux in e3d78b8 ("AP_HAL_Linux:
fix passing callback to member function"). It fixes the following warnings:

ardupilot/libraries/AP_HAL_PX4/Scheduler.cpp: In member function 'virtual void PX4::PX4Scheduler::init(void*)':
ardupilot/libraries/AP_HAL_PX4/Scheduler.cpp:55:95: warning: converting from 'void* (PX4::PX4Scheduler::*)()' to 'pthread_startroutine_t {aka void* (*)(void*)}' [-Wpmf-conversions]
  pthread_create(&_timer_thread_ctx, &thread_attr, (pthread_startroutine_t)&PX4::PX4Scheduler::_timer_thread, this);
                                                                                               ^
ardupilot/libraries/AP_HAL_PX4/Scheduler.cpp:65:94: warning: converting from 'void* (PX4::PX4Scheduler::*)()' to 'pthread_startroutine_t {aka void* (*)(void*)}' [-Wpmf-conversions]
  pthread_create(&_uart_thread_ctx, &thread_attr, (pthread_startroutine_t)&PX4::PX4Scheduler::_uart_thread, this);
                                                                                              ^
ardupilot/libraries/AP_HAL_PX4/Scheduler.cpp:75:92: warning: converting from 'void* (PX4::PX4Scheduler::*)()' to 'pthread_startroutine_t {aka void* (*)(void*)}' [-Wpmf-conversions]
  pthread_create(&_io_thread_ctx, &thread_attr, (pthread_startroutine_t)&PX4::PX4Scheduler::_io_thread, this);
                                                                                            ^
ardupilot/libraries/AP_HAL_PX4/Scheduler.cpp:85:100: warning: converting from 'void* (PX4::PX4Scheduler::*)()' to 'pthread_startroutine_t {aka void* (*)(void*)}' [-Wpmf-conversions]
     pthread_create(&_storage_thread_ctx, &thread_attr, (pthread_startroutine_t)&PX4::PX4Scheduler::_storage_thread, this);

ardupilot/libraries/AP_HAL_PX4/NSHShellStream.cpp: In member function 'void PX4::NSHShellStream::start_shell()':
ardupilot/libraries/AP_HAL_PX4/NSHShellStream.cpp:83:99: warning: converting from 'void (PX4::NSHShellStream::*)()' to 'pthread_startroutine_t {aka void* (*)(void*)}' [-Wpmf-conversions]
     pthread_create(&shell_thread_ctx, &thread_attr, (pthread_startroutine_t)&PX4::NSHShellStream::shell_thread, this);
                                                                                                   ^
2015-12-03 07:51:08 +11:00
Lucas De Marchi 0c3733601b AP_HAL_PX4: use init() method without arguments
Override the init() method from parent class that doesn't have a
parameter since it's not used here.
2015-12-02 14:49:11 -02:00
Caio Marcelo de Oliveira Filho 1de0e0a5a6 AP_HAL_PX4: remove unused functions 2015-11-20 12:36:34 +09:00
Caio Marcelo de Oliveira Filho 8db8b9b355 AP_HAL_PX4: implement new AP_HAL functions
Implement the new AP_HAL functions and use them in the Scheduler when
possible.
2015-11-20 12:25:40 +09:00
Lucas De Marchi 1b07dabeb7 Replace prog_char and prog_char_t with char
prog_char and prog_char_t are now the same as char on supported
platforms. So, just change all places that use them and prefer char
instead.

AVR-specific places were not changed.
2015-10-30 14:35:30 +09:00
Lucas De Marchi 2c38e31c93 Remove use of PSTR
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.

This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.

AVR-specific places were not changed.
2015-10-30 14:35:04 +09:00
Lucas De Marchi f791767fb2 AP_HAL_PX4: Scheduler: implement variadic version of panic() 2015-10-24 14:26:36 +11:00
Lucas De Marchi ad61a93c14 AP_HAL: turn panic() into a variadic method
Change the declaration on all HAL implementations so panic() in future
may implement a printf-like interface.
2015-10-24 14:26:35 +11:00
Gustavo Jose de Sousa 08333f1ffe AP_HAL_PX4: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:28:43 +10:00
Andrew Tridgell 333778bac1 HAL_PX4: updates for upstream merge 2015-06-09 19:44:20 +10:00
Andrew Tridgell 43fb1202f2 HAL_PX4: fixed functor comparison with NULL 2015-05-26 13:54:38 +10:00
Andrew Tridgell 086f878bdc HAL_PX4: split IO thread into separate IO and storage threads
this prevents a blocked microSD card from blocking IO to the FRAM,
causing parameter changes not to be sticky
2015-03-04 20:18:17 +11:00
Andrew Tridgell 18131eae13 HAL_PX4: added delay_microseconds_boost()
implemented using hrt callback with sem_post wrapper
2015-02-16 12:19:13 +11:00
Andrew Tridgell 001643d5a3 HAL_PX4: always use the hrt semaphore based delay
the up_udelay() could cause too much timing jitter
2015-02-14 12:25:43 +11:00
Andrew Tridgell 48247b6adc HAL_PX4: minimise usage of hrt_absolute_time() 2014-08-20 09:10:24 +10:00
Andrew Tridgell 1241da466b HAL_PX4: added millis64() and micros64() 2014-08-20 08:01:06 +10:00
Andrew Tridgell 849c4905fb HAL_PX4: print overtime message on stuck task
this should make it easier to narrow down stuck task bugs
2014-07-03 09:11:24 +10:00
Andrew Tridgell bf2dd141e9 HAL_PX4: support uartE for 2nd GPS 2014-02-26 08:18:11 +11:00
Andrew Tridgell 0b25ff0a16 HAL_PX4: added uartD 2013-11-23 19:29:22 +11:00
Andrew Tridgell 8dc6b758f3 HAL_PX4: switch to delay_microseconds_semaphore() for UART timer
this may prevent some timing jitter on the GPS UARTs
2013-11-05 14:41:24 +11:00
Andrew Tridgell 5800c2a2c8 HAL_PX4: prevent excessive writes on startup from blocking
this could cause copter on PX4 to hang on startup
2013-10-28 16:12:44 +11:00
Andrew Tridgell 622f0dcc1d HAL_PX4: prevent threads running before subsystems are initialised
this fixes a bug where the timer thread would hang waiting for the
console on startup. This caused the "hit enter" behaviour with recent
PX4 bugs, as AnalogIn tried to read from fd==0, which was a console
read
2013-10-26 18:12:35 +11:00
Andrew Tridgell 1c091cbca5 HAL_PX4: fixed a scheduler bug that affects UART IO
we need to detect if we are in a timer task using a PID, not a
flag. This is the same type of bug I fixed last week, but now fixed
properly.

The bug could well be the "USB bug" that Craig has been chasing
2013-10-19 16:50:38 +11:00
Andrew Tridgell d973730b88 HAL_PX4: use hrt timer and semaphores to improve timing
this gives much more accurate microsecond delays, while also ensuring
we yield the CPU when possible
2013-10-14 08:29:30 +11:00
Andrew Tridgell 63bee0b2d8 HAL_PX4: disable checks for in_timerprocess
these are not valid in this form for the way the timer thread works on
PX4.
2013-10-11 16:06:35 +11:00
Andrew Tridgell 67db1cedaa HAL_PX4: fixed delay_microseconds() on PX4
we could underflow and delay a very long time!
2013-10-08 17:31:15 +11:00
Andrew Tridgell 942ae70651 HAL_PX4: updates for AP_HAL::MemberProc 2013-09-30 21:06:42 +10:00
Andrew Tridgell 7ec242146d HAL_PX4: update for new scheduler API 2013-09-28 21:24:03 +10:00
Andrew Tridgell fb56feb6b2 HAL_PX4: support all analog input pins, with scaling
this allows voltage/current/Vcc sensing on FMUv2
2013-09-12 13:26:00 +10:00
Andrew Tridgell fa107bdb58 PX4: moved UART handling to its own thread
this prevents slow writes to the SD card from interfering with MAVLink
or GPS serial communication
2013-09-04 13:15:27 +10:00
Andrew Tridgell 7082e0f8aa AP_HAL: added hold_in_bootloader parameter to scheduler->reboot() 2013-09-04 11:58:13 +10:00
Andrew Tridgell e5f19e314d PX4: systemreset() now takes a boolean argument
this chooses whether to stay in the bootloader
2013-08-30 13:01:33 +10:00
Julian Oes 56e94d70e9 PX4: Adaptations to latest build changes 2013-08-30 13:01:32 +10:00
Andrew Tridgell af7381e9e0 AP_HAL: added register_io_process()
this is used to register a low priority IO task. Used for file IO in
DataFlash_File.cpp
2013-04-17 21:33:50 +10:00
Andrew Tridgell 8e2a20bea8 HAL_PX4: enable ttyACM0 as main console, ttyS1 as telemetry port 2013-02-18 13:55:33 +11:00
Andrew Tridgell 02b4ecc273 HAL_PX4: get RC input from PX4IO board
this allows us to support DSM and SBUS receivers
2013-01-27 12:52:14 +11:00
Andrew Tridgell 8f2f4b1bc5 HAL_PX4: use write() to /dev/pwm_output for servo output
this lowest the cost of PWM output a lot, but relies on the new I2C
based IO firmware
2013-01-25 20:44:36 +11:00
Andrew Tridgell 70227d5d93 HAL_PX4: added scheduler performance counters 2013-01-24 15:04:57 +11:00
Andrew Tridgell 966b9b9b9c HAL_PX4: format panic messages with a newline 2013-01-23 16:54:44 +11:00
Andrew Tridgell 952df2fced HAL_PX4: new buffered storeage driver for microsd cards
this does all IO in the timer thread, avoids writes that don't change
data, and does all writes in multiples of 128 byte chunks. This should
be about as friendly to SD cards as we can get.
2013-01-23 16:37:40 +11:00
Andrew Tridgell 2a10727902 HAL_PX4: run timer thread as SCHED_FIFO
this ensures it never yields to the main thread, which would break our
locking assumptions
2013-01-23 09:21:50 +11:00
Andrew Tridgell 6ffa18fa61 HAL_PX4: rewrite UART driver to be much more efficient
this does the IO in the timer thread, and uses buffers in the main
task to avoid system call costs in the flight code.

The cost of PX4 read and write system calls is quite high - about 10
to 15 usec. We can't afford to pay that per byte
2013-01-22 21:22:01 +11:00
Andrew Tridgell 39e28d48c2 HAL_PX4: switched scheduler to use a pthread
this allows the timer tasks to access file descriptors in the main APM
task, which makes writing PX4 device drivers much easier
2013-01-21 13:54:09 +11:00
Andrew Tridgell 7c7a215934 HAL_PX4: fixes for new Scheduler API 2013-01-11 12:25:26 +11:00
Andrew Tridgell 5829d44a22 HAL_PX4: disable failsafe handler
this won't work until we can set RC output values in timers
2013-01-04 22:26:16 +11:00
Andrew Tridgell 9f423a24ad HAL_PX4: yield CPU in delay()
this allows other apps to run
2013-01-04 12:34:35 +11:00
Andrew Tridgell 1e69b88261 HAL_PX4: use write() in panic()
this allows panic from the UARTDriver
2013-01-03 21:11:37 +11:00
Andrew Tridgell b30fa6535b HAL_PX4: support reboot 2013-01-03 19:34:36 +11:00
Andrew Tridgell c6305b5876 HAL_PX4: rework Scheduler using hrt calls
thanks to Julian Oes for the suggestion
2013-01-03 13:15:57 +11:00