aboutsummaryrefslogtreecommitdiffstats
path: root/src/avr/serial.c
Commit message (Collapse)AuthorAgeFilesLines
* avr: Use enumerations for buses and reserve pinsKevin O'Connor2019-04-041-0/+16
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr: Clean up serial port register aliasesKevin O'Connor2018-04-251-31/+34
| | | | | | | | Define unique register aliases for all of the hardware serial port definitions. This makes it easier to deal with the AVR chips that use different register names. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serial_irq: Add new generic/serial_irq.c codeKevin O'Connor2018-04-201-110/+9
| | | | | | | Extract out common code from avr/serial.c, sam3x8e/serial.c, and stm32f1/serial.c into a new generic/serial_irq.c file. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: Don't pass max_size to command_encodef()Kevin O'Connor2017-08-141-3/+3
| | | | | | | | | 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>
* sched: Introduce sched_wake_tasks() function to wake up tasksKevin O'Connor2017-08-081-0/+3
| | | | | | | | 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>
* 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>
* 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-291-3/+17
| | | | | | | | 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-2/+16
| | | | | | | | 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>
* avr: Support using serial instead of usb on AT90USB1286Kevin O'Connor2017-06-051-15/+27
| | | | Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* build: Use compile_time_request system for init, tasks, and shutdownKevin O'Connor2017-05-261-1/+1
| | | | | | | | 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>
* avr: Remove F_CPU compile time definitionKevin O'Connor2017-03-301-2/+4
| | | | | | | | Directly use the Kconfig defined CONFIG_CLOCK_FREQ in the code and avoid defining F_CPU. Also, remove the unnecessary O2 option - that is already the default from the main makefile. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* io.h: read/write[bwl] should use barrierKevin O'Connor2017-02-021-3/+0
| | | | | | | Add barrier() calls to low-level read/write io calls so that their callers don't need to. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serial: Be careful with comparison of transmit_max to transmit_posKevin O'Connor2017-01-141-1/+1
| | | | | | | | There is a small possibility that a shutdown could occur between clearing transmit_max and clearing transmit_pos - so make sure to handle the case where transmit_pos > transmit_max. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* command: No need to disable irqs in sendf reentrant checkKevin O'Connor2017-01-141-0/+1
| | | | | | | | | 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>
* build: Define DECL_CONSTANT mechanism for defining exported constantsKevin O'Connor2016-12-231-0/+3
| | | | | | | | | Add a DECL_CONSTANT macro to allow the firmware to define constants that are to be exported to the host during the "identify" phase. This replaces the existing hardcoded mechanism of scanning the Kconfig header file for certain constants. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* serial: Increase AVR serial receive bufferKevin O'Connor2016-10-181-3/+2
| | | | | | | | Increase the size of the serial receive buffer. With transmit rates of 250000 baud, it only takes a little over a millisecond to overflow the existing buffer. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* avr/serial: Separate out low-level hardware manipulation to its own functionKevin O'Connor2016-06-141-3/+9
| | | | | | | Introduce enable_tx_irq() for manipulating the AVR hardware. This keeps the low-level hardware code together. 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-1/+1
| | | | | | | | 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>
* generic: Add new file generic/io.h and move read/writeb() to itKevin O'Connor2016-06-131-0/+1
| | | | | | | | Move the definitions of the readb() style functions to a new header generic/io.h. This eliminates the dependency of stdint.h on compiler.h. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* generic: Create generic board infrastructure and move misc.h to itKevin O'Connor2016-06-131-1/+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/+137
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>