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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 Z+ N* [$ [' _! }
  1. [code]EDMA sample test application6 C' s& v8 k* C9 w" z
  2. /*4 `' s  d, _  G! r
  3. * edma_test.c) ?  L" i$ e! q6 Y9 T
  4. *2 I8 c& {- Y6 b1 u; S
  5. * brief  EDMA3 Test Application: p6 Y; b$ b2 t( S1 S' C1 ?
  6. *# [% W2 `  b2 @0 S
  7. *   This file contains EDMA3 Test code.. q2 N8 w! F- Q* n6 B9 p) x, G
  8. *
    6 W& I3 U/ F9 T" ?/ t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- r( v+ i, a" ]2 f' |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 S7 s4 f, S6 R6 P# `( I
  11. *         TO CHANGE.
    3 w. H4 s: c4 r1 M! M
  12. *
    ! A6 L# S6 I" n0 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: d3 |+ l) S; e* H, x1 O; h& U9 D
  14. *) L) e6 R4 N) }) X
  15. * This program is free software; you can redistribute it and/or
    1 }& x5 Z7 F; S% ]5 d% J
  16. * modify it under the terms of the GNU General Public License as
    ; N1 u9 F' g' D, F5 ^1 R& z4 n
  17. * published by the Free Software Foundation version 2.: [- K/ [" ?' g" G: t+ R+ q; P# Y; N
  18. *
    8 Y& ?) Z; }8 r( P2 A/ l- \) a' P7 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 W7 ]1 C% ~1 |( Q: i; R
  20. * kind, whether express or implied; without even the implied warranty
    % L" o4 C; a* R" ]' f  p. f* e4 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: e4 E4 I. t8 p+ \8 D3 u( n3 k
  22. * GNU General Public License for more details.
    # V, k4 ]* Y0 k$ P
  23. */+ K* m7 U+ E* ]
  24. 3 h/ M7 E0 D- X' M- x
  25. #include <linux/module.h>& s' ?& y: y+ l( }, u# f
  26. #include <linux/init.h>) {9 l& J# C' g9 }; T2 e
  27. #include <linux/errno.h>
    , i+ ]$ L$ {/ v! V: p- [/ b& T
  28. #include <linux/types.h>
    0 w2 x+ {2 E2 H+ r, B
  29. #include <linux/interrupt.h>% A5 ~9 _( ]1 Q8 }* `& }5 L( h# D
  30. #include <asm/io.h>
    ! Z+ }/ |9 p8 g% O& Z  @
  31. #include <linux/moduleparam.h>
    7 D3 k& [7 D. t1 U  J
  32. #include <linux/sysctl.h>
    3 q! x5 G# D* y) k% a! T' W
  33. #include <linux/mm.h>
    8 X) Q# @4 k% o% [! E
  34. #include <linux/dma-mapping.h>
    2 @& q# Q+ t% }& K" i2 O: M
  35. 0 \6 [5 l* Z& V. p
  36. #include <mach/memory.h>: v' o; `2 Q7 B
  37. #include <mach/hardware.h>. m( T4 z" V: ?* O$ c
  38. #include <mach/irqs.h>& E: Z+ ?; S# a% O5 ^
  39. #include <asm/hardware/edma.h>8 k, M" n9 Z" o( c

  40. % e. `: n% ?8 t
  41. #undef EDMA3_DEBUG
    3 ^" N, k8 i$ X& ]
  42. /*#define EDMA3_DEBUG*/
    6 W: J5 e* x' Y; \8 A  U3 v1 N

  43. 2 Y- B& w. s* K! W! m& r1 W
  44. #ifdef EDMA3_DEBUG! }4 s( ^6 Q4 V; g  S3 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) i( l+ N5 Q) P; ~$ [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ B" U8 k; k7 q5 y. m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % v8 |; f! k7 j7 i; z: ~% e
  48. #else  y' p; g# y( V; T! Y7 n% ?! P
  49. #define DMA_PRINTK( x... )
    8 P7 @3 b+ P/ r% p% C
  50. #define DMA_FN_IN/ O+ B3 F1 Z1 \# u/ d' w" N8 ^0 d
  51. #define DMA_FN_OUT& I! x( w0 y% B; i, T
  52. #endif7 q; J, i. S" I, V9 c

  53. ; B% P% B( i' R. h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): D/ p6 V8 A+ v- N8 l7 s
  55. #define STATIC_SHIFT                3
    ) E7 l& o, M5 A6 u' s
  56. #define TCINTEN_SHIFT               20
    ' c# _  U. d, ^
  57. #define ITCINTEN_SHIFT              212 Q; I! z' Y4 L! L0 O# Y
  58. #define TCCHEN_SHIFT                221 H$ j$ `7 @/ C
  59. #define ITCCHEN_SHIFT               23
    + f* j; @/ ~' Y% O9 x
  60. ! {; J4 R; o' N1 Q
  61. static volatile int irqraised1 = 0;6 `6 a" V4 |1 l
  62. static volatile int irqraised2 = 0;
    : S% l2 U) D+ w

  63. 0 J* X/ g0 h1 g+ I; N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: \% ^2 k6 N3 l% N, Y- F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, o) l4 c; G% h: b% [9 y# j' I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 m7 {# H/ c% x* r- a' ]: h

  67. 9 R8 p5 |. U1 T/ [' l, _  U. L/ ?
  68. dma_addr_t dmaphyssrc1 = 0;0 q4 D/ Y' n- Y- y: l9 ?
  69. dma_addr_t dmaphyssrc2 = 0;
    1 f+ F4 S' |( i; M6 _$ w
  70. dma_addr_t dmaphysdest1 = 0;3 _* `* @* S( G: M; o& b- W
  71. dma_addr_t dmaphysdest2 = 0;
    ; @1 F: B6 j( s- s4 V
  72. - K6 V' c% N. f- [. l# J1 w
  73. char *dmabufsrc1 = NULL;9 N# c- X; N& D
  74. char *dmabufsrc2 = NULL;
    & w2 ]- t5 v' }, \8 b- ?
  75. char *dmabufdest1 = NULL;
    $ P/ y5 Z& V' E. e9 r
  76. char *dmabufdest2 = NULL;; M# J" J" z1 E7 G8 j

  77. , @$ M6 I; j1 Q: ^5 }5 ]9 B" [
  78. static int acnt = 512;
    * t- Q5 n% Y; |; x: e) \. _& v
  79. static int bcnt = 8;& ]% F1 @8 r  k+ X7 r
  80. static int ccnt = 8;6 A( q. D9 M: H4 j6 [
  81. - }/ n5 l+ @! A7 u5 V  O
  82. module_param(acnt, int, S_IRUGO);+ k$ h6 G& R6 d1 @; e5 b0 V
  83. module_param(bcnt, int, S_IRUGO);
    ) d5 v' \1 y' @. g. G4 l1 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 |* o, u1 B7 U, G" R2 B

) z9 H( {6 N3 H9 T+ d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- ], e0 Y% ^3 F) S0 Y# f) Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 j$ a2 R! ?( i  ~3 Y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ X& L% A% {* ~3 }
4 K# K) x/ g8 |: T
, X  ]3 K7 }$ l" v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 04:41 , Processed in 0.036667 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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