rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Functions | Variables
null_device.cpp File Reference

Functions

static bool nd_is_inserted (void *)
 
static bool nd_is_protected (void *)
 
static bool nd_return_success (void *)
 
static bool nd_return_success_read (void *, uint32_t, uint8_t *buffer, uint32_t n)
 
static bool nd_return_success_write (void *, uint32_t, const uint8_t *, uint32_t)
 
static bool nd_get_info (void *, BlockDeviceInfo *bdip)
 

Variables

static const struct BaseBlockDeviceVMT ndVmt
 
NullDevice ND1 = { &ndVmt, BLK_READY }
 

Function Documentation

◆ nd_get_info()

static bool nd_get_info ( void *  ,
BlockDeviceInfo *  bdip 
)
static

Definition at line 44 of file null_device.cpp.

44 {
45 // We have to report non-zero size here because Windows
46 // will query the size of the block device even if we indicate
47 // that the device has no media
48 // If we report zeroes, it breaks USB until you unplug this device
49 bdip->blk_num = 1000;
50 bdip->blk_size = 512;
51 return HAL_SUCCESS;
52}

◆ nd_is_inserted()

static bool nd_is_inserted ( void *  )
static

Definition at line 20 of file null_device.cpp.

20 {
21 // This function is the whole point - we have no media!
22 return false;
23}

◆ nd_is_protected()

static bool nd_is_protected ( void *  )
static

Definition at line 25 of file null_device.cpp.

25 {
26 return false;
27}

◆ nd_return_success()

static bool nd_return_success ( void *  )
static

Definition at line 29 of file null_device.cpp.

29 {
30 return HAL_SUCCESS;
31}

◆ nd_return_success_read()

static bool nd_return_success_read ( void *  ,
uint32_t  ,
uint8_t *  buffer,
uint32_t  n 
)
static

Definition at line 33 of file null_device.cpp.

33 {
34 // write zeroes to the buffer to prevent somebody reading random memory
35 memset(buffer, 0, n);
36
37 return HAL_SUCCESS;
38}
static BigBufferHandle buffer

◆ nd_return_success_write()

static bool nd_return_success_write ( void *  ,
uint32_t  ,
const uint8_t *  ,
uint32_t   
)
static

Definition at line 40 of file null_device.cpp.

40 {
41 return HAL_SUCCESS;
42}

Variable Documentation

◆ ND1

NullDevice ND1 = { &ndVmt, BLK_READY }

Definition at line 69 of file null_device.cpp.

69{ &ndVmt, BLK_READY };
static const struct BaseBlockDeviceVMT ndVmt

Referenced by deattachMsdSdCard(), getRamdiskDevice(), and initUsbMsd().

◆ ndVmt

const struct BaseBlockDeviceVMT ndVmt
static
Initial value:
= {
(size_t)0,
}
static bool nd_return_success_read(void *, uint32_t, uint8_t *buffer, uint32_t n)
static bool nd_get_info(void *, BlockDeviceInfo *bdip)
static bool nd_return_success_write(void *, uint32_t, const uint8_t *, uint32_t)
static bool nd_is_protected(void *)
static bool nd_return_success(void *)
static bool nd_is_inserted(void *)

Definition at line 54 of file null_device.cpp.

54 {
55 (size_t)0, // instanceOffset
58
59 // These functions just claim success to make the host happy
66};

Go to the source code of this file.