aboutsummaryrefslogtreecommitdiffstats
path: root/src/command.c
Commit message (Collapse)AuthorAgeFilesLines
* command: Wait to send ack until after processing commandsKevin O'Connor2018-05-281-2/+10
| | | | | | | Send the ack after processing commands - this gives the host code more information on serial buffer utilization. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Add command_find_and_dispatch() helperKevin O'Connor2018-05-281-0/+11
| | | | | | | Add a helper function that calls command_find_block() followed by command_dispatch(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Add a command_encode_and_frame() helperKevin O'Connor2018-05-281-0/+10
| | | | | | | Add a helper function that calls command_encodef() followed by command_add_frame(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Prefer uint8_t* for buffers; prefer uint8_fast_t for lengthsKevin O'Connor2018-05-281-31/+30
| | | | | | | | | Prefer using 'uint8_t' buffers as it is too easy to run into C sign extension problems with 'char' buffers. Prefer using 'uint_fast8_t' for buffer lengths as gcc does a better job compiling them on 32bit mcus. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* linux: Initial support for running Klipper in a Linux real-time processKevin O'Connor2017-09-201-1/+0
| | | | | | | Add support for compiling the Klipper micro-controller code as a real-time process capable of running on standard Linux systems. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Don't pass max_size to command_encodef()Kevin O'Connor2017-08-141-5/+5
| | | | | | | | | The command_encodef() can read the max_size parameter directly from the 'struct command_encoder' passed into it. Also, there is no need to check that a message will fit in a buffer if the buffer is declared to be MESSAGE_MAX in size. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* docs: Update Code_Overview.md with PRU and command_dispatch() changesKevin O'Connor2017-08-111-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Introduce sched_wake_tasks() function to wake up tasksKevin O'Connor2017-08-081-1/+1
| | | | | | | | Add function to indicate when tasks need to be run. This will allow the scheduler code to know if there are any tasks that need to be processed. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Rework command processing so that most of it is done on pru0Kevin O'Connor2017-06-301-16/+4
| | | | | | | | Change the command dispatch and response generation so that most of the work is done on pru0 instead of pru1. This allows more code to fit into the limited space on pru1. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Directly call command_sendf() for ack/nak messagesKevin O'Connor2017-06-291-2/+7
| | | | | | | Don't use the sendf() macro for ack and nak messages - directly call the command_sendf() code instead. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Move low-level sendf transmission into board codeKevin O'Connor2017-06-291-11/+5
| | | | | | | | Export a new console_sendf() function from the board code instead of console_get_output() and console_push_output(). This enables more flexibility in how the board specific code produces output. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Move command_task() to board specific codeKevin O'Connor2017-06-291-16/+2
| | | | | | | | Move the command_task() code from the generic code to the board specific code. This enables more flexibility in how the board specific code processes input. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Encode MESSAGE_MIN in command_parser->max_sizeKevin O'Connor2017-06-291-1/+1
| | | | | | | Add the message minimum into the stored constant so it does not need to be added at run-time. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Refactor message block generationKevin O'Connor2017-06-291-70/+84
| | | | | | | Separate out the buffer management, message encoding, and message framing code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Refactor the command reading taskKevin O'Connor2017-06-291-34/+38
| | | | | | | Refactor the code so that message block framing, command parsing, and command dispatch are distinct. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Store the command parsing information directly in arrayKevin O'Connor2017-05-261-8/+3
| | | | | | | Instead of defining an array of pointers, just define the array directly. 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-1/+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>
* build: Avoid linker magic in compile_time_request.c unique id generationKevin O'Connor2017-05-261-7/+6
| | | | | | | | | | | | Avoid generating unique ids via memory locations and linker scripts. Instead, generate them using code produced by buildcommands.py. Utilize gcc's ability to perform static string comparisons at compile time to produce a unique id for each unique string. This fixes a build failure on ARM introduced in 142b92b8. It also reduces the complexity of the build. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* irq: Add an irq_poll() stub for board codeKevin O'Connor2017-05-151-0/+2
| | | | | | | Allow the board specific code to run checks prior to running each task. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Avoid using noinline in common codeKevin O'Connor2017-05-151-1/+1
| | | | | | It's not necessary to use noinline for parsef() and stop_steppers(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Only implement 16bit signed conversion on AVRKevin O'Connor2017-05-151-1/+1
| | | | | | | On regular 32bit machines there is no need to implement explicit signed conversion on 16bit integers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Simplify sendf() switchKevin O'Connor2017-03-261-9/+10
| | | | | | | | Commit f28eb902 reworked the switch to fix int16 encoding. However, at least one version of avr gcc doesn't like that switch layout (it uses a jump table). Reorg the switch to avoid that issue. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Fix encoding of 16bit signed integersKevin O'Connor2017-03-241-7/+9
| | | | | | | The code wasn't properly sign-extending 16bit integers which caused int16_t reports in output() to appear as uint16_t. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: No need to disable irqs in sendf reentrant checkKevin O'Connor2017-01-141-14/+14
| | | | | | | | | As long as the code is careful when writing the in_sendf variable it should be safe to update it without having to disable irqs. Also, make sure in_sendf is cleared on shutdown. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Check for reentrant calls to sendf()Kevin O'Connor2017-01-131-1/+14
| | | | | | | | | Allow sendf() to be called from irq and timer context - check for the case where sendf() is called while already in sendf() and simply discard those messages. This makes it safe to use output() debugging calls even in irq and timer context. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* generic: Create generic board infrastructure and move misc.h to itKevin O'Connor2016-06-131-18/+1
| | | | | | | Instead of creating a misc.h file in each board directory, create a generic board directory and declare misc.h there. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* Initial commit of source code.Kevin O'Connor2016-05-251-0/+315
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>