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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) `% L& e  F1 X/ Q% l
  1. [code]EDMA sample test application
    & F6 Y! G& Y4 i9 U7 R
  2. /*
    0 d, h, U. n- t" d" ~1 x2 p
  3. * edma_test.c2 D# z# j) a3 S1 Q
  4. *! q6 g9 i8 e+ ?2 G, d, K) H
  5. * brief  EDMA3 Test Application
    3 k8 i  d! F# P$ F% b/ ~
  6. *
    9 R+ }" Y9 l( G( O8 c4 y
  7. *   This file contains EDMA3 Test code., H0 p: y. c3 P5 h
  8. *
    / u4 g) l4 ]6 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. G6 k) Z) w, e- u$ ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 B7 }( Y' o9 R) Q2 x0 L) [
  11. *         TO CHANGE.
    ! z6 u- F' o  T1 c, t& H5 a+ Q' J  Q
  12. *
    0 ?3 ]) h6 q+ f2 ]5 S% z7 b: D/ _3 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , R) A4 P& L: h& C: n5 T& e
  14. *
    ( c. J7 i$ l. \8 ?3 `$ x1 e
  15. * This program is free software; you can redistribute it and/or5 {9 x! j& T" N9 Z8 R
  16. * modify it under the terms of the GNU General Public License as
    . D. h* j; }; Z2 J
  17. * published by the Free Software Foundation version 2.  K3 B, U; P1 ^) H3 p
  18. *7 |. L* i. [8 E% M, p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ k2 |( T# b- Y: o1 e% ~
  20. * kind, whether express or implied; without even the implied warranty
    0 ?$ C/ s6 j! l1 E* T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 j9 f3 q/ q2 K' A7 [& _# P
  22. * GNU General Public License for more details.
    ; C2 t# T8 Q) D, \8 D3 N3 ~
  23. */' {  ^) [" {" P8 ~

  24. " ~, S4 M% o: r9 h: w
  25. #include <linux/module.h>" v0 T; T" s( I# b7 k$ B! I/ s% r
  26. #include <linux/init.h>+ Z( e+ o0 C4 c* q6 U% I
  27. #include <linux/errno.h>) F, j! ~- r3 c  M  B& w* X& s1 `; ^) n
  28. #include <linux/types.h>, O0 F/ F, K; B! h
  29. #include <linux/interrupt.h>, O, I0 M) h8 n* q, ^
  30. #include <asm/io.h>
    ' D9 H9 d8 y) s, W  O9 F
  31. #include <linux/moduleparam.h>  m* L$ _1 j( R6 k! W) ^: J
  32. #include <linux/sysctl.h>
    1 G! [. ^* L4 c* ^6 M4 E) O( j- B
  33. #include <linux/mm.h>
    * y( y, ~7 e9 `1 ]9 I& e3 A0 |8 t
  34. #include <linux/dma-mapping.h>
    $ @9 H7 W. m) _- t3 ?3 J, _

  35. ; k9 r4 |% @# w6 D
  36. #include <mach/memory.h>4 ^) g2 k/ [5 j: m: H
  37. #include <mach/hardware.h>4 D6 [/ ]+ A. B" L$ ]) {$ H/ D1 |
  38. #include <mach/irqs.h>
    2 l# `4 L8 I4 S
  39. #include <asm/hardware/edma.h>
    7 k7 @$ \( o2 T4 m# g( s

  40. . L4 F' c% y3 i- r/ n" Z
  41. #undef EDMA3_DEBUG, c7 [; L) ?! K5 b" q& c; K
  42. /*#define EDMA3_DEBUG*/
    , Y% _6 a+ V! r, W7 t

  43.   K1 p+ @4 }$ H* m( B/ T: y6 T. n
  44. #ifdef EDMA3_DEBUG3 f  J! x1 X( N8 e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . o3 [" d- G, @6 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 ?" N5 F# K. z0 A3 l* D7 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# Z7 P. z" h" n  U5 a- b$ r: P% C
  48. #else
    ! y3 k) O0 U3 ]9 U+ g9 u3 r- s
  49. #define DMA_PRINTK( x... )  K$ K! y$ O/ F: V
  50. #define DMA_FN_IN) {5 l8 ?- w7 k8 X9 u; t
  51. #define DMA_FN_OUT
      A' F1 k2 l0 o# w) S
  52. #endif
    ! b9 H) Z3 g5 F+ d

  53. 7 l  H- M$ N  s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). J/ G7 F+ r. m' X, g
  55. #define STATIC_SHIFT                39 W/ J% t, \3 r3 t6 n2 F
  56. #define TCINTEN_SHIFT               20
    . A: j7 U4 c' P  g/ Y$ X
  57. #define ITCINTEN_SHIFT              21
    4 D8 K& d& a+ `
  58. #define TCCHEN_SHIFT                220 N" k5 N; A3 [) o
  59. #define ITCCHEN_SHIFT               23, [( h0 F# \  u: \, |0 o+ |

  60. " e0 J1 s6 k! k2 ]+ a2 I
  61. static volatile int irqraised1 = 0;+ C/ x, |( Y* q4 D$ |
  62. static volatile int irqraised2 = 0;# K% t+ }* S8 ]1 a8 ]. H: Z% ^
  63. 2 A6 p8 m& P  Q, Z4 e$ H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; J% _" y- `% i. z( b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & z1 u! G3 _& B3 k8 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 k9 m7 }# W" D% D" l0 |4 O) T

  67. 4 P1 T0 n& a2 r, j/ n' u1 M
  68. dma_addr_t dmaphyssrc1 = 0;
      J: r# I" u1 H/ ]7 Z6 f: l1 j# l1 }
  69. dma_addr_t dmaphyssrc2 = 0;+ U; z' A/ w9 m" a/ ]$ Q8 t5 c6 C. V
  70. dma_addr_t dmaphysdest1 = 0;  m# U8 [: b& P" T% w
  71. dma_addr_t dmaphysdest2 = 0;
    7 T7 L' j: q7 u4 \5 ^4 k' \; b
  72. + d0 f3 D6 o" @# U2 v* b- p2 ~$ R/ g
  73. char *dmabufsrc1 = NULL;+ {% n5 i1 k; C) v! J( \' M
  74. char *dmabufsrc2 = NULL;
    8 }6 ?' H+ i1 j" W
  75. char *dmabufdest1 = NULL;
    " k/ q. A' M: Y$ g3 T. V
  76. char *dmabufdest2 = NULL;+ v, I* q6 C+ J0 C" B( E
  77. 6 ~1 Z! t1 t7 a4 d% e
  78. static int acnt = 512;0 W& j, ~* }7 x$ `  K2 W1 Y
  79. static int bcnt = 8;
    0 q' b/ `; h0 L9 v! s) \; {/ k
  80. static int ccnt = 8;2 @- u  `) C) W; J. L
  81. $ G# t2 e0 H9 @1 s0 \  C
  82. module_param(acnt, int, S_IRUGO);
    6 s4 W2 o4 ~" f
  83. module_param(bcnt, int, S_IRUGO);! B$ m& `& h& z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 a- B0 Q" t  Z3 e* E, T- r; Y" m. z/ O" a& F1 x- j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 I# S6 O# R) 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 u- ]: T; b: b! o, y$ t" B/ v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 U) b! h/ u  F8 O+ s) \/ H8 T# U& F# a% I' Q# _

2 t/ Z/ x1 d. J; w0 [+ E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 21:24 , Processed in 0.038937 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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