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

System memory and reset utilities. More...

Go to the source code of this file.

Macros

#define free(p)   safefree(p)
 
#define calloc(n, s)   safecalloc(n,s)
 
#define malloc(s)   safemalloc(s)
 

Functions

MEMSPACE size_t freeRam (void)
 Return Free memory. More...
 
MEMSPACE void PrintRam (void)
 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...
 

Detailed Description

System memory and reset utilities.

h

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.h.

Macro Definition Documentation

#define calloc (   n,
 
)    safecalloc(n,s)

Definition at line 33 of file system.h.

#define free (   p)    safefree(p)

Definition at line 32 of file system.h.

#define malloc (   s)    safemalloc(s)

Definition at line 34 of file system.h.

Function Documentation

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 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().