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 USBCLASS_HID_TYPES
boonshen 0:a35c40f49345 20 #define USBCLASS_HID_TYPES
boonshen 0:a35c40f49345 21
boonshen 0:a35c40f49345 22 #include <stdint.h>
boonshen 0:a35c40f49345 23
boonshen 0:a35c40f49345 24 /* */
boonshen 0:a35c40f49345 25 #define HID_VERSION_1_11 (0x0111)
boonshen 0:a35c40f49345 26
boonshen 0:a35c40f49345 27 /* HID Class */
boonshen 0:a35c40f49345 28 #define HID_CLASS (3)
boonshen 0:a35c40f49345 29 #define HID_SUBCLASS_NONE (0)
boonshen 0:a35c40f49345 30 #define HID_PROTOCOL_NONE (0)
boonshen 0:a35c40f49345 31
boonshen 0:a35c40f49345 32 /* Descriptors */
boonshen 0:a35c40f49345 33 #define HID_DESCRIPTOR (33)
boonshen 0:a35c40f49345 34 #define HID_DESCRIPTOR_LENGTH (0x09)
boonshen 0:a35c40f49345 35 #define REPORT_DESCRIPTOR (34)
boonshen 0:a35c40f49345 36
boonshen 0:a35c40f49345 37 /* Class requests */
boonshen 0:a35c40f49345 38 #define GET_REPORT (0x1)
boonshen 0:a35c40f49345 39 #define GET_IDLE (0x2)
boonshen 0:a35c40f49345 40 #define SET_REPORT (0x9)
boonshen 0:a35c40f49345 41 #define SET_IDLE (0xa)
boonshen 0:a35c40f49345 42
boonshen 0:a35c40f49345 43 /* HID Class Report Descriptor */
boonshen 0:a35c40f49345 44 /* Short items: size is 0, 1, 2 or 3 specifying 0, 1, 2 or 4 (four) bytes */
boonshen 0:a35c40f49345 45 /* of data as per HID Class standard */
boonshen 0:a35c40f49345 46
boonshen 0:a35c40f49345 47 /* Main items */
boonshen 0:a35c40f49345 48 #define INPUT(size) (0x80 | size)
boonshen 0:a35c40f49345 49 #define OUTPUT(size) (0x90 | size)
boonshen 0:a35c40f49345 50 #define FEATURE(size) (0xb0 | size)
boonshen 0:a35c40f49345 51 #define COLLECTION(size) (0xa0 | size)
boonshen 0:a35c40f49345 52 #define END_COLLECTION(size) (0xc0 | size)
boonshen 0:a35c40f49345 53
boonshen 0:a35c40f49345 54 /* Global items */
boonshen 0:a35c40f49345 55 #define USAGE_PAGE(size) (0x04 | size)
boonshen 0:a35c40f49345 56 #define LOGICAL_MINIMUM(size) (0x14 | size)
boonshen 0:a35c40f49345 57 #define LOGICAL_MAXIMUM(size) (0x24 | size)
boonshen 0:a35c40f49345 58 #define PHYSICAL_MINIMUM(size) (0x34 | size)
boonshen 0:a35c40f49345 59 #define PHYSICAL_MAXIMUM(size) (0x44 | size)
boonshen 0:a35c40f49345 60 #define UNIT_EXPONENT(size) (0x54 | size)
boonshen 0:a35c40f49345 61 #define UNIT(size) (0x64 | size)
boonshen 0:a35c40f49345 62 #define REPORT_SIZE(size) (0x74 | size)
boonshen 0:a35c40f49345 63 #define REPORT_ID(size) (0x84 | size)
boonshen 0:a35c40f49345 64 #define REPORT_COUNT(size) (0x94 | size)
boonshen 0:a35c40f49345 65 #define PUSH(size) (0xa4 | size)
boonshen 0:a35c40f49345 66 #define POP(size) (0xb4 | size)
boonshen 0:a35c40f49345 67
boonshen 0:a35c40f49345 68 /* Local items */
boonshen 0:a35c40f49345 69 #define USAGE(size) (0x08 | size)
boonshen 0:a35c40f49345 70 #define USAGE_MINIMUM(size) (0x18 | size)
boonshen 0:a35c40f49345 71 #define USAGE_MAXIMUM(size) (0x28 | size)
boonshen 0:a35c40f49345 72 #define DESIGNATOR_INDEX(size) (0x38 | size)
boonshen 0:a35c40f49345 73 #define DESIGNATOR_MINIMUM(size) (0x48 | size)
boonshen 0:a35c40f49345 74 #define DESIGNATOR_MAXIMUM(size) (0x58 | size)
boonshen 0:a35c40f49345 75 #define STRING_INDEX(size) (0x78 | size)
boonshen 0:a35c40f49345 76 #define STRING_MINIMUM(size) (0x88 | size)
boonshen 0:a35c40f49345 77 #define STRING_MAXIMUM(size) (0x98 | size)
boonshen 0:a35c40f49345 78 #define DELIMITER(size) (0xa8 | size)
boonshen 0:a35c40f49345 79
boonshen 0:a35c40f49345 80 /* HID Report */
boonshen 0:a35c40f49345 81 /* Where report IDs are used the first byte of 'data' will be the */
boonshen 0:a35c40f49345 82 /* report ID and 'length' will include this report ID byte. */
boonshen 0:a35c40f49345 83
boonshen 0:a35c40f49345 84 #define MAX_HID_REPORT_SIZE (64)
boonshen 0:a35c40f49345 85
boonshen 0:a35c40f49345 86 typedef struct {
boonshen 0:a35c40f49345 87 uint32_t length;
boonshen 0:a35c40f49345 88 uint8_t data[MAX_HID_REPORT_SIZE];
boonshen 0:a35c40f49345 89 } HID_REPORT;
boonshen 0:a35c40f49345 90
boonshen 0:a35c40f49345 91 #endif