pkarashchenko commented on code in PR #14895: URL: https://github.com/apache/nuttx/pull/14895#discussion_r1852563021
########## include/nuttx/usb/stusb4500.h: ########## @@ -0,0 +1,140 @@ +/**************************************************************************** + * include/nuttx/usb/stusb4500.h + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_USB_STUSB4500_H +#define __INCLUDE_NUTTX_USB_STUSB4500_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/fs/ioctl.h> + +/**************************************************************************** + * Pre-Processor Declarations + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* IOCTL Commands ***********************************************************/ + +#define USBCIOC_READ_DEVID _USBCIOC(0x0001) /* Arg: uint8_t* pointer */ +#define USBCIOC_READ_PD_STATUS _USBCIOC(0x0002) /* Arg: uint8_t* pointer */ +#define USBCIOC_SET_PWR _USBCIOC(0x0003) /* Arg: uint8_t* pointer */ +#define USBCIOC_READ_PWR _USBCIOC(0x0004) /* Arg: uint8_t* pointer */ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +typedef union +{ + uint8_t bytes[4]; + struct + { + uint32_t operational_current : 10; + uint32_t voltage : 10; + uint8_t reserved_22_20 : 3; + uint8_t fast_role_req_cur : 2; /* must be set to 0 in 2.0 */ + uint8_t dual_role_data : 1; + uint8_t usb_communications_capable : 1; + uint8_t unconstrained_power : 1; + uint8_t higher_capability : 1; + uint8_t dual_role_power : 1; + uint8_t fixed_supply : 2; + } fix; + struct + { + uint32_t operating_current : 10; + uint32_t min_voltage : 10; + uint32_t max_voltage : 10; + uint8_t variablesupply : 2; + } var; + struct + { + uint32_t operating_power : 10; + uint32_t min_voltage : 10; + uint32_t max_voltage : 10; + uint8_t battery : 2; + } bat; +} +USB_PD_SNK_PDO_TYPEDEF __attribute__((__packed__)); Review Comment: We need to use packed attribute from compiler.h -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org