aboutsummaryrefslogtreecommitdiffstats
path: root/src/basecmd.c
Commit message (Collapse)AuthorAgeFilesLines
* stepper: Use a reusable interface to the "move queue"Kevin O'Connor2020-12-041-12/+55
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* basecmd: Change "move queue empty" error to "move queue overflow"Kevin O'Connor2020-12-041-1/+1
| | | | | | Use a more clear error message. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* basecmd: No need for finalize_config command to send "config" responseKevin O'Connor2020-02-201-2/+1
| | | | | | | | The host code always issues a get_config command immediately after finalize_config, so there is no need to send the two config response messages. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* spicmds: Rework spi config commandsKevin O'Connor2019-08-061-1/+1
| | | | | | | | | | Rework the spi_config commands so that bus configuration and shutdown message configuration is done separately from the main "config_spi" command. This makes the spi configuration more flexible. It's now possible to use software spi without a CS pin. It's now possible to define multiple SPI messages to send on a shutdown event. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Always pass a string to the DECL_CONSTANT() macroKevin O'Connor2019-03-171-1/+1
| | | | | | | | Make it clear that the name of the constant being defined is a string. When the value being defined is also a string, use a new DECL_CONSTANT_STR() macro. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* basecmd: Rename get_status to get_clockKevin O'Connor2018-05-291-3/+3
| | | | | | | | | | | | Change the get_status command to get_clock. Don't report the shutdown status in the new get_clock command. The primary purpose of this change is to force the host code to report a firmware version mismatch with older firmwares as recent changes (namely the ordering of message block acks) have subtle incompatibilities if different host/mcu code is used. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Do not automatically restart MCU with new config if it is shutdownKevin O'Connor2018-05-291-2/+2
| | | | | | | Normally, the MCU is restarted on a config change. However, that should not be done automatically if the MCU is in a shutdown state. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* mcu: Provide some further help on common MCU shutdown errorsKevin O'Connor2017-09-051-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Support config_reset command to manually reset mcuKevin O'Connor2017-09-031-0/+19
| | | | | | | Add support for resetting the MCU via a software only mechanism. This is useful on the PRU. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Implement generic sleep mechanism based on tasks pendingKevin O'Connor2017-08-081-18/+6
| | | | | | | | | Track when tasks are pending and spin in irq_wait() when no tasks are pending. This improves the mechanism for sleeping the processor - it's simpler for the board specific code and it reduces the possibility of the processor sleeping when tasks are busy. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* basecmd: Move low-level alloc code into basecmd.cKevin O'Connor2017-07-201-5/+45
| | | | | | | | Implement new dynmem_start() and dynmem_end() functions instead of alloc_chunk() and alloc_chunks() in the board code. This simplifies the board code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* irq: Support sleeping when mcu is idleKevin O'Connor2017-07-171-4/+14
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Use compile_time_request system for init, tasks, and shutdownKevin O'Connor2017-05-261-2/+2
| | | | | | | | Avoid using linker magic to define the init, task, and shutdown functions. Instead, use the compile_time_request system. This simplifies the build and produces more efficient code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Allow shutdown_reason to be uint8Kevin O'Connor2017-05-261-0/+1
| | | | | | | Store the shutdown_reason code in an 8-bit integer - this produces better code on AVR. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* debugcmds: Move debugging commands from basecmd.c to new fileKevin O'Connor2017-05-151-90/+0
| | | | | | Move the implementation of debug commands to their own file. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* basecmd: Avoid calling malloc() from main codeKevin O'Connor2017-05-111-23/+7
| | | | | | | | Introduce a new board function alloc_chunk() to allocate dynamic memory. This allows the board code to implement memory allocations without using the standard malloc() interface. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* basecmd: Add debugging commands for testing communicationKevin O'Connor2017-04-231-0/+15
| | | | | | Add "debug_ping" and "debug_nop" testing commands. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* timer: Allow board code to define its own timer_is_before implementationKevin O'Connor2017-03-261-4/+4
| | | | | | | | | | | | Move sched_is_before() from sched.c to timer_is_before() in the board specific timer code. This allows the board code to provide its own definition. Also, remove the sched_from_us() and sched_read_time() wrapper functions and change the callers to directly invoke timer_from_us() / timer_read_time(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Rename sched_timer() to sched_add_timer()Kevin O'Connor2017-03-111-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* basecmd: Remove unimplemented command_reset()Kevin O'Connor2017-03-091-7/+0
| | | | | | | It's better to not have the unimplemented command defined so that the host can detect when it is actually implemented. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* basecmd: Use oid_ prefix for the oid manipulation functionsKevin O'Connor2017-03-091-11/+11
| | | | | | | Consistently use an "oid_" prefix on the oid functions - this makes them similar to other functions with a common prefix. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* basecmd: Generalize the "move queue" runtime storageKevin O'Connor2017-03-081-25/+66
| | | | | | | | | Detect the maximum size of each "move queue" item during the configuration phase instead of using the stepper move struct. This allows the stepper code to be contained entirely in stepper.c and it allows for future run time allocations from other types of objects. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serialhdl: Load the mcu's 64bit clock at start of connectionKevin O'Connor2017-03-031-4/+16
| | | | | | | | Store a full 64bit uptime in the mcu and query it at the start of each connection. This ensures the host's 64bit clock is always in synch with the mcu's clock. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Minor change - remove unneeded header filesKevin O'Connor2017-01-141-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* basecmd: Improve accuracy of stats "sumsq" variableKevin O'Connor2017-01-091-2/+13
| | | | | | | | | | | | Use a base of 256 instead of 65536 when calculating the sum of the square of the clock differences in the stats. This makes the calculation more accurate. Export the new base via DECL_CONSTANT for the host to access. Use DIV_ROUND_UP() when adjusting for the base to ensure no lost ticks. Do the division after multiplication in the common case where the time between stats_task() invocations is less than 64K ticks. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Use uint_fast8_t for return type of timersKevin O'Connor2016-06-141-1/+1
| | | | | | | | Some architectures are faster passing regular integers than 8bit integers. Use uint_fast8_t so that the architecture chooses the appropriate type. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* irq: Allow boards to define the return type of irq_save()Kevin O'Connor2016-06-131-3/+3
| | | | | | | | The AVR wants a uint8_t return type for irq_save(), but other architectures will generally prefer int. Allow the board to configure the size of the flag by introducing an irqstatus_t typedef. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Change sched_from_ms() to sched_from_us()Kevin O'Connor2016-06-021-1/+1
| | | | | | | Some code may require micro-second precision so update sched_from_ms() to use micro-seconds. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Initial commit of source code.Kevin O'Connor2016-05-251-0/+301
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>