code

Dependencies:   C12832_lcd CMPS03 FatFileSystemCpp GPS MMA7660 mbed

Fork of CompleteMbed by Group 14

Committer:
Alex4475
Date:
Wed May 07 09:49:54 2014 +0000
Revision:
0:2557081b4322
Code to take GPS, Accelerometer and Compass data and print to a USB for data analysis

Who changed what in which revision?

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