17 #include "lib/random.h"
25 #include "dev/cc1120.h"
26 #include "dev/cc1120-arch.h"
28 #define DATA_BUFFER_LENGTH 200
30 PROCESS(listcoffee_process,
"CFS/Coffee dir list process");
31 AUTOSTART_PROCESSES(&listcoffee_process);
35 load_file(
char *data_buffer,
char *filename)
41 cc1120_arch_interrupt_disable();
46 data_length = cfs_read(fd, data_buffer, DATA_BUFFER_LENGTH);
53 cc1120_arch_interrupt_enable();
66 struct cfs_dirent dirent;
67 char data_buffer[DATA_BUFFER_LENGTH];
73 length = load_file(data_buffer, dirent.name);
76 printf(
"%s %d ", dirent.name, length);
78 printf(
"%02x", (uint8_t)data_buffer[i]);
86 printf(
"opendir failed\n");
int cfs_open(const char *name, int flags)
Open a file.
int cfs_opendir(struct cfs_dir *dir, const char *name)
Open a directory for reading directory entries.
void cfs_close(int fd)
Close an open file.
#define PROCESS_END()
Define the end of a process.
#define PROCESS(name, strname)
Declare a process.
#define CFS_READ
Specify that cfs_open() should open a file for reading.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
int cfs_readdir(struct cfs_dir *dir, struct cfs_dirent *record)
Read a directory entry.
Header for the Coffee file system.
Header file for the CRC16 calculcation
#define PROCESS_BEGIN()
Define the beginning of a process.