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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, h9 }( y0 H# d( {2 M! B' x9 v2 e, `- G
  1. [code]EDMA sample test application
    3 p9 \& l7 H1 z! p
  2. /*
    & ^8 b# K9 N: T
  3. * edma_test.c
    6 V: B+ }  T- n3 z9 R$ U
  4. *
      [1 }& q$ U" k6 T0 g" b
  5. * brief  EDMA3 Test Application- \5 L3 ^8 O+ E
  6. *
    # i9 Q) R  T0 g
  7. *   This file contains EDMA3 Test code.8 C, T; l5 n1 K" U$ G* x( y
  8. *
    8 g/ H: f* R- _: C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, j; G1 ^2 h, J( a3 V; b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 ~; B: O3 n! f2 f4 Y
  11. *         TO CHANGE.) D8 d. m3 F- J# E% t' x( f( E
  12. *
    ; ^' r- N; I3 K, _3 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; P, l7 B. a3 Y; ?
  14. *) V. N( u* [8 A7 ]8 r% q7 ]
  15. * This program is free software; you can redistribute it and/or
    3 K+ N$ v0 f1 M: e. t7 {
  16. * modify it under the terms of the GNU General Public License as
    ) p" v! T  o% s) s; K) ?
  17. * published by the Free Software Foundation version 2.
      b& n) J, W  `
  18. *1 ?/ S$ y2 N% E0 c" Q, }- I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - }7 ]8 m9 Y, B) r+ _) Q
  20. * kind, whether express or implied; without even the implied warranty
    . }: v4 n% E5 f6 ~7 j) g  I8 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 u. d9 I9 p5 Y6 h
  22. * GNU General Public License for more details.3 K4 J0 Z) Y, n; b
  23. */
    # [% T- d( |! E; U( ?# H

  24. 8 H9 M; m6 O7 B& E: O+ i
  25. #include <linux/module.h>
    9 A0 ]# \! I5 h
  26. #include <linux/init.h>
    ' @) S, ^' n' y5 Q' ~% P! ?0 W" r
  27. #include <linux/errno.h>
    8 j3 W2 N1 K6 J- n6 F# ]
  28. #include <linux/types.h>
      `5 B: F$ ?$ c% k/ x
  29. #include <linux/interrupt.h>
    . Z% K4 v8 w) g  G
  30. #include <asm/io.h>  u1 ~. u7 ]& O
  31. #include <linux/moduleparam.h>
      F2 ^+ B' A3 n* c! Y# I: u( F
  32. #include <linux/sysctl.h>
    . Q& c! k* ]2 S! ^; f# |
  33. #include <linux/mm.h>
    : R* p4 y" S8 |+ @
  34. #include <linux/dma-mapping.h>: N/ X: F# P5 \) e* c4 D

  35. 3 d  i" s6 s1 L3 [6 N, P/ k% _4 X
  36. #include <mach/memory.h>
    $ M7 F0 ?/ m% Q6 v
  37. #include <mach/hardware.h>; ]0 P! k4 B- \% a0 n! U; l
  38. #include <mach/irqs.h>
    7 p& l- [: d) }8 n
  39. #include <asm/hardware/edma.h>$ T7 J5 J+ |; p" ?! u+ o1 Y& ~1 C" }

  40. / ~- ^8 U' i% f1 o4 |) X% F
  41. #undef EDMA3_DEBUG
    9 l2 E1 V' O# R+ B
  42. /*#define EDMA3_DEBUG*/
      e" `7 m/ ?) ^

  43. + @: y% s: I5 |3 O; ~( n
  44. #ifdef EDMA3_DEBUG0 a1 w8 [5 Q% y$ e: Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ X, ~5 Y: D; t. U* {6 L* t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) w6 W6 f- z- y, Z( L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : O4 x& R7 n( y. o/ b/ d9 u
  48. #else
    4 }$ A4 `5 N1 P$ @$ y
  49. #define DMA_PRINTK( x... )
    8 X1 V( o( o3 h" ^+ n$ m7 W9 t
  50. #define DMA_FN_IN
    5 Q( c) x# P- h6 Z1 W& P7 _% T& o
  51. #define DMA_FN_OUT
    + \4 B+ t! b* {6 g. h: W
  52. #endif4 U6 ?- H4 {( r7 X. R5 V
  53. 1 ~1 K* s- ], K  e" c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( A+ m9 a9 z6 I+ b% t! a* e& f
  55. #define STATIC_SHIFT                3) [6 T1 v# Z! R' \  v
  56. #define TCINTEN_SHIFT               20# z* _  i9 p( @+ g3 I, s
  57. #define ITCINTEN_SHIFT              212 l, P# h; {$ r, U  r
  58. #define TCCHEN_SHIFT                228 W- l$ B* t5 I% l
  59. #define ITCCHEN_SHIFT               23
    9 J  r4 i6 {. I
  60. $ X) H: K. E3 E7 S7 H  c+ E
  61. static volatile int irqraised1 = 0;# ^; D8 C9 p: s
  62. static volatile int irqraised2 = 0;" i; O1 K2 v4 u- F* z* \
  63. / s# |5 K* E+ ]1 l4 V( p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & D+ L2 c7 S- Z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 u; a5 E! p' g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. ?. K; \' i( J9 U7 Y% i' {& w6 t
  67. , Q! K; z7 K* q. @! y
  68. dma_addr_t dmaphyssrc1 = 0;
    7 V9 Y1 S- S7 Q
  69. dma_addr_t dmaphyssrc2 = 0;
    % w; J0 ]9 _/ S% V' x! c
  70. dma_addr_t dmaphysdest1 = 0;, x7 t; ^8 F/ N/ s6 j  `' a8 `
  71. dma_addr_t dmaphysdest2 = 0;8 j. O2 s( @" Z; i: \! j' ^( Z

  72. + K' Z. B' c* J# i* S$ y: e" a  Q8 K( U
  73. char *dmabufsrc1 = NULL;
    % w- K+ Z0 c0 U
  74. char *dmabufsrc2 = NULL;
    " R, V  w9 Q, z0 y% p, l- P
  75. char *dmabufdest1 = NULL;
    , T* c* G) T) [0 L: |) J8 s
  76. char *dmabufdest2 = NULL;
    , c2 a/ J3 z8 o: E

  77. 6 o8 {* k4 G8 z1 w/ v, m0 v' M' t
  78. static int acnt = 512;2 K( W. i% e# i" R
  79. static int bcnt = 8;
    # \2 Q" `4 a9 X$ H8 ~
  80. static int ccnt = 8;1 E% ^4 G" N! D/ R& m' g8 i

  81. 2 J* b- _! g7 W, g! o' Y( R7 O6 q
  82. module_param(acnt, int, S_IRUGO);
    2 [  N- }1 I4 O3 v& q* u! S3 n& K
  83. module_param(bcnt, int, S_IRUGO);$ a5 ~  k( e& T8 m$ X2 k& R) Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 ^/ k7 [' D1 J/ Y$ S. R. X* O7 i/ _' }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. v8 t" G6 T9 s0 V% ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。; l+ O( l4 O; h3 ?2 Q3 s2 O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% u* Z* k" L0 w, d2 T
* ]" h) N+ P% a& J2 v
1 v8 {! \" V$ i, ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-23 10:09 , Processed in 0.038750 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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