105 lines
2.4 KiB
C
105 lines
2.4 KiB
C
|
/*************************************************************************
|
||
|
File name : hal.h
|
||
|
Module : hal
|
||
|
Author :
|
||
|
Copyright :
|
||
|
Version : 0.1
|
||
|
Created on : 2022-04-27
|
||
|
Creator : amir.liang
|
||
|
Description :
|
||
|
hal init for lower driver
|
||
|
Modify History:
|
||
|
1. Date: Author: Modification:
|
||
|
***************************************************************************/
|
||
|
#ifndef __HAL_H__
|
||
|
#define __HAL_H__
|
||
|
#include <stdint.h>
|
||
|
#include "util.h"
|
||
|
#include "hloop.h"
|
||
|
#include "hbase.h"
|
||
|
#include "hsocket.h"
|
||
|
#include "ratelimit.h"
|
||
|
#include "kpacket.h"
|
||
|
#include "project_config.h"
|
||
|
#include "hlog.h"
|
||
|
|
||
|
|
||
|
typedef enum
|
||
|
{
|
||
|
FRAME_TYPE_AUDIO = 0x00, // Audio Frame
|
||
|
FRAME_TYPE_IFRAME = 0x01, // I Frame
|
||
|
FRAME_TYPE_PBFRAME = 0x02, // PB Frame
|
||
|
FRAME_TYPE_YV12 = 0x04, // YUV Frame
|
||
|
FRAME_TYPE_MAX
|
||
|
} HAL_FRAME_TYPE;
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
extern "C"
|
||
|
{
|
||
|
#endif /* __cplusplus */
|
||
|
|
||
|
|
||
|
/**
|
||
|
* save the PFN_EVENT_xxx callback, and init init_ld
|
||
|
* @param [in] subscribe for hal_sub
|
||
|
* @param [in] unsubscribe for hal_unsub
|
||
|
* @param [in] publish for hal_pub
|
||
|
* @return 0 ok
|
||
|
*/
|
||
|
int32_t hal_init(hloop_t* loop);
|
||
|
int32_t hal_deinit();
|
||
|
/**
|
||
|
* subscribe a event to event center
|
||
|
* @param [in] event to be subscribed
|
||
|
* @param [in] entry will a event trigger it will be callback
|
||
|
* @param [in] param callback to entry
|
||
|
* @return 0 ok
|
||
|
*/
|
||
|
void hal_sub(uint32_t event, int32_t priority, hevent_cb cb);
|
||
|
|
||
|
/**
|
||
|
* unsubscribe a event from event center
|
||
|
* note coz same event may be subscibe by many other modules,
|
||
|
* so we add 'entry' to match.
|
||
|
* @param [in] event to be unsubscribed
|
||
|
* @param [in] entry to be unsubscribed
|
||
|
* @return 0 ok
|
||
|
*/
|
||
|
void hal_unsub(uint32_t event, hevent_cb cb);
|
||
|
|
||
|
/**
|
||
|
* publish a event to event center, 'entry' will be triggered which subscribed this event
|
||
|
* so we add 'entry' to match.
|
||
|
* @param [in] packet will be send as 'entry(packet)'
|
||
|
* @return 0 ok
|
||
|
*/
|
||
|
void hal_pub(kpacket *packet);
|
||
|
|
||
|
|
||
|
/**
|
||
|
* start a loop timer actually to call 'entry' intevally
|
||
|
* @param [in] entry will be call intevally
|
||
|
* @param [in] param callback to entry
|
||
|
* @param [in] interval time to call entry
|
||
|
* @return htimer_t ok
|
||
|
*/
|
||
|
htimer_t* hal_timer_start(htimer_cb cb, uint32_t timeout_ms, uint32_t repeat);
|
||
|
|
||
|
|
||
|
/**
|
||
|
* stop a loop timer
|
||
|
* @param [in] entry will be stop(del)
|
||
|
* @return 0 ok
|
||
|
*/
|
||
|
void htimer_del(htimer_t *timer);
|
||
|
|
||
|
|
||
|
void hal_dump();
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif /* __cplusplus */
|
||
|
|
||
|
#endif
|
||
|
|