libctr9
Nintendo 3DS ARM9 library
ctr_sd_interface.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (C) 2016 Gabriel Marcano
3  *
4  * Refer to the COPYING.txt file at the top of the project directory. If that is
5  * missing, this file is licensed under the GPL version 2.0 or later.
6  *
7  ******************************************************************************/
8 
11 #ifndef CTR_SD_INTERFACE_H_
12 #define CTR_SD_INTERFACE_H_
13 
14 #include "ctr_io_interface.h"
15 #include "sdmmc/sdmmc.h"
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
23 typedef struct
24 {
25  ctr_io_interface base;
27 
28 //FIXME is it safe to have multiple SD card objects be initialized at the same time?
37 
46 
57 int ctr_sd_interface_read(void *io, void *buffer, size_t buffer_size, uint64_t position, size_t count);
58 
69 int ctr_sd_interface_write(void *io, const void *buffer, size_t buffer_size, uint64_t position);
70 
83 int ctr_sd_interface_read_sector(void *io, void *buffer, size_t buffer_size, size_t sector, size_t count);
84 
99 int ctr_sd_interface_write_sector(void *io, const void *buffer, size_t buffer_size, size_t sectorn);
100 
105 uint64_t ctr_sd_interface_disk_size(void *io);
106 
112 size_t ctr_sd_interface_sector_size(void *io);
113 
114 #ifdef __cplusplus
115 }
116 #endif
117 
118 #endif//CTR_SD_INTERFACE_H_
119 
io interface object for accessing the SD card.
Definition: ctr_sd_interface.h:23
uint64_t ctr_sd_interface_disk_size(void *io)
Returns the size of the underlying disk for the given io interface.
size_t ctr_sd_interface_sector_size(void *io)
Returns the size of the sectors used by the io interface, which is 512 bytes for SD cards...
int ctr_sd_interface_read_sector(void *io, void *buffer, size_t buffer_size, size_t sector, size_t count)
Reads sectors from the given io interface.
int ctr_sd_interface_initialize(ctr_sd_interface *io)
Initialize the given SD io interface object.
int ctr_sd_interface_write_sector(void *io, const void *buffer, size_t buffer_size, size_t sectorn)
Writes sectors from the given io interface.
int ctr_sd_interface_write(void *io, const void *buffer, size_t buffer_size, uint64_t position)
Writes bytes to the given io interface.
void ctr_sd_interface_destroy(ctr_sd_interface *io)
Destroys the given SD io interface object.
Virtual table for io interface dispatching.
Definition: ctr_io_interface.h:89
int ctr_sd_interface_read(void *io, void *buffer, size_t buffer_size, uint64_t position, size_t count)
Reads bytes from the given io interface.