ps_sched_main.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (c) 2021 Alibaba Group. All rights reserved.
  3. * License-Identifier: Apache-2.0
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  6. * 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, WITHOUT
  13. * 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. */
  18. #include <stdint.h>
  19. #include <stdio.h>
  20. #include <stdlib.h>
  21. #include <string.h>
  22. #include <xtensa/corebits.h>
  23. #include <xtensa/xtruntime.h>
  24. #if HAVE_THREADS_XOS
  25. #include <xtensa/xos.h>
  26. #endif
  27. #include "xrp_api.h"
  28. #include "xrp_dsp_hw.h"
  29. #include "xrp_dsp_user.h"
  30. #include "dsp_ps_ns.h"
  31. #include "ps_sched.h"
  32. extern enum xrp_status ps_run_command(void *context,
  33. const void *in_data, size_t in_data_size,
  34. void *out_data, size_t out_data_size,
  35. struct xrp_buffer_group *buffer_group);
  36. void abort(void)
  37. {
  38. printf("abort() is called; halting\n");
  39. hang();
  40. }
  41. #ifdef DSP_TEST
  42. int main_ignre(void)
  43. #else
  44. int main(void)
  45. #endif
  46. {
  47. enum xrp_status status;
  48. struct xrp_device *device =NULL;
  49. ps_exception_init();
  50. xrp_hw_init();
  51. device = ps_xrp_device_int(0);
  52. if (NULL == device) {
  53. fprintf(stderr, "xrp_open_device failed\n");
  54. abort();
  55. }
  56. /**************wait sync from host***************************/
  57. if(0!=ps_wait_host_sync())
  58. {
  59. fprintf(stderr, "sync failed\n");
  60. abort();
  61. }
  62. if(0 != init_scheduler(device)){
  63. fprintf(stderr, "scheduler init failed\n");
  64. abort();
  65. }
  66. ps_dsp_init_done();
  67. ps_task_enable_common_task();
  68. ps_task_shedule(device);
  69. return 0;
  70. }