aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* avr: Move prescaler and sleep initialization from timer.c to main.cKevin O'Connor2017-08-072-11/+21
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Enable watchdog code even on simulavrKevin O'Connor2017-08-071-1/+0
| | | | | | | | The simulavr simulator will warn when writing to the watchdog registers, but running code closer to what real hardware runs is worth a few extra warnings. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pwmcmds: Update event prototypes to use uint_fast8_tKevin O'Connor2017-08-061-2/+2
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Improve comments in pru0.cKevin O'Connor2017-08-022-3/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Allow boards to disable digital input/output supportKevin O'Connor2017-07-206-1/+17
| | | | | | | | Allow the micro-controller code to be built without support for regular gpio pins. In this case, the code for endstops, steppers, and gpiocmds will be disabled. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* basecmd: Move low-level alloc code into basecmd.cKevin O'Connor2017-07-206-90/+74
| | | | | | | | 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-1712-8/+97
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Move peripheral init from pru0 to pru1Kevin O'Connor2017-07-173-45/+37
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Move ADC code from gpio.c to new file adc.cKevin O'Connor2017-07-123-66/+78
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Fix readl() typo in serial.cKevin O'Connor2017-07-121-1/+1
| | | | | | The code should have used a readb() call instead of readl(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Add support for "make flash" ruleKevin O'Connor2017-07-051-0/+4
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* sched: Pass shutdown reason code via longjmp() parameterKevin O'Connor2017-07-041-5/+5
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Use a pointer when working with send_data array itemsKevin O'Connor2017-06-303-17/+14
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Add hack to shutdown the PRU from a simple command requestKevin O'Connor2017-06-301-0/+6
| | | | 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-306-93/+214
| | | | | | | | 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>
* sam3x8e: Integrate serial console functionsKevin O'Connor2017-06-291-48/+30
| | | | | | | | Now that console_get_input(), console_pop_input(), console_get_output() and console_push_output() are local functions, integrate them into their callers. This simplifies the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Integrate usb serial console functionsKevin O'Connor2017-06-291-32/+16
| | | | | | | | Now that console_get_input(), console_pop_input(), console_get_output() and console_push_output() are local functions, integrate them into their callers. This simplifies the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Integrate serial console functionsKevin O'Connor2017-06-291-47/+28
| | | | | | | | Now that console_get_input(), console_pop_input(), console_get_output() and console_push_output() are local functions, integrate them into their callers. This simplifies the code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Move low-level sendf transmission into board codeKevin O'Connor2017-06-298-40/+87
| | | | | | | | 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-298-39/+67
| | | | | | | | 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>
* sam3x8e: Use readl/writel instead of readb/writeb() in serial.cKevin O'Connor2017-06-221-12/+12
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Remove unnecessary barrier() callsKevin O'Connor2017-06-162-5/+0
| | | | | | The writel() call already implements a barrier() internally. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: Increase the step delay time from 1us to 2usKevin O'Connor2017-06-131-1/+1
| | | | | | | Increase the step delay time so that it works with the common DRV8825 stepper drivers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Enable CLEAR_PRESCALER by default on at90usb1286Kevin O'Connor2017-06-091-1/+1
| | | | | | | It appears this option is commonly needed on the at90usb1286 avr chip (the printrboard requires it), so default it on. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Support using serial instead of usb on AT90USB1286Kevin O'Connor2017-06-052-16/+28
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Allow atmega328 to select a cpu speed of 20MhzKevin O'Connor2017-05-291-1/+1
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Add SIMULAVR build option; don't show WATCHDOG or SERIAL_BAUD_U2XKevin O'Connor2017-05-281-3/+17
| | | | | | | | | | | Add a CONFIG_SIMULAVR option to the Kbuild menus and don't directly prompt users for CONFIG_WATCHDOG or CONFIG_SERIAL_BAUD_U2X. The only reason to disable these options would be if one were running on simulavr. This simplifies the user visible menu options. Also, only show CONFIG_CLEAR_PRESCALER for at90usb1286 chips. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Add support for atmega328 chipKevin O'Connor2017-05-282-3/+6
| | | | | | | | The atmega328 is basically the same as the atmega168 - it just adds some additional memory. Allow the chip to be selected during the build. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Reorder Kconfig entries so that atmega2560 at 16mhz is defaultKevin O'Connor2017-05-281-12/+13
| | | | | | | | | | | | | Reorder the MCU list so that newer chips are at the top of the list. This causes the very popular atmega2560 to be the default chip selected. Reorder the frequency list so that higher frequencies are at the top of the list. Restrict the 20Mhz frequency to only chips that support that speed. This causes the popular 16Mhz frequency to be the default speed on AVR. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Store the command parsing information directly in arrayKevin O'Connor2017-05-262-9/+4
| | | | | | | 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-2623-107/+54
| | | | | | | | 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-264-16/+17
| | | | | | | 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-264-45/+43
| | | | | | | | | | | | 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>
* pru: Add support for ADC inputKevin O'Connor2017-05-176-4/+156
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Move communication code to second PRUKevin O'Connor2017-05-175-137/+200
| | | | | | | Perform input and output in the second PRU so that more space is available in the primary PRU. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pru: Initial support for the Beaglebone PRUKevin O'Connor2017-05-1510-0/+643
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* irq: Add an irq_poll() stub for board codeKevin O'Connor2017-05-156-0/+17
| | | | | | | 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-152-2/+2
| | | | | | It's not necessary to use noinline for parsef() and stop_steppers(). Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepper: It is not necessary to ensure gpio_out_write value is 0 or 1Kevin O'Connor2017-05-151-2/+2
| | | | | | | | The gpio_out_write() and gpio_out_setup() calls will check for zero and non-zero, so it is not necessary to explicitly convert to 0/1 in the stepper.c code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* debugcmds: Move debugging commands from basecmd.c to new fileKevin O'Connor2017-05-153-91/+100
| | | | | | Move the implementation of debug commands to their own file. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Use "i" instead of "m" constraint in _DECL_REQUEST_IDKevin O'Connor2017-05-151-1/+1
| | | | | | | On some architectures, gcc will allocate a register for inline assembler with an "m" constraint. Use "i" to avoid that. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gpiocmds: Change MAX_SOFT_PWM from 255 to 256Kevin O'Connor2017-05-151-6/+5
| | | | | | | Change the range of values used for software PWM to avoid doing an integer division in the main code. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* pwmcmds: Export the maximum PWM valueKevin O'Connor2017-05-153-6/+11
| | | | | | | Instead of assuming the maximum PWM value is 255, export a constant from the firmware to the host with the maximum value. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* gpio: Fix off-by-one in declaration of ADC_MAXKevin O'Connor2017-05-152-2/+2
| | | | | | | The maximum value for the ADC is 1023 for 10bit samples and 4095 for 12bit samples. 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>
* build: Rename makefile CFLAGS-y to CFLAGS and LDFLAGS-y to CFLAGS_klipper.elfKevin O'Connor2017-05-152-8/+8
| | | | | | Rename some makefile variables. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>