PD Buddy Sink Firmware
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

pdb.h 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * PD Buddy Firmware Library - USB Power Delivery for everyone
  3. * Copyright 2017-2018 Clayton G. Hobbs
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. #ifndef PDB_H
  18. #define PDB_H
  19. #include <pdb_fusb.h>
  20. #include <pdb_dpm.h>
  21. #include <pdb_pe.h>
  22. #include <pdb_prl.h>
  23. #include <pdb_int_n.h>
  24. #include <pdb_msg.h>
  25. /* Version information */
  26. #define PDB_LIB_VERSION "0.1.0"
  27. #define PDB_LIB_MAJOR 0
  28. #define PDB_LIB_MINOR 1
  29. #define PDB_LIB_PATCH 0
  30. /*
  31. * Structure for one USB port's PD Buddy firmware library configuration
  32. *
  33. * Contains working areas for statically allocated threads, and therefore must
  34. * be statically allocated!
  35. */
  36. struct pdb_config {
  37. /* User-initialized fields */
  38. /* Configuration information for the FUSB302B* chip */
  39. struct pdb_fusb_config fusb;
  40. /* DPM callbacks */
  41. struct pdb_dpm_callbacks dpm;
  42. /* Pointer to port-specific DPM data */
  43. void *dpm_data;
  44. /* Automatically initialized fields */
  45. /* Policy Engine thread and related variables */
  46. struct pdb_pe pe;
  47. /* Protocol layer threads and related variables */
  48. struct pdb_prl prl;
  49. /* INT_N pin thread and related variables */
  50. struct pdb_int_n int_n;
  51. };
  52. /*
  53. * Initialize the PD Buddy firmware library, starting all its threads
  54. *
  55. * The I2C driver must already be initialized before calling this function.
  56. */
  57. void pdb_init(struct pdb_config *);
  58. #endif /* PDB_H */