KIT Solar Car Project / Mbed 2 deprecated BMS_6804_pb

Dependencies:   mbed INA226

Committer:
takuma1
Date:
Thu Apr 08 10:04:55 2021 +0000
Revision:
5:f07de56debf3
210408_BMS_v1;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
takuma1 5:f07de56debf3 1 /*
takuma1 5:f07de56debf3 2 **************************************************************************************************************
takuma1 5:f07de56debf3 3 * NXP USB Host Stack
takuma1 5:f07de56debf3 4 *
takuma1 5:f07de56debf3 5 * (c) Copyright 2008, NXP SemiConductors
takuma1 5:f07de56debf3 6 * (c) Copyright 2008, OnChip Technologies LLC
takuma1 5:f07de56debf3 7 * All Rights Reserved
takuma1 5:f07de56debf3 8 *
takuma1 5:f07de56debf3 9 * www.nxp.com
takuma1 5:f07de56debf3 10 * www.onchiptech.com
takuma1 5:f07de56debf3 11 *
takuma1 5:f07de56debf3 12 * File : usbhost_ms.h
takuma1 5:f07de56debf3 13 * Programmer(s) : Ravikanth.P
takuma1 5:f07de56debf3 14 * Version :
takuma1 5:f07de56debf3 15 *
takuma1 5:f07de56debf3 16 **************************************************************************************************************
takuma1 5:f07de56debf3 17 */
takuma1 5:f07de56debf3 18
takuma1 5:f07de56debf3 19 #ifndef USBHOST_MS_H
takuma1 5:f07de56debf3 20 #define USBHOST_MS_H
takuma1 5:f07de56debf3 21
takuma1 5:f07de56debf3 22 /*
takuma1 5:f07de56debf3 23 **************************************************************************************************************
takuma1 5:f07de56debf3 24 * INCLUDE HEADER FILES
takuma1 5:f07de56debf3 25 **************************************************************************************************************
takuma1 5:f07de56debf3 26 */
takuma1 5:f07de56debf3 27
takuma1 5:f07de56debf3 28 #include "usbhost_inc.h"
takuma1 5:f07de56debf3 29
takuma1 5:f07de56debf3 30 /*
takuma1 5:f07de56debf3 31 **************************************************************************************************************
takuma1 5:f07de56debf3 32 * MASS STORAGE SPECIFIC DEFINITIONS
takuma1 5:f07de56debf3 33 **************************************************************************************************************
takuma1 5:f07de56debf3 34 */
takuma1 5:f07de56debf3 35
takuma1 5:f07de56debf3 36 #define MS_GET_MAX_LUN_REQ 0xFE
takuma1 5:f07de56debf3 37 #define MASS_STORAGE_CLASS 0x08
takuma1 5:f07de56debf3 38 #define MASS_STORAGE_SUBCLASS_SCSI 0x06
takuma1 5:f07de56debf3 39 #define MASS_STORAGE_PROTOCOL_BO 0x50
takuma1 5:f07de56debf3 40
takuma1 5:f07de56debf3 41 #define INQUIRY_LENGTH 36
takuma1 5:f07de56debf3 42 /*
takuma1 5:f07de56debf3 43 **************************************************************************************************************
takuma1 5:f07de56debf3 44 * SCSI SPECIFIC DEFINITIONS
takuma1 5:f07de56debf3 45 **************************************************************************************************************
takuma1 5:f07de56debf3 46 */
takuma1 5:f07de56debf3 47
takuma1 5:f07de56debf3 48 #define CBW_SIGNATURE 0x43425355
takuma1 5:f07de56debf3 49 #define CSW_SIGNATURE 0x53425355
takuma1 5:f07de56debf3 50 #define CBW_SIZE 31
takuma1 5:f07de56debf3 51 #define CSW_SIZE 13
takuma1 5:f07de56debf3 52 #define CSW_CMD_PASSED 0x00
takuma1 5:f07de56debf3 53 #define SCSI_CMD_REQUEST_SENSE 0x03
takuma1 5:f07de56debf3 54 #define SCSI_CMD_TEST_UNIT_READY 0x00
takuma1 5:f07de56debf3 55 #define SCSI_CMD_INQUIRY 0x12
takuma1 5:f07de56debf3 56 #define SCSI_CMD_READ_10 0x28
takuma1 5:f07de56debf3 57 #define SCSI_CMD_READ_CAPACITY 0x25
takuma1 5:f07de56debf3 58 #define SCSI_CMD_WRITE_10 0x2A
takuma1 5:f07de56debf3 59
takuma1 5:f07de56debf3 60 /*
takuma1 5:f07de56debf3 61 **************************************************************************************************************
takuma1 5:f07de56debf3 62 * TYPE DEFINITIONS
takuma1 5:f07de56debf3 63 **************************************************************************************************************
takuma1 5:f07de56debf3 64 */
takuma1 5:f07de56debf3 65
takuma1 5:f07de56debf3 66 typedef enum ms_data_dir {
takuma1 5:f07de56debf3 67
takuma1 5:f07de56debf3 68 MS_DATA_DIR_IN = 0x80,
takuma1 5:f07de56debf3 69 MS_DATA_DIR_OUT = 0x00,
takuma1 5:f07de56debf3 70 MS_DATA_DIR_NONE = 0x01
takuma1 5:f07de56debf3 71
takuma1 5:f07de56debf3 72 } MS_DATA_DIR;
takuma1 5:f07de56debf3 73
takuma1 5:f07de56debf3 74 /*
takuma1 5:f07de56debf3 75 **************************************************************************************************************
takuma1 5:f07de56debf3 76 * FUNCTION PROTOTYPES
takuma1 5:f07de56debf3 77 **************************************************************************************************************
takuma1 5:f07de56debf3 78 */
takuma1 5:f07de56debf3 79
takuma1 5:f07de56debf3 80 USB_INT32S MS_BulkRecv ( USB_INT32U block_number,
takuma1 5:f07de56debf3 81 USB_INT16U num_blocks,
takuma1 5:f07de56debf3 82 volatile USB_INT08U *user_buffer);
takuma1 5:f07de56debf3 83
takuma1 5:f07de56debf3 84 USB_INT32S MS_BulkSend ( USB_INT32U block_number,
takuma1 5:f07de56debf3 85 USB_INT16U num_blocks,
takuma1 5:f07de56debf3 86 volatile USB_INT08U *user_buffer);
takuma1 5:f07de56debf3 87 USB_INT32S MS_ParseConfiguration(void);
takuma1 5:f07de56debf3 88 USB_INT32S MS_TestUnitReady (void);
takuma1 5:f07de56debf3 89 USB_INT32S MS_ReadCapacity (USB_INT32U *numBlks, USB_INT32U *blkSize);
takuma1 5:f07de56debf3 90 USB_INT32S MS_GetMaxLUN (void);
takuma1 5:f07de56debf3 91 USB_INT32S MS_GetSenseInfo (void);
takuma1 5:f07de56debf3 92 USB_INT32S MS_Init (USB_INT32U *blkSize, USB_INT32U *numBlks, USB_INT08U *inquiryResult);
takuma1 5:f07de56debf3 93 USB_INT32S MS_Inquire (USB_INT08U *response);
takuma1 5:f07de56debf3 94
takuma1 5:f07de56debf3 95 void Fill_MSCommand ( USB_INT32U block_number,
takuma1 5:f07de56debf3 96 USB_INT32U block_size,
takuma1 5:f07de56debf3 97 USB_INT16U num_blocks,
takuma1 5:f07de56debf3 98 MS_DATA_DIR direction,
takuma1 5:f07de56debf3 99 USB_INT08U scsi_cmd,
takuma1 5:f07de56debf3 100 USB_INT08U scsi_cmd_len);
takuma1 5:f07de56debf3 101 #endif