未验证 提交 e01a43f2 编写于 作者: O openharmony_ci 提交者: Gitee

!618 sync bes hal apis from master

Merge pull request !618 from weidong1987/OpenHarmony-3.1-Release
......@@ -69,26 +69,10 @@ typedef int32_t (*oem_gpio_irq_handler_t)(uint16_t gpio, void *data);
#define OCTALNUM 8
static struct GpioCntlr g_gpioCntlr;
struct OemGpioIrqHandler {
uint8_t port;
GpioIrqFunc func;
void *arg;
};
enum HAL_GPIO_PIN_T g_gpioPinReflectionMap[HAL_GPIO_PIN_LED_NUM] = {0};
static struct HAL_GPIO_IRQ_CFG_T g_gpioIrqCfg[HAL_GPIO_PIN_LED_NUM] = {0};
static struct HAL_GPIO_IRQ_CFG_T HalGpioGetIrqConfig(enum HAL_GPIO_PIN_T pin)
{
struct HAL_GPIO_IRQ_CFG_T irqCfg;
irqCfg.irq_enable = g_gpioIrqCfg[pin].irq_enable;
irqCfg.irq_debounce = g_gpioIrqCfg[pin].irq_debounce;
irqCfg.irq_type = g_gpioIrqCfg[pin].irq_type;
irqCfg.irq_polarity = g_gpioIrqCfg[pin].irq_polarity;
return irqCfg;
}
static struct HAL_GPIO_IRQ_CFG_T g_gpioIrqCfg[HAL_GPIO_PIN_LED_NUM] = {0};
static void OemGpioIrqHdl(enum HAL_GPIO_PIN_T pin)
{
......@@ -216,8 +200,7 @@ static uint32_t GetGpioDeviceResource(struct GpioDevice *device)
return HDF_SUCCESS;
}
#else
static uint32_t GetGpioDeviceResource(
struct GpioDevice *device, const struct DeviceResourceNode *resourceNode)
static uint32_t GetGpioDeviceResource(struct GpioDevice *device, const struct DeviceResourceNode *resourceNode)
{
uint32_t relPin;
int32_t ret;
......@@ -271,12 +254,10 @@ static uint32_t GetGpioDeviceResource(
return HDF_FAILURE;
}
}
return HDF_SUCCESS;
}
#endif
static int32_t AttachGpioDevice(struct GpioCntlr *gpioCntlr, struct HdfDeviceObject *device)
{
int32_t ret;
......@@ -302,12 +283,12 @@ static int32_t AttachGpioDevice(struct GpioCntlr *gpioCntlr, struct HdfDeviceObj
ret = GetGpioDeviceResource(gpioDevice, device->property);
#endif
if (ret != HDF_SUCCESS) {
(void)OsalMemFree(gpioDevice);
OsalMemFree(gpioDevice);
return HDF_FAILURE;
}
gpioCntlr->count = gpioDevice->resource.pinNum;
gpioCntlr->priv = (void *)gpioDevice;
return HDF_SUCCESS;
}
......@@ -363,7 +344,8 @@ static void GpioDriverRelease(struct HdfDeviceObject *device)
return HDF_DEV_ERR_NO_DEVICE_SERVICE;
}
(void)OsalMemFree(gpioCntlr->priv);
gpioCntlr->ops = NULL;
OsalMemFree(gpioCntlr->priv);
gpioCntlr->count = 0;
}
......@@ -371,9 +353,13 @@ static void GpioDriverRelease(struct HdfDeviceObject *device)
static int32_t GpioDevWrite(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t val)
{
(void)cntlr;
if (gpio >= HAL_GPIO_PIN_LED_NUM) {
HDF_LOGE("%s %d, error pin:%hu", __func__, __LINE__, gpio);
return HDF_ERR_NOT_SUPPORT;
}
uint16_t halGpio = g_gpioPinReflectionMap[gpio];
if ((enum HAL_GPIO_PIN_T)halGpio >= HAL_GPIO_PIN_LED_NUM) {
HDF_LOGE("%s %d, error pin:%d", __func__, __LINE__, halGpio);
HDF_LOGE("%s %d, error pin:%hu", __func__, __LINE__, halGpio);
return HDF_ERR_NOT_SUPPORT;
}
......@@ -386,9 +372,13 @@ static int32_t GpioDevRead(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t *val
{
(void)cntlr;
uint16_t value;
if (gpio >= HAL_GPIO_PIN_LED_NUM) {
HDF_LOGE("%s %d, error pin:%hu", __func__, __LINE__, gpio);
return HDF_ERR_NOT_SUPPORT;
}
uint16_t halGpio = g_gpioPinReflectionMap[gpio];
if ((enum HAL_GPIO_PIN_T)halGpio >= HAL_GPIO_PIN_LED_NUM) {
HDF_LOGE("%s %d, error pin:%d", __func__, __LINE__, halGpio);
HDF_LOGE("%s %d, error pin:%hu", __func__, __LINE__, halGpio);
return HDF_ERR_NOT_SUPPORT;
}
......@@ -401,9 +391,13 @@ static int32_t GpioDevRead(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t *val
static int32_t GpioDevSetDir(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t dir)
{
(void)cntlr;
if (gpio >= HAL_GPIO_PIN_LED_NUM) {
HDF_LOGE("%s %d, error pin:%hu", __func__, __LINE__, gpio);
return HDF_ERR_NOT_SUPPORT;
}
uint16_t halGpio = g_gpioPinReflectionMap[gpio];
if ((enum HAL_GPIO_PIN_T)halGpio >= HAL_GPIO_PIN_LED_NUM) {
HDF_LOGE("%s %d, error pin:%d", __func__, __LINE__, halGpio);
HDF_LOGE("%s %d, error pin:%hu", __func__, __LINE__, halGpio);
return HDF_ERR_NOT_SUPPORT;
}
......@@ -416,9 +410,13 @@ static int32_t GpioDevGetDir(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t *d
{
(void)cntlr;
uint16_t value;
if (gpio >= HAL_GPIO_PIN_LED_NUM) {
HDF_LOGE("%s %d, error pin:%hu", __func__, __LINE__, gpio);
return HDF_ERR_NOT_SUPPORT;
}
uint16_t halGpio = g_gpioPinReflectionMap[gpio];
if ((enum HAL_GPIO_PIN_T)halGpio >= HAL_GPIO_PIN_LED_NUM) {
HDF_LOGE("%s %d, error pin:%d", __func__, __LINE__, gpio);
HDF_LOGE("%s %d, error pin:%hu", __func__, __LINE__, halGpio);
return HDF_ERR_NOT_SUPPORT;
}
......@@ -431,9 +429,13 @@ static int32_t GpioDevGetDir(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t *d
static int32_t GpioDevSetIrq(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t mode)
{
(void)cntlr;
if (gpio >= HAL_GPIO_PIN_LED_NUM) {
HDF_LOGE("%s %d, error pin:%hu", __func__, __LINE__, gpio);
return HDF_ERR_NOT_SUPPORT;
}
enum HAL_GPIO_PIN_T pin = (enum HAL_GPIO_PIN_T)g_gpioPinReflectionMap[gpio];
if (pin >= HAL_GPIO_PIN_LED_NUM) {
HDF_LOGE("%s %d, error pin:%d", __func__, __LINE__, pin);
HDF_LOGE("%s %d, error pin:%hu", __func__, __LINE__, pin);
return HDF_ERR_NOT_SUPPORT;
}
......@@ -442,10 +444,16 @@ static int32_t GpioDevSetIrq(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t mo
} else if ((mode == OSAL_IRQF_TRIGGER_HIGH) || (mode == OSAL_IRQF_TRIGGER_LOW)) {
g_gpioIrqCfg[pin].irq_type = HAL_GPIO_IRQ_TYPE_LEVEL_SENSITIVE;
} else {
HDF_LOGE("%s %d, error mode:%d", __func__, __LINE__, mode);
HDF_LOGE("%s %d, error mode:%hu", __func__, __LINE__, mode);
return HDF_ERR_NOT_SUPPORT;
}
if (mode == OSAL_IRQF_TRIGGER_HIGH || mode == OSAL_IRQF_TRIGGER_RISING) {
mode = HAL_GPIO_IRQ_POLARITY_HIGH_RISING;
} else {
mode = HAL_GPIO_IRQ_POLARITY_LOW_FALLING;
}
g_gpioIrqCfg[pin].irq_polarity = mode;
return HDF_SUCCESS;
......@@ -454,6 +462,10 @@ static int32_t GpioDevSetIrq(struct GpioCntlr *cntlr, uint16_t gpio, uint16_t mo
static int32_t GpioDevUnSetIrq(struct GpioCntlr *cntlr, uint16_t gpio)
{
(void)cntlr;
if (gpio >= HAL_GPIO_PIN_LED_NUM) {
HDF_LOGE("%s %d, error pin:%hu", __func__, __LINE__, gpio);
return HDF_ERR_NOT_SUPPORT;
}
enum HAL_GPIO_PIN_T pin = (enum HAL_GPIO_PIN_T)g_gpioPinReflectionMap[gpio];
if (pin >= HAL_GPIO_PIN_LED_NUM) {
HDF_LOGE("%s %d, error pin:%d", __func__, __LINE__, pin);
......@@ -467,6 +479,10 @@ static int32_t GpioDevEnableIrq(struct GpioCntlr *cntlr, uint16_t gpio)
{
(void)cntlr;
struct HAL_GPIO_IRQ_CFG_T gpioCfg;
if (gpio >= HAL_GPIO_PIN_LED_NUM) {
HDF_LOGE("%s %d, error pin:%hu", __func__, __LINE__, gpio);
return HDF_ERR_NOT_SUPPORT;
}
uint16_t halGpio = (enum HAL_GPIO_PIN_T)g_gpioPinReflectionMap[gpio];
if ((enum HAL_GPIO_PIN_T)halGpio >= HAL_GPIO_PIN_LED_NUM) {
HDF_LOGE("%s %d, error pin:%d", __func__, __LINE__, (enum HAL_GPIO_PIN_T)halGpio);
......@@ -490,9 +506,13 @@ static int32_t GpioDevEnableIrq(struct GpioCntlr *cntlr, uint16_t gpio)
static int32_t GpioDevDisableIrq(struct GpioCntlr *cntlr, uint16_t gpio)
{
(void)cntlr;
if (gpio >= HAL_GPIO_PIN_LED_NUM) {
HDF_LOGE("%s %d, error pin:%hu", __func__, __LINE__, gpio);
return HDF_ERR_NOT_SUPPORT;
}
uint16_t halGpio = (enum HAL_GPIO_PIN_T)g_gpioPinReflectionMap[gpio];
if ((enum HAL_GPIO_PIN_T)halGpio >= HAL_GPIO_PIN_LED_NUM) {
HDF_LOGE("%s %d, error pin:%d", __func__, __LINE__, halGpio);
HDF_LOGE("%s %d, error pin:%hu", __func__, __LINE__, halGpio);
return HDF_ERR_NOT_SUPPORT;
}
......
......@@ -48,25 +48,9 @@ struct I2cMethod g_i2cHostMethod = {
.transfer = i2cHostTransfer,
};
int32_t InitI2cDevice(struct I2cDevice *device)
static int32_t I2cDeviceIomuxInit(uint32_t i2cId, struct I2cResource *resource)
{
int32_t ret = -1;
uint32_t i2cPort;
struct I2cResource *resource = NULL;
struct HAL_I2C_CONFIG_T *i2cConfig = NULL;
if (device == NULL) {
HDF_LOGE("device is NULL\r\n");
return HDF_ERR_INVALID_PARAM;
}
resource = &device->resource;
if (resource == NULL) {
HDF_LOGE("%s %d: invalid parameter\r\n", __func__, __LINE__);
return HDF_ERR_INVALID_PARAM;
}
i2cConfig = &device->i2cCfg;
if (i2cConfig == NULL) {
if (i2cId > HAL_I2C_ID_NUM || resource == NULL) {
HDF_LOGE("%s %d: invalid parameter\r\n", __func__, __LINE__);
return HDF_ERR_INVALID_PARAM;
}
......@@ -76,63 +60,52 @@ int32_t InitI2cDevice(struct I2cDevice *device)
{0, 0, HAL_IOMUX_PIN_VOLTAGE_VIO, HAL_IOMUX_PIN_PULLUP_ENABLE},
};
device->port = resource->port;
i2cPort = device->port;
if (i2cPort > HAL_I2C_ID_NUM) {
HDF_LOGE("i2c port %u not support\r\n", i2cPort);
return HDF_ERR_NOT_SUPPORT;
}
if (i2cPort == 0) {
#ifdef LOSCFG_SOC_SERIES_BES2600
if (i2cId == 0) {
pinMuxI2c[0].function = HAL_IOMUX_FUNC_I2C_M0_SCL;
pinMuxI2c[1].function = HAL_IOMUX_FUNC_I2C_M0_SDA;
} else {
pinMuxI2c[0].function = HAL_IOMUX_FUNC_I2C_M1_SCL;
pinMuxI2c[1].function = HAL_IOMUX_FUNC_I2C_M1_SDA;
}
if (OsalMutexInit(&device->mutex) != HDF_SUCCESS) {
HDF_LOGE("%s %d OsalMutexInit fail\r\n", __func__, __LINE__);
return HDF_FAILURE;
}
if (HDF_SUCCESS != OsalMutexLock(&device->mutex)) {
HDF_LOGE("%s %d osMutexWait fail\r\n", __func__, __LINE__);
return HDF_ERR_TIMEOUT;
#elif defined (LOSCFG_SOC_SERIES_BES2700)
if (i2cId == 0) {
pinMuxI2c[0].function = HAL_IOMUX_FUNC_SYS_I2C_M0_SCL;
pinMuxI2c[1].function = HAL_IOMUX_FUNC_SYS_I2C_M0_SDA;
} else {
pinMuxI2c[0].function = HAL_IOMUX_FUNC_SYS_I2C_M1_SCL;
pinMuxI2c[1].function = HAL_IOMUX_FUNC_SYS_I2C_M1_SDA;
}
#endif
pinMuxI2c[0].pin = resource->sclPin;
pinMuxI2c[1].pin = resource->sdaPin;
hal_iomux_init(pinMuxI2c, ARRAY_SIZE(pinMuxI2c));
ret = hal_i2c_open(i2cPort, i2cConfig);
if (ret == HDF_SUCCESS) {
HDF_LOGD("open %u i2c succ.\r\n", i2cPort);
}
OsalMutexUnlock(&device->mutex);
return ret;
return HDF_SUCCESS;
}
static int32_t HostRestI2cDevice(struct I2cDevice *device)
int32_t InitI2cDevice(struct I2cDevice *device)
{
int32_t ret = -1;
int32_t ret;
uint32_t i2cPort;
struct I2cResource *resource = NULL;
struct HAL_I2C_CONFIG_T *i2cConfig = NULL;
uint32_t i2cPort;
if (device == NULL) {
HDF_LOGE("%s %d device is null\r\n", __func__, __LINE__);
HDF_LOGE("%s %d:device is NULL\r\n", __func__, __LINE__);
return HDF_ERR_INVALID_PARAM;
}
resource = &device->resource;
if (resource == NULL) {
HDF_LOGE("%s %d: invalid parameter\r\n", __func__, __LINE__);
return HDF_ERR_INVALID_OBJECT;
return HDF_ERR_INVALID_PARAM;
}
i2cConfig = &device->i2cCfg;
if (i2cConfig == NULL) {
HDF_LOGE("%s %d: invalid parameter\r\n", __func__, __LINE__);
return HDF_ERR_INVALID_OBJECT;
return HDF_ERR_INVALID_PARAM;
}
device->port = resource->port;
i2cPort = device->port;
if (i2cPort > HAL_I2C_ID_NUM) {
......@@ -140,59 +113,66 @@ static int32_t HostRestI2cDevice(struct I2cDevice *device)
return HDF_ERR_NOT_SUPPORT;
}
hal_i2c_close(i2cPort);
if (OsalMutexInit(&device->mutex) != HDF_SUCCESS) {
HDF_LOGE("%s %d OsalMutexInit fail\r\n", __func__, __LINE__);
return HDF_FAILURE;
}
if (OsalMutexLock(&device->mutex) != HDF_SUCCESS) {
HDF_LOGE("%s %d osMutexWait fail\r\n", __func__, __LINE__);
return HDF_ERR_TIMEOUT;
}
ret = I2cDeviceIomuxInit(i2cPort, resource);
if (ret != HDF_SUCCESS) {
HDF_LOGD("I2C iomux init failed.\r\n");
OsalMutexUnlock(&device->mutex);
return ret;
}
ret = hal_i2c_open(i2cPort, i2cConfig);
if (ret == HDF_SUCCESS) {
HDF_LOGD("open %u i2c succ.\r\n", i2cPort);
}
OsalMutexUnlock(&device->mutex);
return ret;
}
#ifdef LOSCFG_DRIVERS_HDF_CONFIG_MACRO
#define I2C_FIND_CONFIG(node, name, resource) \
do { \
if (strcmp(HCS_PROP(node, match_attr), name) == 0) { \
resource->port = HCS_PROP(node, port); \
tempPin = HCS_PROP(node, sclPin); \
resource->sclPin = ((tempPin / DEC_NUM) * GROUP_PIN_NUM) + (tempPin % DEC_NUM); \
tempPin = HCS_PROP(node, sdaPin); \
resource->sdaPin = ((tempPin / DEC_NUM) * GROUP_PIN_NUM) + (tempPin % DEC_NUM); \
resource->speed = HCS_PROP(node, speed); \
resource->mode = HCS_PROP(node, mode); \
resource->useDma = HCS_PROP(node, useDma); \
resource->useSync = HCS_PROP(node, useSync); \
resource->asMaster = HCS_PROP(node, asMaster); \
break; \
} \
} while (0)
#define PLATFORM_I2C_CONFIG HCS_NODE(HCS_NODE(HCS_ROOT, platform), i2c_config)
static uint32_t GetI2cDeviceResource(struct I2cDevice *device,
const char *deviceMatchAttr)
static int32_t GetI2cDeviceIomuxConfig(struct I2cResource *resource, const struct DeviceResourceNode *resourceNode)
{
uint32_t tempPin = 0;
struct I2cResource *resource = NULL;
if (device == NULL) {
HDF_LOGE("device or resourceNode is NULL\r\n");
struct DeviceResourceIface *dri = NULL;
if (resource == NULL || resourceNode == NULL) {
HDF_LOGE("%s %d:resource or resourceNode is NULL\r\n", __func__, __LINE__);
return HDF_ERR_INVALID_PARAM;
}
resource = &device->resource;
if (resource == NULL) {
HDF_LOGE("%s %d: invalid parameter\r\n", __func__, __LINE__);
dri = DeviceResourceGetIfaceInstance(HDF_CONFIG_SOURCE);
if (dri == NULL || dri->GetUint32 == NULL) {
HDF_LOGE("DeviceResourceIface is invalid\r\n");
return HDF_ERR_INVALID_OBJECT;
}
HCS_FOREACH_CHILD_VARGS(PLATFORM_I2C_CONFIG, I2C_FIND_CONFIG, deviceMatchAttr, resource);
if (dri->GetUint32(resourceNode, "sclPin", &resource->sclPin, 0) != HDF_SUCCESS) {
HDF_LOGE("i2c config sclPin fail\r\n");
return HDF_FAILURE;
}
if (dri->GetUint32(resourceNode, "sdaPin", &resource->sdaPin, 0) != HDF_SUCCESS) {
HDF_LOGE("i2c config sdaPin fail\r\n");
return HDF_FAILURE;
}
resource->sclPin = ((resource->sclPin / DEC_NUM) * GROUP_PIN_NUM) + (resource->sclPin % DEC_NUM);
resource->sdaPin = ((resource->sdaPin / DEC_NUM) * GROUP_PIN_NUM) + (resource->sdaPin % DEC_NUM);
return HDF_SUCCESS;
}
#else
static uint32_t GetI2cDeviceResource(struct I2cDevice *device,
const struct DeviceResourceNode *resourceNode)
static int32_t GetI2cDeviceResource(struct I2cDevice *device, const struct DeviceResourceNode *resourceNode)
{
uint32_t tempPin = 0;
struct I2cResource *resource = NULL;
struct DeviceResourceIface *dri = NULL;
if (device == NULL || resourceNode == NULL) {
HDF_LOGE("device or resourceNode is NULL\r\n");
HDF_LOGE("%s %d:device or resourceNode is NULL\r\n", __func__, __LINE__);
return HDF_ERR_INVALID_PARAM;
}
resource = &device->resource;
......@@ -211,18 +191,6 @@ static uint32_t GetI2cDeviceResource(struct I2cDevice *device,
return HDF_FAILURE;
}
if (dri->GetUint32(resourceNode, "sclPin", &tempPin, 0) != HDF_SUCCESS) {
HDF_LOGE("i2c config sclPin fail\r\n");
return HDF_FAILURE;
}
resource->sclPin = ((tempPin / DEC_NUM) * GROUP_PIN_NUM) + (tempPin % DEC_NUM);
if (dri->GetUint32(resourceNode, "sdaPin", &tempPin, 0) != HDF_SUCCESS) {
HDF_LOGE("i2c config sdaPin fail\r\n");
return HDF_FAILURE;
}
resource->sdaPin = ((tempPin / DEC_NUM) * GROUP_PIN_NUM) + (tempPin % DEC_NUM);
if (dri->GetUint32(resourceNode, "speed", &resource->speed, 0) != HDF_SUCCESS) {
HDF_LOGE("i2c config speed fail\r\n");
return HDF_FAILURE;
......@@ -247,9 +215,10 @@ static uint32_t GetI2cDeviceResource(struct I2cDevice *device,
HDF_LOGE("i2c config asMaster fail\r\n");
return HDF_FAILURE;
}
return HDF_SUCCESS;
return GetI2cDeviceIomuxConfig(resource, resourceNode);
}
#endif
static int32_t AttachI2cDevice(struct I2cCntlr *host, struct HdfDeviceObject *device)
{
int32_t ret;
......@@ -278,11 +247,13 @@ static int32_t AttachI2cDevice(struct I2cCntlr *host, struct HdfDeviceObject *de
resource = &i2cDevice->resource;
if (resource == NULL) {
HDF_LOGE("%s %d: invalid parameter\r\n", __func__, __LINE__);
OsalMemFree(i2cDevice);
return HDF_ERR_INVALID_OBJECT;
}
i2cConfig = &i2cDevice->i2cCfg;
if (i2cConfig == NULL) {
HDF_LOGE("%s %d: invalid parameter\r\n", __func__, __LINE__);
OsalMemFree(i2cDevice);
return HDF_ERR_INVALID_OBJECT;
}
i2cDevice->port = resource->port;
......@@ -320,12 +291,10 @@ static int32_t i2cDriverInit(struct HdfDeviceObject *device)
ret = AttachI2cDevice(host, device);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%s: attach error\r\n", __func__);
i2cDriverRelease(device);
return HDF_DEV_ERR_ATTACHDEV_FAIL;
}
ret = I2cCntlrAdd(host);
if (ret != HDF_SUCCESS) {
i2cDriverRelease(device);
return HDF_FAILURE;
}
return ret;
......
......@@ -11,7 +11,9 @@
#include "hal_i2c.h"
#include "hal_iomux.h"
#ifdef CHIP_BEST2003
#include "hal_iomux_best2003.h"
#endif
#include "device_resource_if.h"
#include "osal_mutex.h"
#ifdef __cplusplus
......
......@@ -12,7 +12,6 @@
#include "hdf_device_desc.h"
#include "hal_trace.h"
#include "hal_timer.h"
#include "hal_iomux.h"
#include "pwm_core.h"
#include "hdf_log.h"
#ifdef LOSCFG_DRIVERS_HDF_CONFIG_MACRO
......@@ -22,7 +21,13 @@
#include "device_resource_if.h"
#endif
#if defined (LOSCFG_SOC_SERIES_BES2700)
#define PWM_MAX_FUNCTION 4
#elif defined (LOSCFG_SOC_SERIES_BES2600)
#include "hal_iomux.h"
#define PWM_MAX_FUNCTION 8
#endif
#define UNTIL_NAN0SECONDS 1000000000
#define PERCENT 100
#define DEC_TEN 10
......@@ -33,10 +38,12 @@ static uint32_t g_pwmFunction[PWM_MAX_FUNCTION] = {
HAL_IOMUX_FUNC_PWM1,
HAL_IOMUX_FUNC_PWM2,
HAL_IOMUX_FUNC_PWM3,
#if defined (LOSCFG_SOC_SERIES_BES2600)
HAL_IOMUX_FUNC_PWM4,
HAL_IOMUX_FUNC_PWM5,
HAL_IOMUX_FUNC_PWM6,
HAL_IOMUX_FUNC_PWM7,
#endif
};
static int32_t PwmDevSetConfig(struct PwmDev *pwm, struct PwmConfig *config);
......@@ -54,7 +61,7 @@ static int InitPwmDevice(struct PwmDev *host)
struct PwmDevice *pwmDevice = NULL;
struct PwmResource *resource = NULL;
if (host == NULL || host->priv == NULL) {
HDF_LOGE("%s: invaild parameter\r\n", __func__);
HDF_LOGE("%s: invalid parameter\r\n", __func__);
return HDF_ERR_INVALID_PARAM;
}
pwmDevice = (struct PwmDevice *)host->priv;
......@@ -81,13 +88,7 @@ static int InitPwmDevice(struct PwmDev *host)
return HDF_SUCCESS;
}
#ifdef LOSCFG_DRIVERS_HDF_CONFIG_MACRO
static uint32_t GetPwmDeviceResource(struct PwmDevice *device)
{
}
#else
static uint32_t GetPwmDeviceResource(
struct PwmDevice *device, const struct DeviceResourceNode *resourceNode)
static uint32_t GetPwmDeviceResource(struct PwmDevice *device, const struct DeviceResourceNode *resourceNode)
{
uint32_t tempPin = 0;
struct DeviceResourceIface *dri = NULL;
......@@ -122,7 +123,7 @@ static uint32_t GetPwmDeviceResource(
return HDF_SUCCESS;
}
#endif
static int32_t AttachPwmDevice(struct PwmDev *host, struct HdfDeviceObject *device)
{
int32_t ret;
......@@ -142,7 +143,7 @@ static int32_t AttachPwmDevice(struct PwmDev *host, struct HdfDeviceObject *devi
return HDF_ERR_MALLOC_FAIL;
}
#ifdef LOSCFG_DRIVERS_HDF_CONFIG_MACRO
ret = GetPwmDeviceResource(pwmDevice);
ret = GetPwmDeviceResource(pwmDevice, device->deviceMatchAttr);
#else
ret = GetPwmDeviceResource(pwmDevice, device->property);
#endif
......
......@@ -11,7 +11,9 @@
#include "hal_pwm.h"
#include "hal_gpio.h"
#ifdef CHIP_BEST2003
#include "hal_iomux.h"
#endif
#include "pwm_core.h"
#ifdef __cplusplus
......
此差异已折叠。
......@@ -12,7 +12,9 @@
#include "hal_spi.h"
#include "hal_gpio.h"
#include "hal_iomux.h"
#ifdef CHIP_BEST2003
#include "hal_iomux_best2003.h"
#endif
#include "osal_mutex.h"
#include "osal_sem.h"
......
此差异已折叠。
......@@ -47,7 +47,7 @@ static int InitWatchdogDevice(struct WatchdogDevice *watchdogDevice)
struct WatchdogResource *resource = NULL;
int32_t watchdogId;
if (watchdogDevice == NULL) {
HDF_LOGE("%s: invaild parameter\r\n", __func__);
HDF_LOGE("%s: invalid parameter\r\n", __func__);
return HDF_ERR_INVALID_PARAM;
}
......@@ -182,7 +182,7 @@ static int32_t WatchdogDriverInit(struct HdfDeviceObject *device)
}
watchdogCntlr->ops = &g_WatchdogCntlrMethod;
HDF_LOGE("WatchdogDriverInit success!\r\n");
return ret;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册