OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 8439|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . j8 {: P& V7 h+ B2 N9 c& ^- i0 X4 |. H
  1. [code]EDMA sample test application
    % i+ E. ~- S% `7 ?
  2. /*! U/ i4 U2 d: q- E1 P& Q: {" m+ y( M
  3. * edma_test.c
    6 Y2 B5 P/ ]- {( E
  4. *
    $ M& \  ]" B1 o. B3 }
  5. * brief  EDMA3 Test Application" ]  @- R2 w$ h9 }; ?$ R# `
  6. *5 s; r0 i/ u/ p- @1 {
  7. *   This file contains EDMA3 Test code.
    2 b5 _! M' h( H* o3 o
  8. *
    " z8 e! B4 L- T0 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 E# f; q9 s& P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; p3 \: [# m5 u- {6 y; m) l
  11. *         TO CHANGE.+ }6 a' Y4 R' `, K8 M6 S
  12. *3 _* r6 ^- b% \! a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. f: ]& G) |1 N( \0 v' G1 x
  14. *
    5 F' M# U$ D3 C3 T1 q
  15. * This program is free software; you can redistribute it and/or, u0 P0 O! F: V( c& h% k/ L/ d" j
  16. * modify it under the terms of the GNU General Public License as5 E' R7 t2 t, e/ D) x6 j! X
  17. * published by the Free Software Foundation version 2.
    3 ~3 {1 h3 }1 ~) U
  18. *# `9 k8 `; {0 n; `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  r& @+ D* g3 i" z
  20. * kind, whether express or implied; without even the implied warranty6 i& m# c1 t/ A$ u, p3 M5 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- s, v; n* b. K3 t" V, w
  22. * GNU General Public License for more details.5 ~3 g0 q+ y6 r+ ~. A
  23. */
    6 W' O0 C4 k3 }& p
  24. 1 d( u7 o1 i% \0 Z- @
  25. #include <linux/module.h>" t) I. _$ W8 D1 {
  26. #include <linux/init.h>
    , c. {& n" V; R/ `" P
  27. #include <linux/errno.h>, T  i7 B" b' c; b: c
  28. #include <linux/types.h>
    & H$ V4 C% ]7 G3 {, R1 e
  29. #include <linux/interrupt.h>
    * V: {( c, ~, k% ?" F/ T
  30. #include <asm/io.h>( b  r2 `# \' \! C+ L# t
  31. #include <linux/moduleparam.h>1 l7 @' S1 J  E  R7 {3 R, G
  32. #include <linux/sysctl.h>5 L; k0 {7 e4 z8 D! p, g3 A
  33. #include <linux/mm.h>1 l7 }, v7 B2 z4 N) l
  34. #include <linux/dma-mapping.h>+ q9 r/ n1 g. ]* T8 G$ u
  35. * |# o1 j/ |" a. c1 {
  36. #include <mach/memory.h>
    # d1 m! r/ f+ b, ]) E7 R
  37. #include <mach/hardware.h># S. ~0 l$ ?! a1 p9 P+ `8 v
  38. #include <mach/irqs.h>" \% _( |- G) x5 B
  39. #include <asm/hardware/edma.h>
    " J2 k( W0 i5 n/ ]
  40. 8 O+ ^: M. P) n  u
  41. #undef EDMA3_DEBUG: g* b% V2 f1 o9 M9 C  t
  42. /*#define EDMA3_DEBUG*/
    # K4 {7 U, f" y" d, p% |# c" Z0 o
  43. & B- \( |) Q5 M$ w# }
  44. #ifdef EDMA3_DEBUG3 d* j9 l9 B4 p8 n7 Y; R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 m0 l8 W( H9 U0 t3 p) T+ ?- y5 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & g* d' @+ [2 p) F: H( s& C! t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) m) r9 u% `7 d) k
  48. #else  Y! t: d- n) q& A5 _+ [
  49. #define DMA_PRINTK( x... )
    5 Q, M. }( ]3 K- e) e$ v9 d! x, G4 H4 Y
  50. #define DMA_FN_IN
    ; A# K- f9 R. A9 _- V, g' [
  51. #define DMA_FN_OUT
    " o, h) Y/ [. P  ?6 U2 l, u
  52. #endif
    " h, M3 [+ t+ q, h) `7 D9 ^7 f

  53. " h2 P' O: w: @4 a+ G9 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ S) i% e- w/ q
  55. #define STATIC_SHIFT                3
    # Z8 j0 @* G4 X1 R' \
  56. #define TCINTEN_SHIFT               206 I) _4 D* N7 \5 E7 {
  57. #define ITCINTEN_SHIFT              211 r1 {0 j  I# X2 e, h
  58. #define TCCHEN_SHIFT                22  A7 i) p( w1 z* Z4 B- |
  59. #define ITCCHEN_SHIFT               230 S3 Q. n( k! e3 ?% o* l4 O6 q1 i) |
  60. / r' A, i& ]6 x% N. `+ e; I6 w5 q& G
  61. static volatile int irqraised1 = 0;
    7 y8 e+ k  ]3 ?$ A% F$ k
  62. static volatile int irqraised2 = 0;" A0 H; M) x7 z5 |

  63. 7 o, x/ g+ H6 [: i8 e4 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ H8 \. C0 a7 p! U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 X# h( I( O+ P" [. Y) h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 C  d5 V' M& N8 u2 x: `
  67. : Y8 W- L' }4 ]# f! ^
  68. dma_addr_t dmaphyssrc1 = 0;
    0 a/ r- h& x; M4 z# p* S
  69. dma_addr_t dmaphyssrc2 = 0;
    1 }8 _: y) d. l
  70. dma_addr_t dmaphysdest1 = 0;
    9 w, s6 \. q% n& m: _# u3 v
  71. dma_addr_t dmaphysdest2 = 0;7 f; Y" I  ~- n  V( N( r
  72. / \5 [6 X8 K8 f/ J7 H
  73. char *dmabufsrc1 = NULL;
    + v1 S) _8 ]; E, t
  74. char *dmabufsrc2 = NULL;
    . \4 d- m/ y& L6 S
  75. char *dmabufdest1 = NULL;
    ! |$ i4 h& Q( r" M5 j
  76. char *dmabufdest2 = NULL;
    * D, @& U3 I! d2 W& @, Z- ~

  77. - i* P' L2 `' J
  78. static int acnt = 512;
    7 f; u; O) `* B) p. `- \' [/ B
  79. static int bcnt = 8;2 A. p$ _. V1 T# J) m1 M3 c
  80. static int ccnt = 8;) a: x6 G" V. E; V- l6 w: k

  81. ' j: n* F+ T, ?) w
  82. module_param(acnt, int, S_IRUGO);
    , b* Z# c0 W, Z# T6 u! v( J
  83. module_param(bcnt, int, S_IRUGO);7 L  A8 ]7 [* f6 F6 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) v+ s- t* g7 S. m" |6 F8 b" K; @# C7 J) F/ ~( \# o: B" i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% \' A# ^1 g) N5 Q) |9 V
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 P5 Y1 H5 B* C0 S" \  @% @/ S     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 U* |; I7 ?3 k. ~# t: k- j
% l/ v% W" d" t: h/ P0 Q, k! T% S7 f* v0 m: ^7 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2025-11-21 11:47 , Processed in 0.037928 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表