ESP8266 ILI9341 display support code with printf sources, wire-frame viewer and custom fonts  1.0
ESP8266ILI9341DisplayProject
Macros | Functions | Variables
system.c File Reference

Memory and system utilities. More...

#include "user_config.h"
#include "system.h"
#include "mathio.h"

Go to the source code of this file.

Macros

#define HEAP_START   ((uint32_t) & (_heap_start))
 
#define HEAP_END   ((uint32_t) (0x3FFFC000UL - 1UL))
 

Functions

MEMSPACE void * malloc (size_t size)
 malloc buffer POSIX function More...
 
MEMSPACE void * calloc (size_t nmemb, size_t size)
 calloc buffer POSIX function More...
 
MEMSPACE void free (void *p)
 Free buffer POSIX function We only call os_free() is pointer is not null. More...
 
MEMSPACE size_t freeRam ()
 Return Free memory. More...
 
MEMSPACE void PrintRam ()
 Display Free memory and regions. More...
 
MEMSPACE void * safecalloc (size_t nmemb, size_t size)
 Safe Calloc - Display Error message if Calloc fails. More...
 
MEMSPACE void * safemalloc (size_t size)
 Safe Malloc - Display Error message if Malloc fails. More...
 
MEMSPACE void safefree (void *p)
 Safe free - Only free a pointer if it is in malloc memory range. We want to try to catch frees of static or bogus data. More...
 
MEMSPACE void reset (void)
 reset system More...
 
MEMSPACE void wdt_reset (void)
 reset watchdog More...
 

Variables

void * _heap_start
 calloc may be aliased to safecalloc More...
 

Detailed Description

Memory and system utilities.

Copyright © 2015 Mike Gore, GPL License
You are free to use this code under the terms of GPL
please retain a copy of this notice in any code you use it in.

This is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file system.c.

Macro Definition Documentation

#define HEAP_END   ((uint32_t) (0x3FFFC000UL - 1UL))

Definition at line 43 of file system.c.

Referenced by free(), PrintRam(), and safefree().

#define HEAP_START   ((uint32_t) & (_heap_start))

Definition at line 42 of file system.c.

Referenced by free(), PrintRam(), and safefree().

Function Documentation

MEMSPACE void* calloc ( size_t  nmemb,
size_t  size 
)

calloc buffer POSIX function

Parameters
[in]nmembnumber of elements
[in]sizesize of elements
Returns
void * buffer

Definition at line 69 of file system.c.

Referenced by db_calloc(), escape(), main(), and safecalloc().

MEMSPACE void free ( void *  p)

Free buffer POSIX function We only call os_free() is pointer is not null.

Parameters
[in]*pbuffer to free
Returns
void

Definition at line 87 of file system.c.

Referenced by db_free(), main(), rx_fifo_free(), safefree(), and tx_fifo_free().

MEMSPACE size_t freeRam ( void  )

Return Free memory.

Returns
free memory in bytes.
See also
malloc().

Definition at line 104 of file system.c.

MEMSPACE void* malloc ( size_t  size)

malloc buffer POSIX function

Parameters
[in]sizesize of buffer
Returns
void * buffer

Definition at line 51 of file system.c.

MEMSPACE void PrintRam ( void  )

Display Free memory and regions.

Returns
void

Definition at line 113 of file system.c.

Referenced by calloc(), free(), malloc(), safecalloc(), safefree(), setup(), and user_tests().

MEMSPACE void reset ( void  )

reset system

Returns
void

Definition at line 181 of file system.c.

MEMSPACE void* safecalloc ( size_t  nmemb,
size_t  size 
)

Safe Calloc - Display Error message if Calloc fails.

  • We check if the pointer was in the heap.
  • Otherwise it may have been statically defined - display error.
    Parameters
    [in]nmembnumber of elements
    [in]sizesize of elements
    Returns
    void.

Definition at line 128 of file system.c.

Referenced by copy(), fatfs_ls(), fdevopen(), html_msg(), MatAlloc(), new_file_descriptor(), ntp_setup(), queue_new(), rwbuf_create(), safemalloc(), servertest_setup(), stralloc(), and strnalloc().

MEMSPACE void safefree ( void *  p)

Safe free - Only free a pointer if it is in malloc memory range. We want to try to catch frees of static or bogus data.

  • We check if the pointer was in the heap.
  • Otherwise it may have been statically defined - display error.
    Parameters
    [in]ppointer to free.
    Returns
    void.

Definition at line 165 of file system.c.

Referenced by copy(), fatfs_ls(), fatfs_tests(), free_file_descriptor(), html_msg(), MatFree(), mkfs(), new_file_descriptor(), ntp_setup(), queue_del(), queue_new(), and rwbuf_delete().

MEMSPACE void* safemalloc ( size_t  size)

Safe Malloc - Display Error message if Malloc fails.

  • We check if the pointer was in the heap.
  • Otherwise it may have been statically defined - display error.
    Parameters
    [in]sizesize
    Returns
    void.

Definition at line 146 of file system.c.

Referenced by fatfs_tests(), and mkfs().

MEMSPACE void wdt_reset ( void  )

reset watchdog

Returns
void

Definition at line 190 of file system.c.

Referenced by cat(), copy(), fatfs_ls(), fatfs_scan_files(), fgetc(), fputc(), hexdump(), ls(), mmc_test_timeout(), setup(), sum(), testpage(), and wire_draw().

Variable Documentation

void* _heap_start

calloc may be aliased to safecalloc

free may be aliased to safefree malloc may be aliased to safecalloc