These are the examples provided for [[/users/frank26080115/libraries/LPC1700CMSIS_Lib/]] Note, the entire "program" is not compilable!
USBDEV/USBMassStorage/memory.c@0:bf7b9fba3924, 2011-03-20 (annotated)
- Committer:
- frank26080115
- Date:
- Sun Mar 20 05:38:56 2011 +0000
- Revision:
- 0:bf7b9fba3924
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
frank26080115 | 0:bf7b9fba3924 | 1 | /*---------------------------------------------------------------------------- |
frank26080115 | 0:bf7b9fba3924 | 2 | * Name: MEMORY.C |
frank26080115 | 0:bf7b9fba3924 | 3 | * Purpose: USB Mass Storage Demo |
frank26080115 | 0:bf7b9fba3924 | 4 | * Version: V1.10 |
frank26080115 | 0:bf7b9fba3924 | 5 | *---------------------------------------------------------------------------- |
frank26080115 | 0:bf7b9fba3924 | 6 | * This software is supplied "AS IS" without any warranties, express, |
frank26080115 | 0:bf7b9fba3924 | 7 | * implied or statutory, including but not limited to the implied |
frank26080115 | 0:bf7b9fba3924 | 8 | * warranties of fitness for purpose, satisfactory quality and |
frank26080115 | 0:bf7b9fba3924 | 9 | * noninfringement. Keil extends you a royalty-free right to reproduce |
frank26080115 | 0:bf7b9fba3924 | 10 | * and distribute executable files created using this software for use |
frank26080115 | 0:bf7b9fba3924 | 11 | * on NXP Semiconductors LPC family microcontroller devices only. Nothing |
frank26080115 | 0:bf7b9fba3924 | 12 | * else gives you the right to use this software. |
frank26080115 | 0:bf7b9fba3924 | 13 | * |
frank26080115 | 0:bf7b9fba3924 | 14 | * Copyright (c) 2005-2009 Keil Software. |
frank26080115 | 0:bf7b9fba3924 | 15 | *---------------------------------------------------------------------------*/ |
frank26080115 | 0:bf7b9fba3924 | 16 | |
frank26080115 | 0:bf7b9fba3924 | 17 | #include "LPC17xx.h" |
frank26080115 | 0:bf7b9fba3924 | 18 | |
frank26080115 | 0:bf7b9fba3924 | 19 | #include "lpc_types.h" |
frank26080115 | 0:bf7b9fba3924 | 20 | |
frank26080115 | 0:bf7b9fba3924 | 21 | #include "usb.h" |
frank26080115 | 0:bf7b9fba3924 | 22 | #include "usbcfg.h" |
frank26080115 | 0:bf7b9fba3924 | 23 | #include "usbhw.h" |
frank26080115 | 0:bf7b9fba3924 | 24 | #include "usbcore.h" |
frank26080115 | 0:bf7b9fba3924 | 25 | #include "mscuser.h" |
frank26080115 | 0:bf7b9fba3924 | 26 | |
frank26080115 | 0:bf7b9fba3924 | 27 | #include "memory.h" |
frank26080115 | 0:bf7b9fba3924 | 28 | |
frank26080115 | 0:bf7b9fba3924 | 29 | #include "lpc17xx_libcfg.h" |
frank26080115 | 0:bf7b9fba3924 | 30 | #include "lpc17xx_nvic.h" |
frank26080115 | 0:bf7b9fba3924 | 31 | |
frank26080115 | 0:bf7b9fba3924 | 32 | /* Example group ----------------------------------------------------------- */ |
frank26080115 | 0:bf7b9fba3924 | 33 | /** @defgroup USBDEV_USBMassStorage USBMassStorage |
frank26080115 | 0:bf7b9fba3924 | 34 | * @ingroup USBDEV_Examples |
frank26080115 | 0:bf7b9fba3924 | 35 | * @{ |
frank26080115 | 0:bf7b9fba3924 | 36 | */ |
frank26080115 | 0:bf7b9fba3924 | 37 | |
frank26080115 | 0:bf7b9fba3924 | 38 | extern uint8_t Memory[MSC_MemorySize]; /* MSC Memory in RAM */ |
frank26080115 | 0:bf7b9fba3924 | 39 | |
frank26080115 | 0:bf7b9fba3924 | 40 | |
frank26080115 | 0:bf7b9fba3924 | 41 | /* Main Program */ |
frank26080115 | 0:bf7b9fba3924 | 42 | |
frank26080115 | 0:bf7b9fba3924 | 43 | int main (void) { |
frank26080115 | 0:bf7b9fba3924 | 44 | uint32_t n; |
frank26080115 | 0:bf7b9fba3924 | 45 | |
frank26080115 | 0:bf7b9fba3924 | 46 | for (n = 0; n < MSC_ImageSize; n++) { /* Copy Initial Disk Image */ |
frank26080115 | 0:bf7b9fba3924 | 47 | Memory[n] = DiskImage[n]; /* from Flash to RAM */ |
frank26080115 | 0:bf7b9fba3924 | 48 | } |
frank26080115 | 0:bf7b9fba3924 | 49 | |
frank26080115 | 0:bf7b9fba3924 | 50 | USB_Init(); /* USB Initialization */ |
frank26080115 | 0:bf7b9fba3924 | 51 | USB_Connect(TRUE); /* USB Connect */ |
frank26080115 | 0:bf7b9fba3924 | 52 | |
frank26080115 | 0:bf7b9fba3924 | 53 | while (1); /* Loop forever */ |
frank26080115 | 0:bf7b9fba3924 | 54 | } |
frank26080115 | 0:bf7b9fba3924 | 55 | |
frank26080115 | 0:bf7b9fba3924 | 56 | #ifdef DEBUG |
frank26080115 | 0:bf7b9fba3924 | 57 | /******************************************************************************* |
frank26080115 | 0:bf7b9fba3924 | 58 | * @brief Reports the name of the source file and the source line number |
frank26080115 | 0:bf7b9fba3924 | 59 | * where the CHECK_PARAM error has occurred. |
frank26080115 | 0:bf7b9fba3924 | 60 | * @param[in] file Pointer to the source file name |
frank26080115 | 0:bf7b9fba3924 | 61 | * @param[in] line assert_param error line source number |
frank26080115 | 0:bf7b9fba3924 | 62 | * @return None |
frank26080115 | 0:bf7b9fba3924 | 63 | *******************************************************************************/ |
frank26080115 | 0:bf7b9fba3924 | 64 | void check_failed(uint8_t *file, uint32_t line) |
frank26080115 | 0:bf7b9fba3924 | 65 | { |
frank26080115 | 0:bf7b9fba3924 | 66 | /* User can add his own implementation to report the file name and line number, |
frank26080115 | 0:bf7b9fba3924 | 67 | ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ |
frank26080115 | 0:bf7b9fba3924 | 68 | |
frank26080115 | 0:bf7b9fba3924 | 69 | /* Infinite loop */ |
frank26080115 | 0:bf7b9fba3924 | 70 | while(1); |
frank26080115 | 0:bf7b9fba3924 | 71 | } |
frank26080115 | 0:bf7b9fba3924 | 72 | #endif |
frank26080115 | 0:bf7b9fba3924 | 73 | |
frank26080115 | 0:bf7b9fba3924 | 74 | /* |
frank26080115 | 0:bf7b9fba3924 | 75 | * @} |
frank26080115 | 0:bf7b9fba3924 | 76 | */ |