#include "devices.h"
#include "log.h"
-static list *dev_head;
+static GList *dev_head;
void add_device(const struct device_ops *dev)
{
- LIST_APPEND(dev_head, (struct device_ops*)dev);
+ SYS_G_LIST_APPEND(dev_head, (struct device_ops*)dev);
}
//LCOV_EXCL_START System Error
void remove_device(const struct device_ops *dev)
{
- LIST_REMOVE(dev_head, (struct device_ops*)dev);
+ SYS_G_LIST_REMOVE(dev_head, (struct device_ops*)dev);
}
//LCOV_EXCL_STOP
const struct device_ops *find_device(int type)
{
- list *elem;
+ GList *elem;
const struct device_ops *dev;
- LIST_FOREACH(dev_head, elem, dev) {
+ SYS_G_LIST_FOREACH(dev_head, elem, dev) {
if (dev->type == type)
return dev;
}
void devices_init(void)
{
- list *elem;
+ GList *elem;
const struct device_ops *dev;
- LIST_FOREACH(dev_head, elem, dev) {
+ SYS_G_LIST_FOREACH(dev_head, elem, dev) {
_D("[%s] initialize", dev->name);
if (dev->init)
dev->init();
void devices_exit(void)
{
- list *elem;
+ GList *elem;
const struct device_ops *dev;
- LIST_FOREACH(dev_head, elem, dev) {
+ SYS_G_LIST_FOREACH(dev_head, elem, dev) {
_D("[%s] deinitialize", dev->name);
if (dev->exit)
dev->exit();
int devices_play(int pattern, bool always)
{
- list *elem;
+ GList *elem;
const struct device_ops *dev;
int ret, prev = -EPERM;
- LIST_FOREACH(dev_head, elem, dev) {
+ SYS_G_LIST_FOREACH(dev_head, elem, dev) {
if (dev->play) {
ret = dev->play(pattern, always);
if ((prev < 0 && ret == 0) ||
int devices_play_soundpath(int pattern, const char *soundpath, bool always)
{
- list *elem;
+ GList *elem;
const struct device_ops *dev;
int ret, prev = -EPERM;
- LIST_FOREACH(dev_head, elem, dev) {
+ SYS_G_LIST_FOREACH(dev_head, elem, dev) {
if (dev->type == FEEDBACK_TYPE_SOUND) {
if (dev->play_path)
ret = dev->play_path(pattern, soundpath, always);
int devices_stop(void)
{
- list *elem;
+ GList *elem;
const struct device_ops *dev;
int ret = -ENOTSUP;
- LIST_FOREACH(dev_head, elem, dev) {
+ SYS_G_LIST_FOREACH(dev_head, elem, dev) {
if (dev->stop)
ret = dev->stop();
}