1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-16 03:18:09 +00:00

unix: enable modtrezorio, mock sdcard

This commit is contained in:
Pavol Rusnak 2017-05-24 00:47:20 +02:00
parent 9f352959ee
commit f7d72741fd
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 39 additions and 2 deletions

View File

@ -5,7 +5,13 @@
* see LICENSE file for details
*/
#if defined TREZOR_STM32
#include "sdcard.h"
#elif defined TREZOR_UNIX
#include "unix-sdcard-mock.h"
#else
#error Unsupported TREZOR port. Only STM32 and UNIX ports are supported.
#endif
typedef struct _mp_obj_SDCard_t {
mp_obj_base_t base;

View File

@ -0,0 +1,31 @@
#include "../../trezorhal/sdcard.h"
#define SD_ERROR 41U
int sdcard_init(void) {
return 0;
}
bool sdcard_is_present(void) {
return false;
}
bool sdcard_power_on(void) {
return false;
}
bool sdcard_power_off(void) {
return true;
}
uint64_t sdcard_get_capacity_in_bytes(void) {
return 0;
}
uint32_t sdcard_read_blocks(void *dest, uint32_t block_num, uint32_t num_blocks) {
return SD_ERROR;
}
uint32_t sdcard_write_blocks(const void *src, uint32_t block_num, uint32_t num_blocks) {
return SD_ERROR;
}

View File

@ -2,7 +2,7 @@ MICROPY_PY_TREZORCONFIG = 1
MICROPY_PY_TREZORCRYPTO = 1
MICROPY_PY_TREZORIO = 0
MICROPY_PY_TREZORIO = 1
MICROPY_PY_TREZORMSG = 1

View File

@ -136,7 +136,7 @@
#define MICROPY_PY_TREZORCONFIG (1)
#define MICROPY_PY_TREZORCRYPTO (1)
#define MICROPY_PY_TREZORIO (0)
#define MICROPY_PY_TREZORIO (1)
#define MICROPY_PY_TREZORMSG (1)
#define MICROPY_PY_TREZORUI (1)
#define MICROPY_PY_TREZORUTILS (1)