{"id":10788,"date":"2020-09-11T14:12:01","date_gmt":"2020-09-11T12:12:01","guid":{"rendered":"https:\/\/demdlx704as001.ad.harman.com\/?p=10788"},"modified":"2020-09-11T17:32:55","modified_gmt":"2020-09-11T15:32:55","slug":"platform-api","status":"publish","type":"post","link":"https:\/\/audioworx.transfunnel.co\/old\/?p=10788","title":{"rendered":"Platform API"},"content":{"rendered":"<p><span style=\"text-decoration: underline;\"><strong>AudioCore API updates<\/strong><\/span><\/p>\n<p><strong><em>DequeueAll<\/em><\/strong><\/p>\n<p>There is a new public method in AudioCore that can be used to force dequeueing all messages.<\/p>\n<p><em>void AudioCore::dequeueAll();<\/em><\/p>\n<p>This method simply calls the normal dequeue method with unlimited time.\u00a0 It doesn&#8217;t have a purpose in the normal use of AudioCore but is provided in case there is a situation where a message MUST be processed immediately.<\/p>\n<p><strong><em>AudioCore Buffer Changes<\/em><\/strong><\/p>\n<p>The alignment requirements for AudioCore buffers are updated.\u00a0 The buffers must now be 16 byte aligned.\u00a0 This change is driven by the requirement in <em>AudioProcessing<\/em>.\u00a0 Note if you use <em>AudioProcessing<\/em> directly you will have to ensure those buffers are 16 byte aligned too.<\/p>\n<p>To be clear, each buffer within inputs (inputs[0], inputs[1]) must be allocated on a\u00a0 16 byte boundry.<\/p>\n<p><em>xAF_Error AudioCore::calc(xAFAudio** inputs, xAFAudio** outputs);<\/em><\/p>\n<p><em>xAF_Error CAudioProcessing::calc(xAFAudio** inputs, xAFAudio** outputs)<\/em><\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Hardware Abstraction Layer (HAL) updates<\/strong><\/span><\/p>\n<p>Following are the additions to the HAL APIs:<\/p>\n<p>\/**<br \/>\n* \\brief Create the HAL instance in parallel to core class using singleton design pattern method.<br \/>\n* If the API is called first time and instance is not created, API will create instance.<br \/>\n* Otherwise it will return an error for trying to create the singleton twice.<br \/>\n* \\param alloc function for allocating memory<br \/>\n* \\param dealloc function for deallocating memory<br \/>\n* \\param osal pointer to application OSAL<br \/>\n* \\return xAF_SUCCESS after successfull instantiation of HAL instance<br \/>\n*\/<br \/>\nstatic xAF_Error createHalInstance(memAllocRef alloc, memDeAllocRef dealloc, COsal* osal);<\/p>\n<p><span style=\"text-decoration: underline;\"><strong>OS Abstraction Layer (OSAL)<br \/>\n<\/strong><\/span><\/p>\n<p>The audio framework and HAL can access OS resources by using the COsal supported by the target platform. The OSAL exposes APIs that can be used by audio framework and HAL to perform their tasks. COsal should be instantiated by the platform similar to instantiating core class. COsal should be instantiated once per device and same instance should be registered for multiple instances of core class or framework instance. The APIs in COsal class are listed below.<\/p>\n<p>\/**<br \/>\n* Creates a semaphore object, allocates required resources and assigns the values of maxValue and initialValue to it.<br \/>\n* \\param maxValue Maximum count value for the semaphore object<br \/>\n* \\param initialValue Initial value for the semaphore object<br \/>\n* \\return Pointer to semaphore object.<br \/>\n*\/<br \/>\nvirtual XAF_OSAL_SEM_HANDLE* osalSemCreate(xUInt8 maxValue, xUInt8 initialValue) const = 0;<\/p>\n<p>\/**<br \/>\n* Deletes the semaphore object and releases the allocated resources<br \/>\n* \\param sem Semaphore object to be deleted<br \/>\n* \\return xAF_SUCCESS when successful otherwise errorcode.<br \/>\n*\/<br \/>\nvirtual xAF_Error osalSemDestroy(XAF_OSAL_SEM_HANDLE* sem) const = 0;<\/p>\n<p>\/**<br \/>\n* \\brief Takes the semaphore object if it is available. Otherwise the calling task or thread<br \/>\n* will be blocked. This should not be called from interrupt service routine.<br \/>\n* \\param sem Semaphore object for synchronization<br \/>\n* \\return xAF_SUCCESS when successful otherwise errorcode.<br \/>\n*\/<br \/>\nvirtual xAF_Error osalSemWait(XAF_OSAL_SEM_HANDLE* sem) const = 0;<\/p>\n<p>\/**<br \/>\n* \\brief Takes the semaphore object if it is available. If the semaphore is not available,<br \/>\n* the calling task or thread will not be blocked.<br \/>\n* \\param sem Semaphore object for synchronization<br \/>\n* \\return xAF_SUCCESS when successful otherwise errorcode.<br \/>\n*\/<br \/>\nvirtual xAF_Error osalSemTryWait(XAF_OSAL_SEM_HANDLE* sem) const = 0;<\/p>\n<p>\/**<br \/>\n* Releases or signals the semaphore object.<br \/>\n* \\param sem Semaphore object for synchronization<br \/>\n* \\return xAF_SUCCESS when successful otherwise errorcode.<br \/>\n*\/<br \/>\nvirtual xAF_Error osalSemPost(XAF_OSAL_SEM_HANDLE* sem) const = 0;<\/p>\n<p>\/**<br \/>\n* \\brief Enables protection for shared resources from concurrency access<br \/>\n* The instructions below this API will be executed atomically<br \/>\n* \\return xAF_SUCCESS when successful otherwise errorcode.<br \/>\n*\/<br \/>\nvirtual xAF_Error osalEnterCriticalRegion() const = 0;<\/p>\n<p>\/**<br \/>\n* \\brief Disables protection for shared resources from concurrency access<br \/>\n* The instructions above this API will be executed atomically<br \/>\n* \\return xAF_SUCCESS when successful otherwise errorcode.<br \/>\n*\/<br \/>\nvirtual xAF_Error osalExitCriticalRegion() const = 0;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>AudioCore API updates DequeueAll There is a new public method in AudioCore that can be used to force dequeueing all messages. void AudioCore::dequeueAll(); This method simply calls the normal dequeue method with unlimited time.\u00a0 It doesn&#8217;t have a purpose in the normal use of AudioCore but is provided in case there is a situation where [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"","ocean_second_sidebar":"","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"","ocean_custom_header_template":"","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"","ocean_menu_typo_font_family":"","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"","footnotes":"","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[]},"categories":[1],"tags":[],"coauthors":[165],"_links":{"self":[{"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/posts\/10788"}],"collection":[{"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10788"}],"version-history":[{"count":6,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/posts\/10788\/revisions"}],"predecessor-version":[{"id":10836,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=\/wp\/v2\/posts\/10788\/revisions\/10836"}],"wp:attachment":[{"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10788"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10788"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10788"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/audioworx.transfunnel.co\/old\/index.php?rest_route=%2Fwp%2Fv2%2Fcoauthors&post=10788"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}