Skip to content
Snippets Groups Projects
Select Git revision
  • db0d459dbff208399866bccc9f4b26f3b6c48ddc
  • master default protected
  • sonopard/display-pixels-drawimage
  • TilCreator/firmware-master
  • rahix/simple_menu
  • genofire/leds_rgb_get_state
  • genofire/rockets-state
  • genofire/ble-follow-py
  • hauke/ble-cleanups
  • plaetzchen/ios-workaround
  • blinkisync-as-preload
  • genofire/haule-ble-fs-deactive
  • schneider/max30001-pycardium
  • schneider/max30001-epicaridum
  • schneider/max30001
  • schneider/stream-locks
  • ios-workarounds
  • schneider/fundamental-test
  • schneider/ble-buffers
  • schneider/maxim-sdk-update
  • ch3/splashscreen
  • v1.8
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
  • bootloader-v1
  • v0.0
33 results

descriptors.h

  • Forked from card10 / firmware
    Source project has a limited visibility.
    descriptors.h 6.39 KiB
    /*******************************************************************************
     * Copyright (C) 2017 Maxim Integrated Products, Inc., All Rights Reserved.
     *
     * Permission is hereby granted, free of charge, to any person obtaining a
     * copy of this software and associated documentation files (the "Software"),
     * to deal in the Software without restriction, including without limitation
     * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     * and/or sell copies of the Software, and to permit persons to whom the
     * Software is furnished to do so, subject to the following conditions:
     *
     * The above copyright notice and this permission notice shall be included
     * in all copies or substantial portions of the Software.
     *
     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
     * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
     * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
     * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
     * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
     * OTHER DEALINGS IN THE SOFTWARE.
     *
     * Except as contained in this notice, the name of Maxim Integrated
     * Products, Inc. shall not be used except as stated in the Maxim Integrated
     * Products, Inc. Branding Policy.
     *
     * The mere transfer of this software does not imply any licenses
     * of trade secrets, proprietary technology, copyrights, patents,
     * trademarks, maskwork rights, or any other form of intellectual
     * property whatsoever. Maxim Integrated Products, Inc. retains all
     * ownership rights.
     *
     * Description: Communications Device Class ACM (Serial Port) over USB
     * $Id: descriptors.h 31172 2017-10-05 19:05:57Z zach.metzinger $
     *
     *******************************************************************************
     */
    
    #ifndef _DESCRIPTORS_H_
    #define _DESCRIPTORS_H_
    
    #include <stdint.h>
    #include "usb.h"
    #include "hid_kbd.h"
    
    usb_device_descriptor_t __attribute__((aligned(4))) device_descriptor = {
        0x12,         /* bLength = 18                     */
        0x01,         /* bDescriptorType = Device         */
        0x0110,       /* bcdUSB USB spec rev (BCD)        */
        0x00,         /* bDeviceClass = mass storage (0)  */
        0x00,         /* bDeviceSubClass                  */
        0x00,         /* bDeviceProtocol                  */
        0x40,         /* bMaxPacketSize0 is 64 bytes      */
        0x0B6A,       /* idVendor (Maxim Integrated)      */
        0x4402,       /* idProduct                        */
        0x0100,       /* bcdDevice                        */
        0x01,         /* iManufacturer Descriptor ID      */
        0x02,         /* iProduct Descriptor ID           */
        0x03,         /* iSerialNumber = (0) No string    */
        0x01          /* bNumConfigurations               */
    };
    
    __attribute__((aligned(4)))
    struct __attribute__((packed)) {
        usb_configuration_descriptor_t  config_descriptor;
        usb_interface_descriptor_t      msc_interface_descriptor;
        usb_endpoint_descriptor_t       endpoint_descriptor_1;
        usb_endpoint_descriptor_t       endpoint_descriptor_2;
    } config_descriptor =
    {
        {
            0x09,       /*  bLength = 9                     */
            0x02,       /*  bDescriptorType = Config (2)    */
            0x0020,     /*  wTotalLength(L/H)               */
            0x01,       /*  bNumInterfaces                  */
            0x01,       /*  bConfigValue                    */
            0x00,       /*  iConfiguration                  */
            0xC0,       /*  bmAttributes (self-powered, no remote wakeup) */
            0x01,       /*  MaxPower is 2ma (units are 2ma/bit) */
        },
        { /*  First Interface Descriptor For MSC Interface */
            0x09,       /*  bLength = 9                     */
            0x04,       /*  bDescriptorType = Interface (4) */
            0x00,       /*  bInterfaceNumber                */
            0x00,       /*  bAlternateSetting               */
            0x02,       /*  bNumEndpoints (one for INm one for OUT)     */
            0x08,       /*  bInterfaceClass = Mass Storage (8) */
            0x06,       /*  bInterfaceSubClass = SCSI Transparent Command Set */
            0x50,       /*  bInterfaceProtocol = Bulk-Only Transport */
            0x00,       /*  iInterface                      */
        },
        { /*  OUT Endpoint 1 (Descriptor #1) */
            0x07,         /*  bLength                          */
            0x05,         /*  bDescriptorType (Endpoint)       */
            0x01,         /*  bEndpointAddress (EP1-OUT)       */
            0x02,         /*  bmAttributes (bulk)              */
            0x0040,       /*  wMaxPacketSize                   */
            0x00,         /*  bInterval (N/A)                  */
        },
        { /*  IN Endpoint 2 (Descriptor #2) */
            0x07,         /*  bLength                          */
            0x05,         /*  bDescriptorType (Endpoint)       */
            0x82,         /*  bEndpointAddress (EP2-IN)        */
            0x02,         /*  bmAttributes (bulk)              */
            0x0040,       /*  wMaxPacketSize                   */
            0x00          /*  bInterval (N/A)                  */
        }
    };
    
    __attribute__((aligned(4)))
    uint8_t lang_id_desc[] = {
        0x04,         /* bLength */
        0x03,         /* bDescriptorType */
        0x09, 0x04    /* bString = wLANGID (see usb_20.pdf 9.6.7 String) */
    };
    
    __attribute__((aligned(4)))
    uint8_t mfg_id_desc[] = {
        0x22,         /* bLength */
        0x03,         /* bDescriptorType */
        'M', 0,
        'a', 0,
        'x', 0,
        'i', 0,
        'm', 0,
        ' ', 0,
        'I', 0,
        'n', 0,
        't', 0,
        'e', 0,
        'g', 0,
        'r', 0,
        'a', 0,
        't', 0,
        'e', 0,
        'd', 0,
    };
    
    __attribute__((aligned(4)))
    uint8_t prod_id_desc[] = {
      0x38,                 /* bLength */
      0x03,                 /* bDescriptorType */
      'M', 0,
      'A', 0,
      'X', 0,
      'U', 0,
      'S', 0,
      'B', 0,
      ' ', 0,
      'M', 0,
      'a', 0,
      's', 0,
      's', 0,
      ' ', 0,
      'S', 0,
      't', 0,
      'o', 0,
      'r', 0,
      'a', 0,
      'g', 0,
      'e', 0,
      ' ', 0,
      'E', 0,
      'x', 0,
      'a', 0,
      'm', 0,
      'p', 0,
      'l', 0,
      'e', 0,
    };
    
    /* Not currently used (see device descriptor), but could be enabled if desired */
    __attribute__((aligned(4)))
    uint8_t serial_id_desc[] = {
      26,                     /* bLength */
      0x03,                   /* bDescriptorType */
      '0',0,                              
      '0',0,
      '0',0,
      '0',0,
      '0',0,
      '0',0,
      '0',0,
      '0',0,
      '0',0,
      '0',0,
      '0',0,
      '1',0
    };
    
    #endif /* _DESCRIPTORS_H_ */