keil_examples/USBMem/mscuser.c
/*
 *  MSC Memory Write Callback
 *   Called automatically on Memory Write Event
 *    Parameters:      None (global variables)
 *    Return Value:    None
 */
MSC Memory Write Callback
Called automatically on Memory Write Event
Parameters:      None (global variables)
Return Value:    None
MSC Memory Write Callback Called automatically on Memory Write Event Parameters : None ( global variables ) Return Value : None
void MSC_MemoryWrite (void) {
  uint32_t n;
  if ((Offset + BulkLen) > MSC_MemorySize) {
    BulkLen = MSC_MemorySize - Offset;
    BulkStage = MSC_BS_CSW;
    MSC_SetStallEP(MSC_EP_OUT);
  }
  for (n = 0; n < BulkLen; n++) {
    Memory[Offset + n] = BulkBuf[n];
  }
  Offset += BulkLen;
  Length -= BulkLen;
  CSW.dDataResidue -= BulkLen;
  if ((Length == 0) || (BulkStage == MSC_BS_CSW)) {
    CSW.bStatus = CSW_CMD_PASSED;
    MSC_SetCSW();
  }
}
void MSC_MemoryWrite ( void ) { uint32_t n ; if ( ( Offset + BulkLen ) > MSC_MemorySize ) { BulkLen = MSC_MemorySize - Offset ; BulkStage = MSC_BS_CSW ; MSC_SetStallEP ( MSC_EP_OUT ) ; } for ( n = 0 ; n < BulkLen ; n ++ ) { Memory [ Offset + n ] = BulkBuf [ n ] ; } Offset += BulkLen ; Length -= BulkLen ; CSW . dDataResidue -= BulkLen ; if ( ( Length == 0 ) || ( BulkStage == MSC_BS_CSW ) ) { CSW . bStatus = CSW_CMD_PASSED ; MSC_SetCSW ( ) ; } }
MSC Memory Write Callback
   Called automatically on Memory Write Event
    Parameters:      None (global variables)
    Return Value:    None
MSC Memory Write Callback Called automatically on Memory Write Event Parameters : None ( global variables ) Return Value : None