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.
 
 
 
 
 
 

99 lines
3.0 KiB

  1. /***************************************************************************
  2. * Copyright (C) 2011 by Mathias Kuester *
  3. * Mathias Kuester <kesmtp@freenet.de> *
  4. * *
  5. * Copyright (C) 2012 by Spencer Oliver *
  6. * spen@spen-soft.co.uk *
  7. * *
  8. * This program is free software; you can redistribute it and/or modify *
  9. * it under the terms of the GNU General Public License as published by *
  10. * the Free Software Foundation; either version 2 of the License, or *
  11. * (at your option) any later version. *
  12. * *
  13. * This program is distributed in the hope that it will be useful, *
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  16. * GNU General Public License for more details. *
  17. * *
  18. * You should have received a copy of the GNU General Public License *
  19. * along with this program; if not, write to the *
  20. * Free Software Foundation, Inc., *
  21. * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
  22. ***************************************************************************/
  23. #ifdef HAVE_CONFIG_H
  24. #include "config.h"
  25. #endif
  26. /* project specific includes */
  27. #include <jtag/interface.h>
  28. #include <transport/transport.h>
  29. #include <helper/time_support.h>
  30. #include <jtag/hla/hla_layout.h>
  31. #include <jtag/hla/hla_tcl.h>
  32. #include <jtag/hla/hla_transport.h>
  33. #include <jtag/hla/hla_interface.h>
  34. static int hl_layout_open(struct hl_interface_s *adapter)
  35. {
  36. int res;
  37. LOG_DEBUG("hl_layout_open");
  38. adapter->fd = NULL;
  39. res = adapter->layout->api->open(&adapter->param, &adapter->fd);
  40. if (res != ERROR_OK) {
  41. LOG_DEBUG("failed");
  42. return res;
  43. }
  44. /* make sure adapter has set the buffer size */
  45. if (!adapter->param.max_buffer) {
  46. LOG_ERROR("buffer size not set");
  47. return ERROR_FAIL;
  48. }
  49. return ERROR_OK;
  50. }
  51. static int hl_layout_close(struct hl_interface_s *adapter)
  52. {
  53. return ERROR_OK;
  54. }
  55. static const struct hl_layout hl_layouts[] = {
  56. {
  57. .name = "stlink",
  58. .open = hl_layout_open,
  59. .close = hl_layout_close,
  60. .api = &stlink_usb_layout_api,
  61. },
  62. {
  63. .name = "ti-icdi",
  64. .open = hl_layout_open,
  65. .close = hl_layout_close,
  66. .api = &icdi_usb_layout_api,
  67. },
  68. {.name = NULL, /* END OF TABLE */ },
  69. };
  70. /** */
  71. const struct hl_layout *hl_layout_get_list(void)
  72. {
  73. return hl_layouts;
  74. }
  75. int hl_layout_init(struct hl_interface_s *adapter)
  76. {
  77. LOG_DEBUG("hl_layout_init");
  78. if (adapter->layout == NULL) {
  79. LOG_ERROR("no layout specified");
  80. return ERROR_FAIL;
  81. }
  82. return ERROR_OK;
  83. }