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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 Z( X/ s' k" w% D: f9 ^
  1. [code]EDMA sample test application/ q5 x7 u+ m7 B" \' C0 x% c2 I
  2. /*9 e$ H5 z* R- P( B* b
  3. * edma_test.c
    . n- I! u: p4 ]8 s2 E7 Q9 O" `1 F
  4. *
    6 ~" }) S7 r8 D* G5 w; Z
  5. * brief  EDMA3 Test Application4 z" D. L$ H! t: ^
  6. *
    " Z! O, ]/ U4 `7 {9 s
  7. *   This file contains EDMA3 Test code.
    7 O0 q* N( N2 m; @9 q0 E  O
  8. *5 O& k! F! u- Q  m) l$ J1 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - ]# x) C+ e7 Q2 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 y. r8 B% x! J* ?! y
  11. *         TO CHANGE.
    6 X8 N! t4 h5 p+ n
  12. *
    1 W. X5 A6 X1 j% g2 M1 k( ^$ W4 c5 {7 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" U, Q0 q1 T0 S) E" M1 B2 @
  14. *
    ( j' ]: P3 Z7 D- e# c
  15. * This program is free software; you can redistribute it and/or
    & ?  N( s4 F" X. z/ l
  16. * modify it under the terms of the GNU General Public License as
    4 t# J6 p2 r! ?* T
  17. * published by the Free Software Foundation version 2.9 N/ Z9 |5 d2 w/ ^2 t) S+ I
  18. *3 w& |* ^* R$ {" [$ J1 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 b& h  u5 m( |7 j3 Y$ K
  20. * kind, whether express or implied; without even the implied warranty
    8 h, ~  |( ^0 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ v( @- f: o! _' ~
  22. * GNU General Public License for more details.  f' d2 O- j; A2 `! K5 s, S1 ~) D
  23. */) s. R' W/ S2 P/ G  Y
  24. , [' c0 `7 s0 p4 Z# u* U/ z; S0 W+ s; ~
  25. #include <linux/module.h>
    # |5 W6 b  y3 r& C, }  q& v( Y
  26. #include <linux/init.h>
    " T+ i, i, k, }; K4 A; o# X
  27. #include <linux/errno.h>0 w- R9 r& u% @  X+ t7 A
  28. #include <linux/types.h>! X" b1 \4 `: {3 n/ ~: X* E
  29. #include <linux/interrupt.h>
    ; g6 m! B8 G4 g0 o5 o6 h
  30. #include <asm/io.h>
    $ E* e4 z- j9 b# K3 ~: |: S( i
  31. #include <linux/moduleparam.h>2 k" ]# |8 r; K0 T( m
  32. #include <linux/sysctl.h>5 ]! v) M4 C0 l9 z( E" |. u9 @
  33. #include <linux/mm.h>1 U9 n' Z: e( V" I& U7 k; Q7 p
  34. #include <linux/dma-mapping.h>
    . W4 M/ {$ y( e
  35. . t0 f/ E$ ]  N" v: G
  36. #include <mach/memory.h>
    " d8 A; s# _! K- d1 _! a  W
  37. #include <mach/hardware.h>
    6 t! `8 ?8 B  p
  38. #include <mach/irqs.h>
      }5 `( I  H9 s' ^* B4 j
  39. #include <asm/hardware/edma.h>+ d$ R4 L4 Q! ]  X  e
  40. 7 [# c/ H/ R3 M$ t5 K
  41. #undef EDMA3_DEBUG+ _( f% `' d9 k& M( ~8 M
  42. /*#define EDMA3_DEBUG*/- s8 t' \: d7 H! Z( M7 F4 q
  43. 7 ?3 `/ h" T9 f, H
  44. #ifdef EDMA3_DEBUG) D3 L0 f! a" R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# O' m2 G6 V; U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& D  s! o$ U* s' y' O6 O1 F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , P0 f/ {$ [+ r% L6 i( P8 U$ ~
  48. #else
    ) l7 }2 L* v1 |  N" u
  49. #define DMA_PRINTK( x... )% I1 |& }9 R+ f
  50. #define DMA_FN_IN# ]2 g& ^/ Z1 l1 `( b( @
  51. #define DMA_FN_OUT
    2 ~6 e3 M# ^+ e% ?1 R2 Y
  52. #endif4 B: H0 I2 m  @0 W" {
  53. 0 a* M4 Y7 i! u+ X8 I! d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), P6 p, ^2 J# s7 M
  55. #define STATIC_SHIFT                3
    8 ?$ r( A7 s1 @" {# ^3 |+ E  ]1 f
  56. #define TCINTEN_SHIFT               20
    ) Y2 i2 E: V* R$ e( m4 b; t: Z  Z: E
  57. #define ITCINTEN_SHIFT              21
    3 t7 ~$ C" U& h2 @: z, e! }
  58. #define TCCHEN_SHIFT                22& G  O7 U& E+ A( y+ K- L" T( c
  59. #define ITCCHEN_SHIFT               23
    ! @) k+ z/ l2 U% w
  60. 0 M" C3 R! o6 ]) ^
  61. static volatile int irqraised1 = 0;7 B8 m" [( z1 K: D
  62. static volatile int irqraised2 = 0;4 w! b% W' ^: v% D# {' X1 a1 y
  63. ( N. Q: O2 Z3 K" e! U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 Z5 [2 Q5 ?8 c9 g3 B$ Y3 ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" M! J, H. j" s" }5 R9 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 o6 N9 E- Z" G- t3 l+ h* x8 h% a0 r
  67. - v( I5 M% F' i- G2 T: S4 U
  68. dma_addr_t dmaphyssrc1 = 0;
    . t7 k7 W- |% m, m4 ^6 A& k/ D% ^
  69. dma_addr_t dmaphyssrc2 = 0;
    * @1 Q& P& H9 Z) Z
  70. dma_addr_t dmaphysdest1 = 0;( T8 [5 g/ V* j0 f. R- q
  71. dma_addr_t dmaphysdest2 = 0;3 s$ _7 @" `  g  w0 p3 `

  72. 8 V* U. B6 I$ U5 l1 t( e. n& _, W$ F3 G
  73. char *dmabufsrc1 = NULL;2 R8 N# O$ R5 a' q3 g9 Z
  74. char *dmabufsrc2 = NULL;
    ! {* w" L4 v& U; |9 K% y# o! L
  75. char *dmabufdest1 = NULL;
    + n7 }; t) h+ G+ y
  76. char *dmabufdest2 = NULL;
    2 m3 M3 V- {* ~" T% Y+ x- q+ ?. N
  77. , j/ r2 N/ k$ I+ }1 M/ ^5 _3 H* V
  78. static int acnt = 512;# L; `" t) V0 Z
  79. static int bcnt = 8;
    ' y  s* j* k% [8 d. k0 i% T% w* M
  80. static int ccnt = 8;' w/ t: b0 U' V% z7 N

  81. , z, l; G) x  F6 Z6 }/ |
  82. module_param(acnt, int, S_IRUGO);
    6 D' j% k4 S1 c% P' J5 h. w
  83. module_param(bcnt, int, S_IRUGO);
    6 J* x1 u* K  d3 @8 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) |& c- Y) s7 E' l3 E

: {, v+ c9 W0 t& C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 C3 u, T  d# V+ iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% l# c  |8 X, J: M+ r" x8 K7 V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; h& p' d1 e6 v7 }  y2 K+ c3 b6 `) E& O/ `9 n

  b# l# X, w9 ~' j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-4-30 09:24 , Processed in 0.035554 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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