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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% u3 c$ w. a2 o& z& _; I2 S8 a9 p
  1. [code]EDMA sample test application- L% n! M1 ]; B6 F/ ]! @/ t
  2. /*+ L1 }# ^( a, s2 y
  3. * edma_test.c: M1 T7 n! [, h! l
  4. *% V# {# g7 p. `0 ]- M
  5. * brief  EDMA3 Test Application
    & ]1 x, `" [* d7 X
  6. *$ D" r2 @5 A) r0 h# f
  7. *   This file contains EDMA3 Test code.
    2 Z0 [1 A( v& d8 C
  8. *
    2 o+ f0 E1 e' Q& x2 w) f4 C/ B5 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & C6 E% d- L, T. z  ~& D& z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 F8 h; X3 U6 ]% n+ J
  11. *         TO CHANGE.% l9 i4 E' d! \
  12. *
    - c9 O  ^% ?& a( j$ Q9 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 R' l" j4 A/ h" Q
  14. *
      L4 S' T, V. D
  15. * This program is free software; you can redistribute it and/or
    7 W  |0 T7 l; M
  16. * modify it under the terms of the GNU General Public License as
    $ t1 j$ `+ R$ O+ i& C6 [4 U
  17. * published by the Free Software Foundation version 2.
    # A: u) J; }! [; H* Q
  18. *
    * Z: G8 _: X0 U" [5 e5 m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      v. ~; _. v  i4 S) P. a7 Z- k
  20. * kind, whether express or implied; without even the implied warranty% @2 v" G1 {5 C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; B8 }) G% @  n! R' H  W
  22. * GNU General Public License for more details.
    : p- C" B- n8 U7 s+ L2 x
  23. */
    ( B3 r5 h) g1 O5 N

  24. 9 v; [! @" q  D. ~4 P! n  _
  25. #include <linux/module.h>" U) v) `* ?7 U& q
  26. #include <linux/init.h>( L+ F/ @( U. H
  27. #include <linux/errno.h>' O7 k# a/ m  t: Q# m7 N
  28. #include <linux/types.h># D2 d4 v5 i$ E5 m+ O# Q4 G
  29. #include <linux/interrupt.h>4 |& D6 G. f& J2 _6 f8 |6 V& d( U
  30. #include <asm/io.h>
    4 J0 _6 e( X. t" `# j& t- P
  31. #include <linux/moduleparam.h>
    & S1 k, E1 x8 o. U  J
  32. #include <linux/sysctl.h>
    1 B; q; S2 p, {& V. b9 w, b
  33. #include <linux/mm.h>
    % ?3 Z0 Y6 v6 J2 M) B- ?
  34. #include <linux/dma-mapping.h>! a5 V# G8 Y7 M! L" S$ u9 \

  35. 5 Y, z! M/ v8 Z$ c3 `0 M- @; m
  36. #include <mach/memory.h>
    7 `; E  C% c  b9 a+ a6 F, R
  37. #include <mach/hardware.h>
    5 C( Z7 u" [. P' R
  38. #include <mach/irqs.h>4 O* D0 A& v! u& }; U* M
  39. #include <asm/hardware/edma.h>: K. \+ c2 g+ M/ T% x! s. b
  40. % p! u. n1 d8 I  d
  41. #undef EDMA3_DEBUG+ O/ K8 r: _# O* c* _
  42. /*#define EDMA3_DEBUG*/( C) A, W: Q7 L3 L2 p6 J0 d+ W
  43. 0 `& n+ _' r( Y  J8 p! Y4 s0 G, z/ L
  44. #ifdef EDMA3_DEBUG
    % Q% ?/ W$ _- o' ~1 ?& G0 d1 j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 A( j( a& N; {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' `; x: M9 V- D0 {) B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # z- x- j) E  v" W! E" V
  48. #else% \, i1 }" ]; ?5 w/ c
  49. #define DMA_PRINTK( x... )
    ) l, b# a( S2 p! v' M/ g# e
  50. #define DMA_FN_IN
    $ F. p$ X. P' ^; q5 V
  51. #define DMA_FN_OUT
    % m: l: ?7 w: T5 E
  52. #endif' ~7 M5 H  t0 A% T+ g

  53. + f7 A4 k3 t% ^0 u8 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 w6 i. E9 h& {1 ]0 M
  55. #define STATIC_SHIFT                3  Y8 D) R% W* z2 X8 k. f2 i; M
  56. #define TCINTEN_SHIFT               20+ Z" A: h8 ^; A8 g: y* y2 O* u0 ?# t
  57. #define ITCINTEN_SHIFT              21  S% [( @/ ?! V& s
  58. #define TCCHEN_SHIFT                225 n8 l% X% y4 Q7 j3 {* q/ b3 j3 h
  59. #define ITCCHEN_SHIFT               239 e& B: B; x/ v& `4 Y1 {
  60. 5 ]$ G6 z0 R& P& ]
  61. static volatile int irqraised1 = 0;
    * H6 r3 `: o6 G, F. E) |0 F" r3 n
  62. static volatile int irqraised2 = 0;5 C$ J+ B% z4 s0 k% Y2 m
  63. $ [! D) v) H/ q! _& e+ s2 N6 z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 e& R/ o  ~. m9 F0 J) ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  y( _/ I2 a! V0 y* X, o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 w+ w) T/ a9 u. k

  67. 4 e: q6 |, ~' ?  Y0 `% ~( @
  68. dma_addr_t dmaphyssrc1 = 0;) [& L5 E% k/ J$ W3 S5 b
  69. dma_addr_t dmaphyssrc2 = 0;
    2 a" {0 I4 L. s  l* B# X% B
  70. dma_addr_t dmaphysdest1 = 0;0 S& R) g* ?5 d
  71. dma_addr_t dmaphysdest2 = 0;
    - v9 H! {- ^9 _- l
  72. ) c0 L* U7 z2 F. D  J- \
  73. char *dmabufsrc1 = NULL;  x4 i. b) H& H4 j+ h! F- v. k
  74. char *dmabufsrc2 = NULL;7 P0 f& E. Z, K" c
  75. char *dmabufdest1 = NULL;" b. Q, p! {, Z+ K( l) F$ L
  76. char *dmabufdest2 = NULL;
    ( E; l# u: H+ c% t* t$ q

  77. 8 L* D8 j2 V7 d5 V% Y5 n6 m
  78. static int acnt = 512;7 P& f$ m( P8 ]3 ^0 K
  79. static int bcnt = 8;4 [$ J  f3 M* m2 _/ a
  80. static int ccnt = 8;( L. ^. F+ C! M% A$ S
  81. 3 r- {) y1 i& @
  82. module_param(acnt, int, S_IRUGO);# z& n4 K/ D6 d* p8 E: F" \
  83. module_param(bcnt, int, S_IRUGO);
    1 y+ z$ p) Q" j% F/ H+ |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- b4 r9 @+ c, |) z$ C! w! ~- C6 z  [  x

) V, A9 L  w( ~4 P4 z! Z+ ]& A$ c( `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: ~0 X4 x+ h' i
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 g6 }$ Y4 e- J# m0 c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ B& z2 Y, C9 W9 \' D0 B

9 T( i9 n: E+ u% j, N. B
7 ^# n) b, u1 p& J* @- j- u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 14:45 , Processed in 0.037248 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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