2 * Copyright © 2013 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
30 ao_mutex_get(uint8_t *mutex)
35 ao_mutex_put(uint8_t *mutex)
40 ao_panic(uint8_t panic)
42 printf ("panic %d\n", panic);
46 #define AO_PANIC_BUFIO 15
48 #define ao_cmd_success 0
50 uint8_t ao_cmd_status;
51 uint32_t ao_cmd_lex_u32;
58 #define ao_cmd_register(x)
68 ao_sdcard_read_block(uint32_t block, uint8_t *data)
70 lseek(fs_fd, block * 512, 0);
71 return read(fs_fd, data, 512) == 512;
75 ao_sdcard_write_block(uint32_t block, uint8_t *data)
77 lseek(fs_fd, block * 512, 0);
78 return write(fs_fd, data, 512) == 512;
84 fs_fd = open("fat.fs", 2);
91 main(int argc, char **argv)
97 if (ao_fat_open("DATALOG TXT")) {
98 printf ("DATALOG.TXT\n");
99 while ((len = ao_fat_read(data, sizeof (data))) > 0) {
103 // ao_fat_unlink("DATALOG TXT");
105 if (ao_fat_open("NEWFILE TXT")) {
106 printf ("NEWFILE.TXT\n");
107 while ((len = ao_fat_read(data, sizeof (data))) > 0) {
112 if (ao_fat_creat ("NEWFILE TXT")) {
113 for (len = 0; len < 4095; len++)
114 ao_fat_write((uint8_t *) "hello, world!\n", 14);