You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

mlx_blink_leds.c 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (C) 2015 Mellanox Technologies Ltd.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of the
  7. * License, or any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301, USA.
  18. */
  19. FILE_LICENCE ( GPL2_OR_LATER );
  20. #include "../../mlx_lib/mlx_blink_leds/mlx_blink_leds.h"
  21. #include "../../include/public/mlx_memory.h"
  22. #include "../../include/public/mlx_bail.h"
  23. mlx_status
  24. mlx_blink_leds(
  25. IN mlx_utils *utils,
  26. IN mlx_uint16 secs
  27. )
  28. {
  29. mlx_status status = MLX_SUCCESS;
  30. struct mlx_led_control led_control;
  31. mlx_uint32 reg_status;
  32. if (utils == NULL ) {
  33. status = MLX_INVALID_PARAMETER;
  34. goto bad_param;
  35. }
  36. mlx_memory_set(utils, &led_control, 0, sizeof(led_control));
  37. led_control.beacon_duration = secs;
  38. status = mlx_reg_access(utils, REG_ID_MLCR, REG_ACCESS_WRITE, &led_control, sizeof(led_control),
  39. &reg_status);
  40. MLX_CHECK_STATUS(utils, status, reg_err, "mlx_reg_access failed ");
  41. if (reg_status != 0) {
  42. MLX_DEBUG_ERROR(utils,"mlx_reg_access failed with status = %d\n", reg_status);
  43. status = MLX_FAILED;
  44. goto reg_err;
  45. }
  46. reg_err:
  47. bad_param:
  48. return status;
  49. }