77 lines
1.4 KiB
C
Executable File
77 lines
1.4 KiB
C
Executable File
/*************************************************
|
|
File name : hal.h
|
|
Module :
|
|
Author : amir
|
|
Version : 0.1
|
|
Created on : 2022-02-07
|
|
Description :
|
|
hal interface function
|
|
|
|
Modify History:
|
|
1. Date: Author: Modification:
|
|
*************************************************/
|
|
|
|
#include "threadpool.h"
|
|
#include "hal.h"
|
|
#include "hal_interface_audio.h"
|
|
|
|
typedef struct
|
|
{
|
|
hloop_t *loop;
|
|
}hal_loop;
|
|
|
|
static hal_loop s_hal_loop;
|
|
|
|
int32_t hal_init(hloop_t* loop){
|
|
hlogd("%s",__func__);
|
|
s_hal_loop.loop = loop;
|
|
hal_audio_init();
|
|
return 0;
|
|
}
|
|
|
|
|
|
int32_t hal_deinit(){
|
|
memset(&s_hal_loop, 0, sizeof(s_hal_loop));
|
|
hlogd("%s",__func__);
|
|
return 0;
|
|
}
|
|
|
|
void hal_sub(uint32_t event, int32_t priority, hevent_cb cb){
|
|
if (s_hal_loop.loop)
|
|
{
|
|
return hloop_mmc_sub_event(s_hal_loop.loop, event, priority, cb);
|
|
}
|
|
}
|
|
|
|
void hal_unsub(uint32_t event, hevent_cb cb){
|
|
if (s_hal_loop.loop)
|
|
{
|
|
hloge("%s NOT SUPPORT YET", __func__);
|
|
}
|
|
}
|
|
|
|
void hal_pub(kpacket *packet){
|
|
if (s_hal_loop.loop)
|
|
{
|
|
hloop_mmc_pub_event(s_hal_loop.loop, packet);
|
|
}
|
|
}
|
|
|
|
htimer_t* hal_timer_start(htimer_cb cb, uint32_t timeout_ms, uint32_t repeat){
|
|
if (s_hal_loop.loop)
|
|
{
|
|
return htimer_add(s_hal_loop.loop, cb, timeout_ms, repeat);
|
|
}
|
|
}
|
|
|
|
void hal_timer_stop(htimer_t* timer){
|
|
if (timer)
|
|
{
|
|
htimer_del(timer);
|
|
}
|
|
}
|
|
|
|
void hal_dump(){
|
|
}
|
|
|