summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/video'Sascha Hauer2016-07-116-0/+279
|\
| * video/edid: Move int_sqrt() outAndrey Smirnov2016-06-302-0/+47
| | | | | | | | | | | | | | | | Move int_sqrt() out of drivers/video/edid.c so that it is availible to other parts of Barebox. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * GUI: Add code to draw simple graphicsAndrey Smirnov2016-06-303-0/+203
| | | | | | | | | | | | | | | | Add code to draw simple graphics, namely lines(solid or dashed) and circles. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * GUI: Add a function to draw vertical/horizontal barsAndrey Smirnov2016-06-301-0/+29
| | | | | | | | | | | | | | Add a function to draw solid vertical or horizontal bars. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/state'Sascha Hauer2016-07-111-1/+1
|\ \
| * | libfile: Change write_full to be have const bufMarkus Pargmann2016-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | write() uses a const pointer so write_full should do the same. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/nvdevvars'Sascha Hauer2016-07-111-0/+3
|\ \ \ | |/ / |/| |
| * | Introduce non volatile device variablesSascha Hauer2016-07-061-0/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Non volatile device variables are used to make device parameters persistent. They are like normal non volatile variables, but set the values of the device parameters with the corresponding name. Every nv variable beginning with nv.dev is a non volatile device variable. They have the form nv.dev.<devname>.<paramname> and act on the parameter <paramname> of the device named <devname>. The non volatile device variables are designated for example for video modes, ethernet device ip addresses or mtd partitioning. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / vsprintf: fix handling of strp arg in asprintfEnrico Jorns2016-07-071-2/+1
|/ | | | | | | | strp argument was ignored but should be forwarded to vasprintf() call in order to make this funktion work as expected. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubiformat: Fix formatting devices with unreadable areasSascha Hauer2016-05-201-2/+7
| | | | | | | | | When parts of a Nand device are not readable due to excessive bit flips we should not bail out with an error as this means we can never repair the device by flashing a fresh image using ubiformat. Instead, treat a failed read as a corrupt block and ignore the read failure. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubiformat: Ignore bitflip errorsSascha Hauer2016-05-201-1/+1
| | | | | | | | | Fixes: 1d88c66 ubiformat: Use mtd-peb API bit flips are no error, when encountering them during scanning of a device just ignore them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2016-05-093-13/+4
|\
| * whole tree: remove trailing whitespacesDu Huanpeng2016-04-212-3/+3
| | | | | | | | | | Signed-off-by: Du Huanpeng <u74147@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * NULL: keep NULL definition in stddef.h onlyDu Huanpeng2016-04-141-10/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | remove other local definition of NULL, use #include <linux/stddef.h> instead. I use this command to search NULL definition, grep -R "define\s*\<NULL\>" hope there are no more definition of NULL. from ISO/IEC 9899:TC3: The macros are NULL which expands to an implementation-defined null pointer constant; Signed-off-by: Du Huanpeng <u74147@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/include-cleanup'Sascha Hauer2016-05-0912-26/+92
|\ \
| * | stdio: rename getc to getcharSascha Hauer2016-04-152-5/+5
| | | | | | | | | | | | | | | | | | | | | The function we have implemented as getc has the semantics of the standard function getchar, so rename it accorgingly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | move unlink_recursive declaration to libfile.hSascha Hauer2016-04-151-0/+1
| | | | | | | | | | | | | | | | | | | | | unlink_recursive is a file utility function, so move the prototype to libfile.h Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | move make_directory declaration to libfile.hSascha Hauer2016-04-151-0/+1
| | | | | | | | | | | | | | | | | | | | | As a utility function for file handling make_directory() is well suited for libfile. Move it there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | string: Fix (v)asprintf prototypesSascha Hauer2016-04-157-19/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our asprintf and vasprintf have different prototypes than the glibc functions. This causes trouble when we want to share barebox code with userspace code. Change the prototypes for (v)asprintf to match the glibc prototypes. Since the current (v)asprintf are convenient to use change the existing functions to b(v)asprintf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | show_progress: print spaces with %*sSascha Hauer2016-04-151-2/+1
| | | | | | | | | | | | | | | | | | | | | Removes the need for include/linux/stringify.h in the progress bar code. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | libfile: move open_and_lseek() to libfileSascha Hauer2016-04-151-0/+32
| |/ | | | | | | | | | | | | libfile is a collection of helpers for handling files. open_and_lseek() is a perfect match for this, so move it there. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | parameter: Use strtoboolSascha Hauer2016-05-041-4/+8
| | | | | | | | | | | | Use strtobool to convert the input string to a boolean type. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | string: Introduce strtoboolSascha Hauer2016-04-291-0/+43
|/ | | | | | | | | | | | | | | | We have at least two places which convert a string to a boolean type, so create a common function for this. strtobool treats - any positive (nonzero) number as true - "0" as false - "true" (case insensitive) as true - "false" (case insensitive) as false Every other value results in an error and the input *val is not modified. The caller is expected to initialize *val with the correct default before calling strtobool. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* lib: declared buffer is too small to hold stringRenaud Barbier2016-04-121-1/+1
| | | | | | | | | | Displaying an unsigned 64-bit integer can be represented by up to 20 characters. The 20 bytes buffer reserved to store the formatted string "%llu Bytes" is to small: (20 + 6) = 26. Hence, a bigger buffer is reserved to hold this string. Signed-off-by: Renaud Barbier <renaud.barbier@ge.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Add list_sort from u-boot v2016.03Alexander Stein2016-04-082-0/+297
| | | | | | | This is required by UBIFS update. Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rbtree: Update to u-boot v2016.03Alexander Stein2016-04-081-265/+430
| | | | | | | | | | This adds (among others) rbtree_postorder_for_each_entry_safe which is required by the upcoming UBIFS update. Changes to u-boot source: * Adding include <module.h> for EXPORT_SYMBOL* Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* decompressors: Use malloc/free wrappersSascha Hauer2016-04-089-37/+48
| | | | | | | | | | The decompressors are used both in a regular image and also for image decompression. Both need different malloc implementations. Using malloc/free directly in the decompressor code easily leads to include file conflicts, so use MALLOC/FREE which can be defined correctly for the two different usecases. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* remove now unused libmtdSascha Hauer2016-04-063-372/+0
| | | | | | | The only user of libmtd was ubiformat which now uses the mtd-peb API, so remove the now unused libmtd. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ubiformat: Use mtd-peb APISascha Hauer2016-04-062-30/+21
| | | | | | | | This changes ubiformat from the libmtd API to the mtd-peb API. This makes the libmtd API unnecessary and it can be removed in the next step. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: rename mtd_all_ff -> mtd_buf_all_ffSascha Hauer2016-03-151-1/+1
| | | | | | | To make clear this function checks a given buffer and not data on a mtd device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* process_escape_sequence: add support for \uPhilipp Zabel2016-02-171-0/+6
| | | | | | | | Expand the \u escape sequence to the user currently set in the $global.user variable. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/ratp'Sascha Hauer2016-02-084-0/+1851
|\
| * barebox remote controlSascha Hauer2016-01-181-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the ability to control barebox over serial lines. The regular console is designed for human input and is unsuitable for controlling barebox from scripts since characters can be lost on both ends, the data stream contains escape sequences and the prompt cannot be easily matched upon. This approach is based on the RATP protocol. RATP packages start with a binary 0x01 which does not occur in normal console data. Whenever a 0x01 character is detected in the console barebox goes into RATP mode. The RATP packets contain a simple structure with a command/respone type and data for that type. Currently defined types are: BB_RATP_TYPE_COMMAND (host->barebox): Execute a command in the shell BB_RATP_TYPE_COMMAND_RETURN (barebox->host) Sends return value of the command back to the host, also means barebox is ready for the next command BB_RATP_TYPE_CONSOLEMSG (barebox->host) Console message from barebox Planned but not yet implemented are: BB_RATP_TYPE_PING (host->barebox) BB_RATP_TYPE_PONG (barebox->host) For testing purposes BB_RATP_TYPE_GETENV (host->barebox) BB_RATP_TYPE_GETENV_RETURN (barebox->host) Get values of environment variables Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Tested-by: Andrey Smirnov <andrew.smirnov@gmail.com>
| * Add Reliable Asynchronous Transfer ProtocolSascha Hauer2016-01-183-0/+1843
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for Reliable Asynchronous Transfer Protocol (RATP) as described in RFC916. Communication over RS232 is often unreliable as characters are lost or misinterpreted. This protocol allows for a reliable packet based communication over serial lines. The implementation simply follows the state machine described in the RFC text with one exception. RFC916 uses a plain checksum for the transferred data. We decided to use CRC16 for greater robustness. Since this is the only RFC916 implementation we currently know of interoperability with other implementations should not matter. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Tested-by: Andrey Smirnov <andrew.smirnov@gmail.com>
* | vsprintf: Add support for %paSascha Hauer2016-01-151-0/+27
| | | | | | | | | | | | | | Add support for the %pa format specifier to print phys_addr_t, dma_addr_t and resource_size_t. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/pstore'Sascha Hauer2016-01-117-0/+728
|\ \
| * | lib: Import reed solomon code from kernelMarkus Pargmann2015-12-106-0/+704
| | | | | | | | | | | | | | | | | | | | | | | | reed solomon code is used by RAMOOPS to check and fix data stored in volatile memory. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | vsprintf: Add scnprintf from kernelMarkus Pargmann2015-12-101-0/+24
| |/ | | | | | | | | Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2016-01-113-5/+6
|\ \
| * | readline: Fix potential buffer overflow in command historySascha Hauer2016-01-081-1/+2
| | | | | | | | | | | | | | | | | | | | | Cursor up copies the last line into the buffer without checking if it fits into the current buffer. Fix this using safe_strncpy. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | readline: Fix potential buffer overflowSascha Hauer2016-01-081-1/+1
| | | | | | | | | | | | | | | | | | | | | cread_add_char doesn't take the trailing '\0' into account, so adding it at the end of readline can overflow the buffer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | bootstrap: constify stringsTrent Piepho2016-01-082-3/+3
| |/ | | | | | | | | | | | | Various parameters for device names, etc. should be const strings. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / bootstrap: Boot barebox with kernel calling conventionTrent Piepho2015-12-141-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | In commit 8e3ddc13eb8239177ed20f119e3a3d02518b941d the bootm code was changed to boot barebox using the same calling convention as the kernel. Which on ARM is to pass three arguments which are zero, an architecture code, and a params pointer. A 2nd stage barebox can be booted using lib/bootstrap, which is different code from bootm. This code just leaves garbage in the first three parameters and so doesn't follow the convention. Change it to be compatible with the ARM kernel booting convention. This just sends a zero for the architecture, since the code for architectures depends on boot[zmu] and something using bootstrap wouldn't have those too. And it just passes NULL for the params since we don't have a way to pass a device tree from the preloader. All users of bootstrap are ARM based, but the code is in lib so a non-ARM board might someday make use of it. If the current code would work for them, then the change here will be ok too. Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2015-12-082-1/+12
|\
| * make_directory: fix warning: no previous prototypeSergey Koshechkin2015-11-181-1/+4
| | | | | | | | | | Signed-off-by: Sergey Koshechkin <serge.koshechkin@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * lib: readline support ctrl-l to clear screenDu Huanpeng2015-11-171-0/+8
| | | | | | | | | | | | | | | | maybe it is easier to press ctrl-l to clear the screen than type 'clear' command. Signed-off-by: Du Huanpeng <u74147@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/imx'Sascha Hauer2015-12-081-0/+4
|\ \
| * | graphics_utils: check for valid framebuffer before creating a screenSascha Hauer2015-11-131-0/+4
| |/ | | | | | | | | | | Otherwise we crash later when we try to print on that screen. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | font: fbconsole: add custom font supportsDu Huanpeng2015-11-234-0/+79
| | | | | | | | | | Signed-off-by: Du Huanpeng <u74147@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | fbconsole: register fonts dynamicallySascha Hauer2015-11-134-33/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of having a fixed array of fonts register the fonts dynamically. This allows easier adding of fonts to the tree since only one file per font has to be added and no other files modified. Currently we have to register the fonts very early before the first framebuffer is registered. This is because of our limited dev_add_param_enum() which wants to know the number of elements when called, so we can't add elements once after we've called dev_add_param_enum(). Maybe a dev_add_param_array() has to be created whithout this limitation, but that's left for a future exercise. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>