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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" |, ^2 P# u' f4 h
  1. [code]EDMA sample test application$ d# ^! t, z7 r7 I$ n
  2. /*7 n" c$ }$ p# i! q
  3. * edma_test.c
    " O- a% {4 l  ~. O+ |
  4. *
    8 u  U% {1 B( W2 F
  5. * brief  EDMA3 Test Application$ f) e1 j+ `" m5 g0 j8 j' a6 i
  6. *
    / t4 F/ `$ x% w( S- ~
  7. *   This file contains EDMA3 Test code.2 t' ]3 p. r6 m% C
  8. *( D! d( \1 z' W# B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" h( u  ~6 e; Z3 E
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 o+ |( d9 W& ^7 w8 Q! b
  11. *         TO CHANGE.
    7 F5 ^) a6 K8 E( @( _/ f
  12. *; ]# I% |& J) j8 w( Z( v/ g2 r. p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 }( {6 E$ p5 z5 y+ j' ~/ P3 w1 t
  14. *6 t. w* |) d: X9 J; S3 j! q. R* O
  15. * This program is free software; you can redistribute it and/or% `* y- c* h* T/ g
  16. * modify it under the terms of the GNU General Public License as
    ( Y; p( I3 z9 O: M; f- F
  17. * published by the Free Software Foundation version 2.
    , r/ S0 T( |6 H) j
  18. *
    6 z* S$ D. z& M+ V2 m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : a# z! g7 @: x; c& f+ H$ }3 O: R
  20. * kind, whether express or implied; without even the implied warranty1 @) F3 e; X7 z4 e5 y! E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - G( o2 G7 ^" ^  J
  22. * GNU General Public License for more details.- h3 z! l, [% }3 M$ N
  23. */
    ; Q* w* L4 {% {/ n  Q' @5 \, c
  24.   f3 I( Y6 u4 N0 I9 o
  25. #include <linux/module.h>
    3 j" R! d. H2 h$ p- R( @
  26. #include <linux/init.h>
    % }0 \$ S: x& A& s
  27. #include <linux/errno.h>. L1 F/ D# ~. W/ H% V, H4 G
  28. #include <linux/types.h>
    9 t. G+ M) p# c% c) k3 p% @
  29. #include <linux/interrupt.h>0 w' y: R5 i1 X6 S5 o, w  |! w) |
  30. #include <asm/io.h>1 R1 X' h6 M: A8 k- y" X
  31. #include <linux/moduleparam.h>- q* z+ W4 @- Z, e7 T
  32. #include <linux/sysctl.h>, Z1 ]. e0 R0 G  Q
  33. #include <linux/mm.h>
    & x7 U& h5 T. F1 p! R0 `6 R
  34. #include <linux/dma-mapping.h>0 T( m# ]/ U+ ?; x
  35. 9 u  x5 I% J* a2 J
  36. #include <mach/memory.h>2 e4 I1 I2 ~4 ]. ^6 ^- E3 O
  37. #include <mach/hardware.h>
    * v2 w  y. o3 W( t7 k" {
  38. #include <mach/irqs.h>
    ! D: U4 A2 ^% u; T5 Z, K) U* a
  39. #include <asm/hardware/edma.h>
    ' a1 }, D8 f3 Y9 Y5 T/ N
  40. 8 x: K" N5 Q+ R' C
  41. #undef EDMA3_DEBUG
    , y1 z( A( f' F* Q! c7 d5 k
  42. /*#define EDMA3_DEBUG*/
    - U4 U2 j7 o( B% m
  43. ; z6 z, S, K$ |( W' \  x. S
  44. #ifdef EDMA3_DEBUG3 y4 [  m# ?3 Y' O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) a( ], v/ b# Y+ v  Y6 m! v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 N& V0 p/ x/ Y, N- ^$ l5 b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 ~$ M& ]) B4 c$ R/ ]1 m
  48. #else+ O- V% A* t+ X/ O0 Y: v
  49. #define DMA_PRINTK( x... )2 L0 q1 s, C5 Y1 }% a, P$ c( X" y
  50. #define DMA_FN_IN
    ) x: m5 ]0 \) J( t, Q7 S
  51. #define DMA_FN_OUT, X) ~6 G! G  `8 i8 N! v
  52. #endif$ q/ ]/ I6 d8 F3 h

  53. + |, F# ^7 I+ t! p) c/ i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  O) M1 u7 H9 e! h1 u# Y
  55. #define STATIC_SHIFT                3" }4 n  o! L8 }: ^% l: m
  56. #define TCINTEN_SHIFT               20
    ) o# F  n- ~0 |* Q1 M
  57. #define ITCINTEN_SHIFT              21
    : s& z0 r4 y; v* [0 g4 z& U
  58. #define TCCHEN_SHIFT                228 i7 r3 p  ~6 C+ N
  59. #define ITCCHEN_SHIFT               23! u, s& i! V8 r# ^

  60. ! h; w4 K% w8 b" l
  61. static volatile int irqraised1 = 0;! S( K. q3 ]2 f6 k( z
  62. static volatile int irqraised2 = 0;5 F, M5 T( c! C/ \, |+ [
  63.   [7 ?+ x) o2 ?& a9 _7 n4 |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 Y* r) s: z+ `* R' ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 E! |  c: b+ g! i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 a. ~& I& \( a# J  E2 W  ]
  67. * k+ Q3 L, Z- y+ j8 Q
  68. dma_addr_t dmaphyssrc1 = 0;. I: S0 ?. V. `9 {. g/ j5 u5 S
  69. dma_addr_t dmaphyssrc2 = 0;2 C0 l+ M" e2 o6 B' C1 g
  70. dma_addr_t dmaphysdest1 = 0;& q6 N# e- s; o& w4 s" h
  71. dma_addr_t dmaphysdest2 = 0;
    5 N- l" X2 z0 I8 [9 i

  72. ) k- l* e! s* K) k2 M# l4 e
  73. char *dmabufsrc1 = NULL;
    , u5 o6 w0 h0 D* ]* h6 N
  74. char *dmabufsrc2 = NULL;1 r5 e4 A2 [6 }  |, l6 p) Y
  75. char *dmabufdest1 = NULL;6 ?# H! W0 ]. F- ^; y- F$ H; q+ u
  76. char *dmabufdest2 = NULL;+ t# {) |; F) w
  77. % e) t1 c8 I$ k& B6 o4 s
  78. static int acnt = 512;3 h5 G, [; y- e  L! x* R! D0 a# v4 j
  79. static int bcnt = 8;
    6 {* L# j% f* b# c1 V& b
  80. static int ccnt = 8;" S' s% L- }8 \1 C6 T
  81.   _. j" L6 l# d& L1 @
  82. module_param(acnt, int, S_IRUGO);+ T7 n; V: j5 B9 Y% {) p( S1 F  @+ S
  83. module_param(bcnt, int, S_IRUGO);
    ! G  z1 A4 v% T/ u- P: {. V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 @$ R0 ]: G2 U3 _
9 e' h' p/ m" n" C7 O+ S' c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# w! o$ M/ R' P, i/ H( m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* E' H" s& ^, H5 b- Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  p4 l+ n; u  ^5 L, R+ ^' g
# ~& o3 _$ L9 W, }5 D& W6 J

' W9 g7 N3 `+ g* C5 ~( e) J: w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 11:28 , Processed in 0.037805 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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