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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% h* G7 c8 M. v4 `0 {4 U  [' M
  1. [code]EDMA sample test application& G; A9 K4 B0 Y9 I  f
  2. /*
    3 P( G+ U" Z7 p+ o
  3. * edma_test.c: B) B+ B2 t4 k7 ]5 i+ [& O, G
  4. *
    9 y; G6 _. n  R/ S. M, _, ^4 h
  5. * brief  EDMA3 Test Application
    / l9 v$ k7 Y: c8 _0 ^# C
  6. *
    1 d# B! x0 r' ?5 }( y
  7. *   This file contains EDMA3 Test code.
    $ X2 J/ F% e0 X- e- a
  8. *( k! ~2 E6 ~/ P' o2 P: S1 o2 l. p; x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; ]1 v) T: z4 k6 z! Y' ~8 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * y3 e1 d/ e" ^3 X8 j  o9 P
  11. *         TO CHANGE.
    9 O- t7 }0 M5 g9 |
  12. *
    7 R8 f9 ~8 R) W( W% @1 g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 t/ |" h! `- _4 b
  14. *
    6 h  i: \4 S. F* x  e! f, @
  15. * This program is free software; you can redistribute it and/or
    , s* i1 P5 ~+ f/ m+ t
  16. * modify it under the terms of the GNU General Public License as
    ; v; e. O' r/ q; P+ [
  17. * published by the Free Software Foundation version 2.
    & _! \! ?1 h4 ?$ B
  18. ** o$ s8 [2 |: R/ [* A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' D. K2 H7 @$ u' x4 z
  20. * kind, whether express or implied; without even the implied warranty- B$ W& l& x- }, h; b* E0 R" H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # k3 `) p$ u+ r) U0 }$ M
  22. * GNU General Public License for more details.$ J! |$ I' B) l
  23. */; F! Z2 u3 s3 t: [- F2 A" C

  24. * e4 C  h0 e# j. ~% k0 \3 Y2 _
  25. #include <linux/module.h>
    - e1 L8 ]6 j4 i2 d+ e' p
  26. #include <linux/init.h>0 }# I9 J0 F5 q6 N' E
  27. #include <linux/errno.h>+ r- E% G# X. {8 B$ I: }0 z& n2 q
  28. #include <linux/types.h>
    6 U& b- W; m) ?) S& n. A: q# D4 Z7 v1 n
  29. #include <linux/interrupt.h>7 H, I# l5 h4 y% z
  30. #include <asm/io.h>
    + r9 k+ E2 B  j9 P# V8 E7 n* i1 X
  31. #include <linux/moduleparam.h>
    7 f0 e+ P7 c/ G; v
  32. #include <linux/sysctl.h>
    8 m; Z1 N$ Y4 |, y! ~: v& H
  33. #include <linux/mm.h>6 ?) z, N7 Q/ c' b4 X+ _# d1 D
  34. #include <linux/dma-mapping.h>
    5 X; a7 A3 E1 _, E0 p

  35. ' Y9 s3 Q! t! j+ b/ T: P5 h
  36. #include <mach/memory.h>
    - I" W- ?( x9 |
  37. #include <mach/hardware.h>
    ) m9 H) b, |, |, g% H; Z4 ^3 Z. ?
  38. #include <mach/irqs.h>
    3 G0 l- V' G' i
  39. #include <asm/hardware/edma.h>0 w% \* w9 Z" [  J) z! U, m1 b
  40. $ ]/ M) Q7 R# g6 j/ }: j0 v/ @! k
  41. #undef EDMA3_DEBUG, c8 r0 |" y9 k$ |2 W
  42. /*#define EDMA3_DEBUG*/
    0 f+ T$ m- f  x) c: A' D

  43. 1 O0 I9 i, }) a' e
  44. #ifdef EDMA3_DEBUG
    * R  y9 @6 j5 q7 G* M" t; |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): O% t* b% t! a) I' b1 o+ l
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( H' f3 E  I4 M7 R6 y) M$ z* {+ g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 |& C; Y: }; h/ E8 u3 h- v
  48. #else1 G5 ~- I% h: M2 k
  49. #define DMA_PRINTK( x... )
      f" _# [/ I, U6 P! o
  50. #define DMA_FN_IN
    ! i. Q* ]+ G( [1 W) s' m9 P2 `
  51. #define DMA_FN_OUT
    7 ~% o+ }) O" E5 l
  52. #endif6 H) ~5 M6 n. g; Q; _% v& \

  53. 1 j( m. x5 ^2 O& m3 J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ U0 Z( P( E* v0 b! o; M
  55. #define STATIC_SHIFT                3+ o, s' D, c8 C: t
  56. #define TCINTEN_SHIFT               20
    - [. Q/ W. [3 e. Y/ c
  57. #define ITCINTEN_SHIFT              21
    % k* Z7 K+ ]* r0 p5 a
  58. #define TCCHEN_SHIFT                22
    6 B3 E: S0 H# c4 J6 I, a
  59. #define ITCCHEN_SHIFT               23
    0 T9 ^8 ^) r, [3 f+ s: N

  60. ; B1 N1 \% ]0 w/ p
  61. static volatile int irqraised1 = 0;1 ^4 A5 Q$ @" e+ i( _- w1 _' L
  62. static volatile int irqraised2 = 0;
    1 K7 s$ A& C( b& A& W% `
  63. 3 K  R4 |3 X7 Z; A! Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ z. g! ^3 q" r# c! w( c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 n( h  I, m- c" l/ h* y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * f, {- o% U! B6 Q6 `6 o
  67. 5 E8 {$ d1 r9 J7 I% {6 ~1 m& |+ l& v
  68. dma_addr_t dmaphyssrc1 = 0;! t2 ~/ V9 o- K) k9 X
  69. dma_addr_t dmaphyssrc2 = 0;
    7 g: ?) y5 s* S
  70. dma_addr_t dmaphysdest1 = 0;4 v/ g- w# D( b+ ^. d& J
  71. dma_addr_t dmaphysdest2 = 0;' b8 C6 d% L- G
  72. & q0 x/ d/ h+ C" m  q7 o
  73. char *dmabufsrc1 = NULL;
    - v" n1 q: y: z; a- P1 \
  74. char *dmabufsrc2 = NULL;. I, D7 A8 ]+ k2 c$ [$ V
  75. char *dmabufdest1 = NULL;* B" i9 N, J4 a0 Q% O; N+ g
  76. char *dmabufdest2 = NULL;' S% o# r2 C8 K

  77. " k1 w2 i5 w9 O3 h) u( H: g
  78. static int acnt = 512;$ V2 H( X# O4 `
  79. static int bcnt = 8;! ^3 `- k9 {& d. z  i0 W
  80. static int ccnt = 8;
    . d  ]! q/ i/ C

  81. % F3 `* J* h7 ^+ s! D' y
  82. module_param(acnt, int, S_IRUGO);
    - b8 }+ n, Q# j3 V: q
  83. module_param(bcnt, int, S_IRUGO);# l( ?( x. x& Q) N5 H+ `
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 Y8 _0 n( I* M1 {$ s+ T0 _
' U" I5 o* I- E3 E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ U, l3 J3 i' l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. {9 @' O* c: [+ {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. L! u: R  H5 |7 {2 g& o' T2 R. u5 }2 p5 E$ g
  l+ a4 o9 V( g0 l; ]9 v' }2 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 09:40 , Processed in 0.039675 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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