Record audio data to a .wav file, complete with header, using the TLV320 CODEC and I2S port

Dependencies:   mbed

Committer:
d_worrall
Date:
Fri Aug 05 15:00:51 2011 +0000
Revision:
0:e7efc8468066
version 2.0

Who changed what in which revision?

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