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

Flash read and bit test utilities. More...

#include "user_config.h"
#include <stdint.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include "flash.h"

Go to the source code of this file.

Macros

#define USE_CACHE
 

Functions

uint8_t read_flash8 (uint8_t *p)
 
void cpy_flash (uint8_t *src, uint8_t *dest, int size)
 Copy data from Flash to Ram Uses flash_read8() to avoid alighnment problems. More...
 
uint16_t read_flash16 (uint8_t *p)
 16 bits reads from Flash memory space Uses cpy_flash() to avoid alighnment problems More...
 
uint32_t read_flash32 (uint8_t *p)
 32 bits reads from Flash memory space Uses cpy_flash() to avoid alighnment problems More...
 
uint64_t read_flash64 (uint8_t *p)
 64 bits reads from Flash memory space Uses cpy_flash() to avoid alighnment problems More...
 
uint32_t read_flash_ptr (uint8_t *p)
 Pointer read from Flash memory space Uses cpy_flash() to avoid alighnment problems. More...
 
int bittestv (unsigned char *ptr, int off)
 Test bit in byte array. More...
 
int bittestxy (unsigned char *ptr, int x, int y, int w, int h)
 Test bit in w * h size bit array usng x and y offsets. More...
 

Variables

uint32_t _addr = 0
 Read bit bit value from flash Supports 8 bits reads from memory spaced that must have 32bit aligned data Caches the 32bit read. More...
 
uint32_t _data
 
uint8_tp8 = (uint8_t *) &_data
 

Detailed Description

Flash read and bit test 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 flash.c.

Macro Definition Documentation

#define USE_CACHE

Definition at line 33 of file flash.c.

Function Documentation

int bittestv ( unsigned char *  ptr,
int  off 
)

Test bit in byte array.

Parameters
[in]*ptrbyte array
[in]offbit offset to test
Returns
1 if bit is set, 0 if not

Definition at line 151 of file flash.c.

Referenced by bittestxy(), and tft_bit_blit().

int bittestxy ( unsigned char *  ptr,
int  x,
int  y,
int  w,
int  h 
)

Test bit in w * h size bit array usng x and y offsets.

Parameters
[in]*ptrbyte array
[in]xbit x offset
[in]ybit y offset
[in]wbit array wide
[in]hbit array high
Returns
1 if bit is set, 0 if not

Definition at line 166 of file flash.c.

void cpy_flash ( uint8_t src,
uint8_t dest,
int  size 
)

Copy data from Flash to Ram Uses flash_read8() to avoid alighnment problems.

Parameters
[in]*srcaddress to read from
[out]*destaddress to write to
[in]sizenumber of bytes to copy
Returns
void

Definition at line 89 of file flash.c.

Referenced by font_attr(), read_flash16(), read_flash32(), read_flash64(), read_flash_ptr(), and wire_draw().

uint16_t read_flash16 ( uint8_t p)

16 bits reads from Flash memory space Uses cpy_flash() to avoid alighnment problems

Parameters
[in]*paddress to read
Returns
uint16_t

Definition at line 103 of file flash.c.

Referenced by user_tests().

uint32_t read_flash32 ( uint8_t p)

32 bits reads from Flash memory space Uses cpy_flash() to avoid alighnment problems

Parameters
[in]*paddress to read
Returns
uint32_t

Definition at line 115 of file flash.c.

Referenced by user_tests().

uint64_t read_flash64 ( uint8_t p)

64 bits reads from Flash memory space Uses cpy_flash() to avoid alighnment problems

Parameters
[in]*paddress to read
Returns
uint64_t

Definition at line 127 of file flash.c.

uint8_t read_flash8 ( uint8_t p)

Definition at line 46 of file flash.c.

Referenced by bittestv(), cpy_flash(), read_flash8(), and user_tests().

uint32_t read_flash_ptr ( uint8_t p)

Pointer read from Flash memory space Uses cpy_flash() to avoid alighnment problems.

Parameters
[in]*paddress to read
Returns
uint32_t

Definition at line 139 of file flash.c.

Variable Documentation

uint32_t _addr = 0

Read bit bit value from flash Supports 8 bits reads from memory spaced that must have 32bit aligned data Caches the 32bit read.

Parameters
[in]*paddress to read
Returns
uint8_t

Definition at line 43 of file flash.c.

Referenced by read_flash8().

uint32_t _data

Definition at line 44 of file flash.c.

Referenced by read_flash8().

uint8_t* p8 = (uint8_t *) &_data

Definition at line 45 of file flash.c.

Referenced by read_flash8().