SingingCat 0
application
flashapp.h
1#ifndef FLASHAPP_H
2#define FLASHAPP_H 1
3#include "main-header.h"
4#include "streams.h"
5#include "baseinfo.h"
6void flashcom(struct command *com);
7int flash_app_consumer(int fd, byte *b, int size);
8int flash_app_close(int fd, int reason);
9int flash_app_init(void *base, uint32_t flags);
10
11int flash_write(byte *b, void *adr, int size);
12void flash_debug();
13
14
15/* \brief unless this is set, flags are ignored */
16#define FLASH_FLAGS_USE 0
17/* \brief if set, will mark this as an app and set it to 'latest' in partition table */
18#define FLASH_FLAGS_SET_LATEST_APP 1
19/* \brief if set, user app will be stopped before flashing */
20#define FLASH_FLAGS_STOP_USERAPP 2
21/* \brief if set, user app will start after flashing */
22#define FLASH_FLAGS_START_USERAPP 3
23/* \brief if set, will mark this as a user app and update config to execute this */
24#define FLASH_FLAGS_SET_LATEST_USERAPP 4
25/* \brief if set, will erase section of flash in one go prior to receiving data. otherwise, will flash each sector as it is received */
26#define FLASH_FLAGS_PRE_ERASE 5
27/* \brief if set, return baseaddress of available slot for userapp instead of firmware */
28#define FLASH_FLAGS_RETURN_APP_SLOT 6
29/* \brief if set, do not use flash, write directly as with for example, ram */
30#define FLASH_FLAGS_USE_DIRECT_WRITE 7
31/* \brief if set, uses old-style word-by-word writes. Default is to use half-page writes, which is faster, but not as well tested */
32#define FLASH_FLAGS_WRITE_OLD 8
33
34
35#endif
int flash_write(byte *b, void *adr, int size)
unlock, erase, write, lock
Definition: flashapp.c:157
int flash_app_consumer(int fd, byte *b, int size)
called by stream whenever we got sufficient bytes (and only on full blocks!)
Definition: flashapp.c:102
void flashcom(struct command *com)
set up a flash connection, associate with stream, called by command-handler for command "flash-app"
Definition: flashapp.c:224