# modules/msd/LPC17xx/msc_bot.c File Reference

`#include <mios32.h>`
`#include <string.h>`
`#include "usbdebug.h"`
`#include "usbapi.h"`
`#include "msc_bot.h"`
`#include "msc_scsi.h"`

## Data Structures
struct | TCBW
struct | TCSW
## Defines
#define | CBW_SIGNATURE 0x43425355
#define | CSW_SIGNATURE 0x53425355
#define | STATUS_PASSED 0x00
#define | STATUS_FAILED 0x01
#define | STATUS_PHASE_ERR 0x02
## Enumerations
enum | EBotState { eCBW, eDataOut, eDataIn, eCSW, eStalled }
## Functions
void | MSCBotReset (void)
void | MSCBotBulkOut (u8 bEP, u8 bEPStatus)
void | MSCBotBulkIn (u8 bEP, u8 bEPStatus)

## Detailed Description

Bulk-only-transfer layer for mass storage.

This layers sits between the generic USB layers and the SCSI layer and performs data transfer according to the BOT protocol.

## Define Documentation

#define CBW_SIGNATURE 0x43425355

magic word in CBW

#define CSW_SIGNATURE 0x53425355

magic word in CSW

#define STATUS_FAILED 0x01

failed transfer

#define STATUS_PASSED 0x00

successful transfer

#define STATUS_PHASE_ERR 0x02

conflict between host and device

## Enumeration Type Documentation

enum EBotState

States of BOT state machine

Enumerator:

  eCBW |
  eDataOut |
  eDataIn |
  eCSW |
  eStalled |

## Function Documentation

void MSCBotBulkIn | ( | u8 | bEP,
|  | u8 | bEPStatus |
| ) |  |  |

Handles the BOT bulk IN endpoint

Parameters:

  `[in]` | bEP | Endpoint number
  `[in]` | bEPStatus | Endpoint status (indicates NAK, STALL, etc)

void MSCBotBulkOut | ( | u8 | bEP,
|  | u8 | bEPStatus |
| ) |  |  |

Handles the BOT bulk OUT endpoint

Parameters:

  `[in]` | bEP | Endpoint number
  `[in]` | bEPStatus | Endpoint status (indicates NAK, STALL, etc)

Here is the call graph for this function:

void MSCBotReset | ( | void |  | ) |

Resets the BOT state machine

Here is the call graph for this function: