Prusa MINI Firmware overview
CommandBlockWrapper Struct Reference

#include <masstorage.h>

Inheritance diagram for CommandBlockWrapper:
Collaboration diagram for CommandBlockWrapper:

Public Member Functions

 CommandBlockWrapper ()
 
 CommandBlockWrapper (uint32_t tag, uint32_t xflen, uint8_t flgs, uint8_t lu, uint8_t cmdlen, uint8_t cmd)
 
 CommandBlockWrapper (uint32_t tag, uint32_t xflen, CDB6_t *cdb, uint8_t dir)
 
 CommandBlockWrapper (uint32_t tag, uint32_t xflen, CDB10_t *cdb, uint8_t dir)
 
- Public Member Functions inherited from CommandBlockWrapperBase
 CommandBlockWrapperBase ()
 
 CommandBlockWrapperBase (uint32_t tag, uint32_t xflen, uint8_t flgs)
 

Public Attributes

struct {
   uint8_t   bmCBWLUN: 4
 
   uint8_t   bmReserved1: 4
 
}; 
 
struct {
   uint8_t   bmCBWCBLength: 4
 
   uint8_t   bmReserved2: 4
 
}; 
 
uint8_t CBWCB [16]
 
- Public Attributes inherited from CommandBlockWrapperBase
uint32_t dCBWSignature
 
uint32_t dCBWTag
 
uint32_t dCBWDataTransferLength
 
uint8_t bmCBWFlags
 

Constructor & Destructor Documentation

◆ CommandBlockWrapper() [1/4]

CommandBlockWrapper::CommandBlockWrapper ( )
409  :
411  for (int i = 0; i < 16; i++) CBWCB[i] = 0;
412  }

◆ CommandBlockWrapper() [2/4]

CommandBlockWrapper::CommandBlockWrapper ( uint32_t  tag,
uint32_t  xflen,
uint8_t  flgs,
uint8_t  lu,
uint8_t  cmdlen,
uint8_t  cmd 
)
416  :
417  CommandBlockWrapperBase(tag, xflen, flgs),
418  bmCBWLUN(lu), bmReserved1(0), bmCBWCBLength(cmdlen), bmReserved2(0) {
419  for (int i = 0; i < 16; i++) CBWCB[i] = 0;
420  // Type punning can cause optimization problems and bugs.
421  // Using reinterpret_cast to a dreinterpretifferent object is the proper way to do this.
422  //(((BASICCDB_t *) CBWCB)->LUN) = cmd;
423  BASICCDB_t *x = reinterpret_cast<BASICCDB_t *>(CBWCB);
424  x->LUN = cmd;
425  }

◆ CommandBlockWrapper() [3/4]

CommandBlockWrapper::CommandBlockWrapper ( uint32_t  tag,
uint32_t  xflen,
CDB6_t cdb,
uint8_t  dir 
)
429  :
430  CommandBlockWrapperBase(tag, xflen, dir),
431  bmCBWLUN(cdb->LUN), bmReserved1(0), bmCBWCBLength(6), bmReserved2(0) {
432  memcpy(&CBWCB, cdb, 6);
433  }

◆ CommandBlockWrapper() [4/4]

CommandBlockWrapper::CommandBlockWrapper ( uint32_t  tag,
uint32_t  xflen,
CDB10_t cdb,
uint8_t  dir 
)
436  :
437  CommandBlockWrapperBase(tag, xflen, dir),
438  bmCBWLUN(cdb->LUN), bmReserved1(0), bmCBWCBLength(10), bmReserved2(0) {
439  memcpy(&CBWCB, cdb, 10);
440  }

Member Data Documentation

◆ bmCBWLUN

uint8_t CommandBlockWrapper::bmCBWLUN

◆ bmReserved1

uint8_t CommandBlockWrapper::bmReserved1

◆ @35

struct { ... }

◆ bmCBWCBLength

uint8_t CommandBlockWrapper::bmCBWCBLength

◆ bmReserved2

uint8_t CommandBlockWrapper::bmReserved2

◆ @37

struct { ... }

◆ CBWCB

uint8_t CommandBlockWrapper::CBWCB[16]
CommandBlockWrapper::CBWCB
uint8_t CBWCB[16]
Definition: masstorage.h:404
CDB10::LUN
unsigned LUN
Definition: masstorage.h:233
i
uint8_t i
Definition: screen_test_graph.c:72
CommandBlockWrapper::bmReserved1
uint8_t bmReserved1
Definition: masstorage.h:396
BASICCDB
Definition: masstorage.h:192
CommandBlockWrapperBase::CommandBlockWrapperBase
CommandBlockWrapperBase()
Definition: masstorage.h:384
CommandBlockWrapper::bmCBWLUN
uint8_t bmCBWLUN
Definition: masstorage.h:395
CommandBlockWrapper::bmReserved2
uint8_t bmReserved2
Definition: masstorage.h:401
BASICCDB::LUN
unsigned LUN
Definition: masstorage.h:196
CommandBlockWrapper::bmCBWCBLength
uint8_t bmCBWCBLength
Definition: masstorage.h:400
CDB6::LUN
unsigned LUN
Definition: masstorage.h:207