| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2008, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: $ |
|---|
| 11 | * $brcm_Revision: $ |
|---|
| 12 | * $brcm_Date: $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: $ |
|---|
| 19 | * |
|---|
| 20 | ***************************************************************************/ |
|---|
| 21 | #ifndef CAD_PARSER_H__ |
|---|
| 22 | #define CAD_PARSER_H__ |
|---|
| 23 | |
|---|
| 24 | #include "bdispatch.h" |
|---|
| 25 | |
|---|
| 26 | #define CAD_DESCRIPTOR_TAG 0x87 |
|---|
| 27 | |
|---|
| 28 | #define CAD_LENGTH_OFFSET 1 /* offset relative to CAD descriptor header */ |
|---|
| 29 | #define CAD_RATING_REGION_OFFSET 2 |
|---|
| 30 | |
|---|
| 31 | #define CAD_MAX_RATING_REGIONS 8 /* maximum rating regions, 1 - 8 */ |
|---|
| 32 | #define CAD_MAX_RATING_VALUE 8 /* maximum rating value for each rating region */ |
|---|
| 33 | |
|---|
| 34 | typedef struct { |
|---|
| 35 | uint8_t rating_dimension_j; /* dimension index */ |
|---|
| 36 | uint8_t rating_value; /* 4 bits rating value */ |
|---|
| 37 | } cad_rating, *pcad_rating; |
|---|
| 38 | |
|---|
| 39 | typedef struct { |
|---|
| 40 | uint8_t rating_region; /* rating region */ |
|---|
| 41 | uint8_t rated_dimensions; /* rated dimension */ |
|---|
| 42 | cad_rating rating[CAD_MAX_RATING_VALUE]; |
|---|
| 43 | } cad_rating_region, *pcad_rating_region; |
|---|
| 44 | |
|---|
| 45 | typedef struct { |
|---|
| 46 | uint8_t length; /* length of rating region descriptor */ |
|---|
| 47 | uint8_t rating_region_count; /* rating region for which the data is defined */ |
|---|
| 48 | cad_rating_region rr[CAD_MAX_RATING_REGIONS]; |
|---|
| 49 | } cad_descriptor, *pcad_descriptor; |
|---|
| 50 | |
|---|
| 51 | int cad_parser(const uint8_t *cad_buf, size_t size, cad_descriptor *cad_desc); |
|---|
| 52 | uint8_t *cad_get_descriptor(const uint8_t *cad_buf, int index, size_t *psize); |
|---|
| 53 | void cad_dump_descriptor(const uint8_t *cad_buf, cad_descriptor *cad_desc); |
|---|
| 54 | |
|---|
| 55 | #endif /* CAD_PARSER_H__ */ |
|---|