max32630fthr quad spi , unexpected spi behavior

Committer:
boonshen
Date:
Tue Mar 13 21:12:00 2018 +0000
Revision:
0:a35c40f49345
MAX32630FTHR QuadSPI test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
boonshen 0:a35c40f49345 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
boonshen 0:a35c40f49345 2 *
boonshen 0:a35c40f49345 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
boonshen 0:a35c40f49345 4 * and associated documentation files (the "Software"), to deal in the Software without
boonshen 0:a35c40f49345 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
boonshen 0:a35c40f49345 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
boonshen 0:a35c40f49345 7 * Software is furnished to do so, subject to the following conditions:
boonshen 0:a35c40f49345 8 *
boonshen 0:a35c40f49345 9 * The above copyright notice and this permission notice shall be included in all copies or
boonshen 0:a35c40f49345 10 * substantial portions of the Software.
boonshen 0:a35c40f49345 11 *
boonshen 0:a35c40f49345 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
boonshen 0:a35c40f49345 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
boonshen 0:a35c40f49345 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
boonshen 0:a35c40f49345 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
boonshen 0:a35c40f49345 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
boonshen 0:a35c40f49345 17 */
boonshen 0:a35c40f49345 18
boonshen 0:a35c40f49345 19 #ifndef USBCDC_H
boonshen 0:a35c40f49345 20 #define USBCDC_H
boonshen 0:a35c40f49345 21
boonshen 0:a35c40f49345 22 /* These headers are included for child class. */
boonshen 0:a35c40f49345 23 #include "USBEndpoints.h"
boonshen 0:a35c40f49345 24 #include "USBDescriptor.h"
boonshen 0:a35c40f49345 25 #include "USBDevice_Types.h"
boonshen 0:a35c40f49345 26
boonshen 0:a35c40f49345 27 #include "USBDevice.h"
boonshen 0:a35c40f49345 28
boonshen 0:a35c40f49345 29 class USBCDC: public USBDevice {
boonshen 0:a35c40f49345 30 public:
boonshen 0:a35c40f49345 31
boonshen 0:a35c40f49345 32 /*
boonshen 0:a35c40f49345 33 * Constructor
boonshen 0:a35c40f49345 34 *
boonshen 0:a35c40f49345 35 * @param vendor_id Your vendor_id
boonshen 0:a35c40f49345 36 * @param product_id Your product_id
boonshen 0:a35c40f49345 37 * @param product_release Your preoduct_release
boonshen 0:a35c40f49345 38 * @param connect_blocking define if the connection must be blocked if USB not plugged in
boonshen 0:a35c40f49345 39 */
boonshen 0:a35c40f49345 40 USBCDC(uint16_t vendor_id, uint16_t product_id, uint16_t product_release, bool connect_blocking);
boonshen 0:a35c40f49345 41
boonshen 0:a35c40f49345 42 protected:
boonshen 0:a35c40f49345 43
boonshen 0:a35c40f49345 44 /*
boonshen 0:a35c40f49345 45 * Get device descriptor. Warning: this method has to store the length of the report descriptor in reportLength.
boonshen 0:a35c40f49345 46 *
boonshen 0:a35c40f49345 47 * @returns pointer to the device descriptor
boonshen 0:a35c40f49345 48 */
boonshen 0:a35c40f49345 49 virtual uint8_t * deviceDesc();
boonshen 0:a35c40f49345 50
boonshen 0:a35c40f49345 51 /*
boonshen 0:a35c40f49345 52 * Get string product descriptor
boonshen 0:a35c40f49345 53 *
boonshen 0:a35c40f49345 54 * @returns pointer to the string product descriptor
boonshen 0:a35c40f49345 55 */
boonshen 0:a35c40f49345 56 virtual uint8_t * stringIproductDesc();
boonshen 0:a35c40f49345 57
boonshen 0:a35c40f49345 58 /*
boonshen 0:a35c40f49345 59 * Get string interface descriptor
boonshen 0:a35c40f49345 60 *
boonshen 0:a35c40f49345 61 * @returns pointer to the string interface descriptor
boonshen 0:a35c40f49345 62 */
boonshen 0:a35c40f49345 63 virtual uint8_t * stringIinterfaceDesc();
boonshen 0:a35c40f49345 64
boonshen 0:a35c40f49345 65 /*
boonshen 0:a35c40f49345 66 * Get configuration descriptor
boonshen 0:a35c40f49345 67 *
boonshen 0:a35c40f49345 68 * @returns pointer to the configuration descriptor
boonshen 0:a35c40f49345 69 */
boonshen 0:a35c40f49345 70 virtual uint8_t * configurationDesc();
boonshen 0:a35c40f49345 71
boonshen 0:a35c40f49345 72 /*
boonshen 0:a35c40f49345 73 * Send a buffer
boonshen 0:a35c40f49345 74 *
boonshen 0:a35c40f49345 75 * @param endpoint endpoint which will be sent the buffer
boonshen 0:a35c40f49345 76 * @param buffer buffer to be sent
boonshen 0:a35c40f49345 77 * @param size length of the buffer
boonshen 0:a35c40f49345 78 * @returns true if successful
boonshen 0:a35c40f49345 79 */
boonshen 0:a35c40f49345 80 bool send(uint8_t * buffer, uint32_t size);
boonshen 0:a35c40f49345 81
boonshen 0:a35c40f49345 82 /*
boonshen 0:a35c40f49345 83 * Read a buffer from a certain endpoint. Warning: blocking
boonshen 0:a35c40f49345 84 *
boonshen 0:a35c40f49345 85 * @param endpoint endpoint to read
boonshen 0:a35c40f49345 86 * @param buffer buffer where will be stored bytes
boonshen 0:a35c40f49345 87 * @param size the number of bytes read will be stored in *size
boonshen 0:a35c40f49345 88 * @param maxSize the maximum length that can be read
boonshen 0:a35c40f49345 89 * @returns true if successful
boonshen 0:a35c40f49345 90 */
boonshen 0:a35c40f49345 91 bool readEP(uint8_t * buffer, uint32_t * size);
boonshen 0:a35c40f49345 92
boonshen 0:a35c40f49345 93 /*
boonshen 0:a35c40f49345 94 * Read a buffer from a certain endpoint. Warning: non blocking
boonshen 0:a35c40f49345 95 *
boonshen 0:a35c40f49345 96 * @param endpoint endpoint to read
boonshen 0:a35c40f49345 97 * @param buffer buffer where will be stored bytes
boonshen 0:a35c40f49345 98 * @param size the number of bytes read will be stored in *size
boonshen 0:a35c40f49345 99 * @param maxSize the maximum length that can be read
boonshen 0:a35c40f49345 100 * @returns true if successful
boonshen 0:a35c40f49345 101 */
boonshen 0:a35c40f49345 102 bool readEP_NB(uint8_t * buffer, uint32_t * size);
boonshen 0:a35c40f49345 103
boonshen 0:a35c40f49345 104 /*
boonshen 0:a35c40f49345 105 * Called by USBCallback_requestCompleted when CDC line coding is changed
boonshen 0:a35c40f49345 106 * Warning: Called in ISR
boonshen 0:a35c40f49345 107 *
boonshen 0:a35c40f49345 108 * @param baud The baud rate
boonshen 0:a35c40f49345 109 * @param bits The number of bits in a word (5-8)
boonshen 0:a35c40f49345 110 * @param parity The parity
boonshen 0:a35c40f49345 111 * @param stop The number of stop bits (1 or 2)
boonshen 0:a35c40f49345 112 */
boonshen 0:a35c40f49345 113 virtual void lineCodingChanged(int baud, int bits, int parity, int stop) {};
boonshen 0:a35c40f49345 114
boonshen 0:a35c40f49345 115 protected:
boonshen 0:a35c40f49345 116 virtual bool USBCallback_request();
boonshen 0:a35c40f49345 117 virtual void USBCallback_requestCompleted(uint8_t *buf, uint32_t length);
boonshen 0:a35c40f49345 118 virtual bool USBCallback_setConfiguration(uint8_t configuration);
boonshen 0:a35c40f49345 119 volatile bool terminal_connected;
boonshen 0:a35c40f49345 120
boonshen 0:a35c40f49345 121 };
boonshen 0:a35c40f49345 122
boonshen 0:a35c40f49345 123 #endif