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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' q$ u: y% I% X' ]- d0 e
  1. [code]EDMA sample test application
    " v" g' Z# R$ l, n
  2. /*
    , F: p& {7 P: D/ I, H' H
  3. * edma_test.c% ?( ?5 N( z+ J8 I% V
  4. *
    & ]' ]& i0 ?# I- a# M6 L
  5. * brief  EDMA3 Test Application, z) G4 ]: l7 R
  6. *# g# M8 Y* k" P
  7. *   This file contains EDMA3 Test code.
    9 F0 N" |' @2 C3 H
  8. *
    * P/ D4 `1 ~" L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 m, v6 l+ W& J+ F' H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ `% V' r; d! Q- I
  11. *         TO CHANGE.
    , J' B! ~4 I# E/ O. W
  12. *
    ' Z4 L4 @, V% q/ V! q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / C( N, F+ d# K* O
  14. *
    * M: p+ B: J! f2 r7 o
  15. * This program is free software; you can redistribute it and/or' t% y2 u3 x. G& x! I% o+ E
  16. * modify it under the terms of the GNU General Public License as3 ~6 k0 G; D8 {3 k2 i0 b6 D' @
  17. * published by the Free Software Foundation version 2.
    ) j' P; c! m) C8 c- _
  18. *5 P; o; K7 D; p) e# n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 @% \- `; l! A& e1 l8 X8 J: e
  20. * kind, whether express or implied; without even the implied warranty: @5 y5 y3 N- r0 {" Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' c7 ~8 X* @- d/ E( u
  22. * GNU General Public License for more details.4 \! k, t' X0 a0 ~
  23. */- s, H9 C4 ~+ f

  24. # c; r0 ?- O$ j& n% Z/ Z6 A. {4 V
  25. #include <linux/module.h>
    2 M7 @& X8 U6 S, Q- s! w6 ^) A0 `& m
  26. #include <linux/init.h>+ z# L0 M5 \6 m  r( ]& c  M
  27. #include <linux/errno.h># ^- ]% K; F0 `4 b% h) ?; p' ]5 G" x
  28. #include <linux/types.h>/ y4 W/ S6 ^: e
  29. #include <linux/interrupt.h>
      G" D  Y5 Y9 X2 Y* @+ c" F/ j
  30. #include <asm/io.h>9 G. h3 ?2 A) l, l0 J
  31. #include <linux/moduleparam.h>
    . h( e, \* m8 R4 ~
  32. #include <linux/sysctl.h>+ Z2 L2 @0 ?! a, l
  33. #include <linux/mm.h>/ k8 M; I# _( g' g$ c! d, ~
  34. #include <linux/dma-mapping.h>
    / |0 ]* s) {2 s" R' o2 E( v. l( `; s

  35. 3 J7 {1 k* K# `  ]3 _) s
  36. #include <mach/memory.h>
    ) U% y4 X2 {& v: ?8 P
  37. #include <mach/hardware.h>4 ?% q+ y. S0 c5 `; z6 B5 F$ A9 ?0 p
  38. #include <mach/irqs.h>4 J  k+ G& w# ^/ c$ q# F, R
  39. #include <asm/hardware/edma.h>/ S% b0 x% z) R' @0 D$ ]; X
  40. 2 J. t* {1 k; _" J. ~6 Y  k
  41. #undef EDMA3_DEBUG
    ) `, p# I$ L( Z5 ~9 @2 }2 Z
  42. /*#define EDMA3_DEBUG*/0 A% Z7 E- B! v) s
  43. 3 y2 ]& U' q% d( y
  44. #ifdef EDMA3_DEBUG
    - v" u. u: N1 N2 D: b; L8 n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). t% ^1 Q+ a* }* }, P; V# k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 w; U5 E& `% u& K# q- F) H% _1 l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; t9 R; a0 `/ U# H( z
  48. #else" k: f  K9 f& L
  49. #define DMA_PRINTK( x... ); h8 j3 q" X- H- e9 A. X
  50. #define DMA_FN_IN% V9 @& d& |  f: I# |6 c7 K
  51. #define DMA_FN_OUT8 K7 ^! ?& e- T7 k
  52. #endif
    * q1 X4 H& @! }6 Z* {8 e
  53. & i8 V' }! e- |% l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 `$ E; L7 S3 V7 N5 y( m
  55. #define STATIC_SHIFT                3. H  `9 N% E  X+ \2 j  ~( y2 i
  56. #define TCINTEN_SHIFT               201 q* Q4 g1 G! u4 e* {
  57. #define ITCINTEN_SHIFT              21+ `/ j  Z* b. c- q* H- \- C
  58. #define TCCHEN_SHIFT                22
    6 C: O1 a+ z7 t# T; [# T' h1 e9 H
  59. #define ITCCHEN_SHIFT               23$ Z9 X1 v. f7 Q: s
  60. , S6 ]. L  L* e7 r
  61. static volatile int irqraised1 = 0;
    # ~4 }4 {- q; z4 q
  62. static volatile int irqraised2 = 0;
    / h$ x0 z# l9 s  i( x2 u, T
  63. & Q0 O8 q  _1 T0 w# n  S8 ]( U5 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 p. T( G1 R/ U6 o9 i+ h9 D. W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / U" d; @; i9 \5 R3 w, G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . C8 [6 E: L4 X% M3 k4 |. X5 N
  67. ' s# |$ C# d: M$ v' I- g4 {
  68. dma_addr_t dmaphyssrc1 = 0;# E" [( I! @, N8 A+ S6 D  {1 M  i
  69. dma_addr_t dmaphyssrc2 = 0;9 R( w1 Q& F3 I) s. ?
  70. dma_addr_t dmaphysdest1 = 0;1 |2 T. K3 T8 C. m- c4 l/ @
  71. dma_addr_t dmaphysdest2 = 0;! S' P2 M8 ~  v1 S% e

  72. 0 U+ v' g' r& K( V; \8 m
  73. char *dmabufsrc1 = NULL;$ L5 s9 Q# g+ G" K; `4 Q) O
  74. char *dmabufsrc2 = NULL;
    ( R) Y1 \3 {. a+ ]
  75. char *dmabufdest1 = NULL;
    2 [3 A: @" g/ z- j" a7 t! I7 ^
  76. char *dmabufdest2 = NULL;
    : f0 D! Y1 u  T! Z  D2 p: p

  77. # w; P8 m' r7 Y; Q# j+ c1 F
  78. static int acnt = 512;9 |7 _* |$ F2 T9 Z+ z- T
  79. static int bcnt = 8;
    ! b1 w  n- Y1 j8 B. d+ T0 }5 Z
  80. static int ccnt = 8;  M) P( J8 c7 ?2 v% q4 f! A
  81. 8 o8 L4 s; v4 r$ ~
  82. module_param(acnt, int, S_IRUGO);
    7 P$ g" t. E- d& F+ \0 D& P
  83. module_param(bcnt, int, S_IRUGO);; J5 R: v' L* e0 k  d" \, c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; y3 W" C/ P( @# R, b9 K! M3 d; i' y

3 P# e2 n4 T' h) K/ k& g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, ^5 h; k% x, ]( d1 V4 E8 p3 ]# {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& S. @- w% Q/ D5 c5 [0 w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 l8 F1 ?! Z$ t5 Y  e

3 ?! [9 P& W9 p% S' s( E/ |- f# q& {7 T: L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-26 03:09 , Processed in 0.033850 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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