-
-
Notifications
You must be signed in to change notification settings - Fork 31
Resource helper API Documentation
thom_tl edited this page Jul 24, 2019
·
4 revisions
To help with parsing objects like _CRS (ACPI 6.3 Specification 6.2.2) and _PRS (ACPI 6.3 Specification 6.2.12) LAI provides a helper API
/* These functions are in <lai/helpers/resource.h> */
/* All different types of resources that can be iterated by lai_resource_iterate() */
enum lai_resource_type {
LAI_RESOURCE_NULL,
LAI_RESOURCE_IRQ,
LAI_RESOURCE_DMA,
LAI_RESOURCE_IO,
LAI_RESOURCE_MEM,
LAI_RESOURCE_VENDOR,
LAI_RESOURCE_REGISTER,
};
// Initializes the lai_resource_view via a designated initializer
#define LAI_RESOURCE_VIEW_INITIALIZER(crs_var) /*[...]*/
/* Iterates to the next resource in the buffer */
lai_api_error_t lai_resource_iterate(struct lai_resource_view *);
/* Gets the type of the current resource */
enum lai_resource_type lai_resource_get_type(struct lai_resource_view *);
/* Since ACPI IRQ Resources can have multiple IRQs in one resource this function is provided to iterate
* over all IRQs in this resource */
lai_api_error_t lai_resource_next_irq(struct lai_resource_view *iterator);
struct lai_resource_view it = LAI_RESOURCE_VIEW_INITIALIZER(crs_node);
lai_api_error_t e;
while(!(e = lai_resource_iterate(&view))) {
enum lai_resource_type type = lai_resource_get_type(&view);
switch(type) {
// [...]
}
}
if (e != LAI_ERROR_END_REACHED)
// An error occurred during enumeration.