OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 4 H' G9 w' Y! L) x  e. {" w; Y8 Q
  1. [code]EDMA sample test application
    % l3 @4 q5 J, P4 U; w' f
  2. /*
    ) ^5 D* T9 ~. }+ T) o) u
  3. * edma_test.c5 s1 e* ~; C0 Z9 x2 y
  4. *( U1 l" G: d' v* K
  5. * brief  EDMA3 Test Application
    - J0 J8 m4 I- b- q9 T3 o$ t2 h
  6. *; s! g  u1 V$ b& z5 V+ D) L
  7. *   This file contains EDMA3 Test code.# d& P% c+ ]5 a" ?* }* E  O) Q
  8. *& n- M+ |$ o9 |" i6 j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ L  S6 Q7 m  w' x- d8 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) p+ s: I5 g7 ]  C- a
  11. *         TO CHANGE.+ h0 @  ?" {5 A
  12. *9 X( g$ [4 [" W7 Z/ ?& W2 j+ U0 ]+ i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 B/ ?1 H; b" x& h9 P) h
  14. *
    0 N7 ^8 n$ I  g* P
  15. * This program is free software; you can redistribute it and/or* U: b* Y# e  q4 X8 t
  16. * modify it under the terms of the GNU General Public License as2 `4 w* C2 t6 }, c
  17. * published by the Free Software Foundation version 2.
    8 S6 y' Y% J- D9 L
  18. *
    ) Y0 v/ ^9 C3 k" Q  u0 P0 N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 O. n2 j# u0 N; m, J
  20. * kind, whether express or implied; without even the implied warranty1 o/ H5 c9 v1 |& o. b4 r1 v1 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( Q" E0 z! v! R! V0 U
  22. * GNU General Public License for more details.% s& J( _" t% e5 `0 T
  23. */* A; u. i( w! V! [7 F/ y

  24. 8 c+ H% H. L, k- X* C* L) c
  25. #include <linux/module.h>2 O9 h: p5 n" ~3 G) a
  26. #include <linux/init.h>$ w# g; U$ U  L3 m+ ]* ?
  27. #include <linux/errno.h>0 R2 E1 N9 t" Q# h* k2 T
  28. #include <linux/types.h>
    ; L% L# ^9 A+ f9 x+ w) e3 w
  29. #include <linux/interrupt.h>  S* F4 O+ {" c4 H9 x
  30. #include <asm/io.h>
    0 ^9 x. w# O  h8 |& p
  31. #include <linux/moduleparam.h>; j% {5 O, l" h8 b+ h% R& C
  32. #include <linux/sysctl.h>- Y" y3 X& M/ T" ?
  33. #include <linux/mm.h>
    4 |0 |& \# z# W, `7 _5 O
  34. #include <linux/dma-mapping.h>
    0 T9 y6 Q+ z; {+ u, s( l# C
  35. $ _8 K) b& s! S& e
  36. #include <mach/memory.h>
    $ _( S+ b7 M+ `7 p) U
  37. #include <mach/hardware.h>8 K7 q7 D5 M% ?# u
  38. #include <mach/irqs.h>3 w$ I& c5 ~% ^6 m! D
  39. #include <asm/hardware/edma.h>
    ! Q6 U5 n6 r7 ~" b3 f. S3 `- E: \; ^( w3 i

  40. . H7 `7 ~+ T7 M* e, C6 n
  41. #undef EDMA3_DEBUG' U* _% ~# Q/ n6 G# _# v
  42. /*#define EDMA3_DEBUG*/
    3 F0 e* t- s: P# v, I+ `
  43. ; y' u" [0 }7 q- q: C
  44. #ifdef EDMA3_DEBUG
    6 c9 |: M, i; H9 r; Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ I' ^/ T9 H/ Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 M! _7 \2 Q3 j) F% c' `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 A( B! q% \; E" @: E4 w
  48. #else
    ) ^8 `+ F1 l2 \" P$ U& s1 a6 i" C# h
  49. #define DMA_PRINTK( x... )
    # ]/ t* M3 M" l  J: F
  50. #define DMA_FN_IN# K+ o/ f# Z+ ~
  51. #define DMA_FN_OUT
    7 [3 t# _( ]- v% n
  52. #endif/ y7 N0 D2 T* |
  53. " ~4 b1 F6 }- f* `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): _3 x8 Y1 K/ I% Q) P  {5 l
  55. #define STATIC_SHIFT                3
    / m8 Q' G- e( P8 K7 V- ]
  56. #define TCINTEN_SHIFT               20
    " j' P9 A6 l9 v8 J- H, }( P$ `
  57. #define ITCINTEN_SHIFT              219 i' q/ l1 E# W$ r
  58. #define TCCHEN_SHIFT                22
    7 d% i0 f6 H# ]0 M% ^
  59. #define ITCCHEN_SHIFT               23
    1 {8 h2 j  f8 H6 w5 D& H9 w) N

  60. % z6 ~* H5 ~* @% y7 a! f
  61. static volatile int irqraised1 = 0;- e7 d& {. M0 q9 _
  62. static volatile int irqraised2 = 0;* I6 Q4 z; K3 K1 _8 n- J4 I

  63. 7 M3 z8 C6 k+ c4 @% @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) G+ K+ g% P7 h3 d! O8 k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 @- W1 C; l( N* @  n, y+ }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 j2 Z( [6 A! Q% ]+ e
  67. " l" w  p' z6 I
  68. dma_addr_t dmaphyssrc1 = 0;
    ' I, F6 @- @9 j( ]" ^  F9 M  L! u* V- w
  69. dma_addr_t dmaphyssrc2 = 0;! ?2 H6 x+ p1 V! |* ?
  70. dma_addr_t dmaphysdest1 = 0;
    5 ^* ^8 ?) C9 g8 {2 l# Q; B* ?
  71. dma_addr_t dmaphysdest2 = 0;
    * Z. F; x! q& b" o0 B$ }# l
  72. 1 O7 L% d; k% l4 K( l4 ^
  73. char *dmabufsrc1 = NULL;
    ' E$ K3 {, l' k" y
  74. char *dmabufsrc2 = NULL;
    , }4 V1 z. _# e9 C1 ^3 P+ V3 j' |
  75. char *dmabufdest1 = NULL;/ ^! o6 i( J* _
  76. char *dmabufdest2 = NULL;
    / y% V2 q5 R' p+ u8 q
  77. ! G2 c* l( x3 |+ C; ^8 Z
  78. static int acnt = 512;
    / j( U! m7 E3 l% C& Z" U
  79. static int bcnt = 8;  k: V+ N1 `1 W5 A5 d  C) S& v
  80. static int ccnt = 8;
    7 |! B9 m. J& c, s, P4 v- e
  81. 1 S7 \0 o% Z4 a6 t" ^+ }4 t' W  k
  82. module_param(acnt, int, S_IRUGO);
    + i) j9 }* D7 u) j3 Q* M4 m/ Z+ o) L
  83. module_param(bcnt, int, S_IRUGO);/ `& {7 J! N5 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( @/ |" o0 z! _. s+ J1 I0 \- b
( C! b5 A7 t- X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' @& A& Z" d: M- karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" D1 f1 ~/ d& y( P, i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, P& h% a  @7 J5 H
6 g( @! N: e  H$ _; F  ?3 m9 ^# i6 [, k1 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-3-6 10:40 , Processed in 0.038957 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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