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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . E8 M) U% @! d
  1. [code]EDMA sample test application
    ) p0 V: {6 a  G5 `! H  x  e
  2. /*
      b8 {& L/ w/ u: w
  3. * edma_test.c( ]! O2 b% `, y0 E2 H' I9 _
  4. *
    ' Y; `0 P7 m  V" u6 _# V( k
  5. * brief  EDMA3 Test Application
    8 `9 Z5 j% v/ K9 ^4 T
  6. *
    7 q. J0 }* z" O& I: u/ u% B
  7. *   This file contains EDMA3 Test code.
    2 U1 p" R1 F3 @
  8. *
    - |+ l) O6 M/ l" ~. Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 [4 y) @( W* G  l9 a7 o# b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 O/ d3 E1 ?6 o3 {
  11. *         TO CHANGE.
    " y( M1 I' b8 N  Z) e  c8 U
  12. *
    ; b6 b& S  {! j+ e& ~- V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( {4 u' I( ~$ U0 u/ _3 s
  14. *! _1 n- f- X' Y' v- _* z1 K
  15. * This program is free software; you can redistribute it and/or
    % T: i0 a& t+ C5 P6 J
  16. * modify it under the terms of the GNU General Public License as$ d1 j9 K/ ^+ S, o
  17. * published by the Free Software Foundation version 2.0 C  j* E+ l. v7 N* C
  18. *
    3 r' f7 Y2 B$ b7 R) Q) n& _/ v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , s( C2 v& e" Y: X* r  t' r
  20. * kind, whether express or implied; without even the implied warranty
    + F; b3 r1 \6 n9 o( h4 d& e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( P( ~1 s3 e) X- ~" u! |) m+ d5 f
  22. * GNU General Public License for more details.; I% j7 E/ ^+ h* v- N- ]$ }
  23. */
    " ~5 U* n8 x0 E: [. y
  24. 5 p# Z+ K: I: a9 j$ u
  25. #include <linux/module.h>- E( k4 J: c  G3 t
  26. #include <linux/init.h>
    & O" a) J6 n: w; }' }$ V
  27. #include <linux/errno.h>
    % n& a& Z, t3 g' x/ A% X! @
  28. #include <linux/types.h>
      j( M; b$ l0 u8 W" V" C  R
  29. #include <linux/interrupt.h>
    0 q! g0 N" P+ @( W/ o, G2 M+ ]& R
  30. #include <asm/io.h>3 j" L8 \! f3 d, Y7 u; i: l0 R) ~
  31. #include <linux/moduleparam.h>% q/ N% |4 ]. u, F
  32. #include <linux/sysctl.h>; n+ l, F% p+ o/ F
  33. #include <linux/mm.h>/ O, p/ H' R+ O/ [# D, a' J
  34. #include <linux/dma-mapping.h>
    ( w2 L, `4 D* v( h( [

  35. % b) E% g! W! c
  36. #include <mach/memory.h>( s6 E1 {0 I- n2 l; o: X+ _9 q
  37. #include <mach/hardware.h>- [5 I- d* ]% D6 m# r- ~! |
  38. #include <mach/irqs.h>4 E# \! K4 g' }0 o+ J6 m8 Q6 @
  39. #include <asm/hardware/edma.h>
    8 N5 n8 p* A- w2 w: d

  40. 0 p  D8 O( k: C8 _
  41. #undef EDMA3_DEBUG
    5 N( x' `0 H9 g
  42. /*#define EDMA3_DEBUG*/! B$ h0 A; Z0 R2 p" f) F& \8 Y
  43. 6 v3 o8 F% j- H! X3 I
  44. #ifdef EDMA3_DEBUG' u* h7 d3 T" J; H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 C+ p" Q2 v% v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      E7 M# Q2 u/ ~) O# G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' b# t. h! V0 _! f% Q
  48. #else
    6 O! K* B' Z5 Z' U7 I/ z( |" z
  49. #define DMA_PRINTK( x... )  k+ @" ]' z% y* G5 V: \
  50. #define DMA_FN_IN
    , l7 q' V( d( d! N( Z7 ~2 S8 ]
  51. #define DMA_FN_OUT
    - m8 w/ H: b, Y6 W4 ^! I/ ~8 R
  52. #endif, {0 {4 b( V0 G: |! U% D

  53. 4 R" S$ N; D% R2 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 q- T5 m/ B7 f$ Q9 H5 o
  55. #define STATIC_SHIFT                3% }0 n- X5 w7 u9 a. l. Y9 A
  56. #define TCINTEN_SHIFT               20. n. I5 H5 E6 i# f3 M
  57. #define ITCINTEN_SHIFT              21
      M+ J) r! {3 e# q
  58. #define TCCHEN_SHIFT                22  X( G. f+ W/ C. \' E# Y0 P! x
  59. #define ITCCHEN_SHIFT               23
    9 V; {+ g: a' h/ m) s5 d
  60. & C" I$ I& A7 ?* g  j. @
  61. static volatile int irqraised1 = 0;
    # e! A- Z, Y$ j0 \$ m
  62. static volatile int irqraised2 = 0;
    - |- C+ U& l% R! X7 N

  63. , V0 K* G* ?6 |3 F0 @$ u& _$ W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: M' a3 w" j, o: x3 m4 I
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 b* s( n6 d1 V. O4 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( g) c0 o6 E3 p6 o; J5 ]  [

  67. % M( Q  j" g: e; B
  68. dma_addr_t dmaphyssrc1 = 0;. S& g; r- F7 E7 |
  69. dma_addr_t dmaphyssrc2 = 0;
    / y3 W& E& K8 `) d' R! a. T0 l
  70. dma_addr_t dmaphysdest1 = 0;
    + ~* \/ p# B- o( ?
  71. dma_addr_t dmaphysdest2 = 0;# t* a- H1 I: v
  72.   L0 J. e% O  a! _
  73. char *dmabufsrc1 = NULL;
    " d, d0 W4 o6 Q. {$ ?  z4 }
  74. char *dmabufsrc2 = NULL;3 T/ ~4 w6 }, h  V: P8 B
  75. char *dmabufdest1 = NULL;
    ! k; n0 A7 E9 e% f5 e
  76. char *dmabufdest2 = NULL;
    1 B- h  _3 w9 Z+ `: |0 U
  77. 2 j9 a) H' f4 f0 o0 {
  78. static int acnt = 512;3 i( i7 E1 q% Y2 I- g/ A
  79. static int bcnt = 8;4 Z8 G9 h) x, s" c
  80. static int ccnt = 8;1 r4 C  }" ]3 G  Q; W3 y' P3 j

  81. ) x0 b0 g' e0 C7 x6 T3 A" c
  82. module_param(acnt, int, S_IRUGO);
    0 h/ U* s. W: b2 f" z: I
  83. module_param(bcnt, int, S_IRUGO);
    ' Z, k5 _+ y" i4 {1 q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 D  ?4 S4 O/ i9 o( N; B: K- T
% \5 W* v' J& o* ^# G& N4 H$ G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( Y/ H0 \) }* C$ w3 u" g6 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 d  ^2 w* m6 c! y8 \( Z8 f$ X* I, H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 W  y+ y, v6 q9 W% M6 B3 l# b4 c
4 I" H' M. Q- ?' o- x. U2 Z# X4 i6 I5 q( m5 `# K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 06:02 , Processed in 0.038161 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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