Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
firmware
boards
breezy
breezystm32
examples
memtest
memtest.c
Go to the documentation of this file.
1
/*
2
memsize.c : test the MP25P16 flash memory
3
4
Copyright (C) 2016 Simon D. Levy
5
6
This file is part of BreezySTM32.
7
8
BreezySTM32 is free software: you can redistribute it and/or modify
9
it under the terms of the GNU General Public License as published by
10
the Free Software Foundation, either version 3 of the License, or
11
(at your option) any later version.
12
13
BreezySTM32 is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
GNU General Public License for more details.
17
18
You should have received a copy of the GNU General Public License
19
along with BreezySTM32. If not, see <http://www.gnu.org/licenses/>.
20
*/
21
22
#include <
breezystm32.h
>
23
#include <string.h>
24
25
const
char
*
MESSAGE
=
"Hello, world!"
;
26
27
static
int
msglen
;
28
29
void
setup
(
void
)
30
{
31
spiInit
(
SPI2
);
32
m25p16_init
();
33
flashfsInit
();
34
35
while
(!
flashfsIsReady
())
36
;
37
38
msglen
= strlen(
MESSAGE
);
39
40
flashfsWrite
((uint8_t *)
MESSAGE
,
msglen
,
true
);
// sync
41
}
42
43
void
loop
(
void
)
44
{
45
delay
(500);
46
47
char
s
[100];
// long enough for any message?
48
49
printf
(
"%s\n"
,
flashfsReadAbs
(0, (uint8_t *)s,
msglen
) <
msglen
?
"error reading bytes"
: s);
50
}
MESSAGE
const char * MESSAGE
Definition:
memtest.c:25
SPI2
#define SPI2
Definition:
stm32f4xx.h:2050
printf
#define printf
Definition:
printf.h:119
msglen
static int msglen
Definition:
memtest.c:27
s
XmlRpcServer s
flashfsIsReady
bool flashfsIsReady()
Definition:
drv_flashfs.c:111
flashfsReadAbs
int flashfsReadAbs(uint32_t address, uint8_t *buffer, unsigned int len)
Definition:
drv_flashfs.c:468
m25p16_init
bool m25p16_init()
Definition:
drv_m25p16.c:217
setup
void setup(void)
Definition:
memtest.c:29
breezystm32.h
flashfsInit
void flashfsInit()
Definition:
drv_flashfs.c:565
spiInit
bool spiInit(SPI_TypeDef *instance)
Definition:
drv_spi.c:372
loop
void loop(void)
Definition:
memtest.c:43
flashfsWrite
void flashfsWrite(const uint8_t *data, unsigned int len, bool sync)
Definition:
drv_flashfs.c:385
delay
void delay(uint32_t ms)
Definition:
system.c:98
rosflight_firmware
Author(s): Daniel Koch
, James Jackson
autogenerated on Wed Jul 3 2019 19:59:25