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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 x, p0 {, j; E8 |4 Q3 y4 N
  1. [code]EDMA sample test application
    # X) Q0 b9 h3 a  Y8 m
  2. /*
    3 w+ E4 {2 |. L( d3 @1 N3 w. y
  3. * edma_test.c* R/ e; k8 |3 f
  4. *
    8 q* I- y; R; f$ a
  5. * brief  EDMA3 Test Application/ l4 b! C& c; |
  6. *
    / a5 [& C3 M' O  I' m% P: ^
  7. *   This file contains EDMA3 Test code./ v* m6 q7 F! z" V: |
  8. *" O6 |2 y+ M  G, k* d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 n" m8 L8 c9 {: s% u. q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 f. u- e# S' P$ n+ X* ]! z' j! b
  11. *         TO CHANGE.: N% ?* D: l3 C/ x+ X" x
  12. *8 x8 H8 ~3 C: v. }; p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # |) M) G3 u  |/ h
  14. *
    ( o4 U3 t" I2 Q9 f  I! V
  15. * This program is free software; you can redistribute it and/or
    + @/ a6 A4 `; @% |+ z  c7 B
  16. * modify it under the terms of the GNU General Public License as
    * L6 i1 J6 ^9 Y/ M( R  `4 [: m
  17. * published by the Free Software Foundation version 2.
    $ m$ M% ]7 R& ~/ N# L. t: x7 b0 V
  18. *
    * n' Q7 j9 G( v% O; y- ]! ]& Z5 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) z6 `! I  L6 Y2 a# A3 I2 n
  20. * kind, whether express or implied; without even the implied warranty1 C& a1 C3 b) K. C9 ]6 G5 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 p8 N- I# u0 M' z1 L; b+ ]% u
  22. * GNU General Public License for more details.
    1 O8 M( u! T+ f4 X+ \2 n- L3 g
  23. */
    # T. c6 h6 p5 ]% E  }  k6 }% Q

  24. 6 R$ Y6 l' Z0 |) }! e
  25. #include <linux/module.h>
    & X/ M8 }- O8 R
  26. #include <linux/init.h>% `+ E* H. E. J% |; L& S. y! x
  27. #include <linux/errno.h>; m: j5 v6 o# m4 H" T8 U
  28. #include <linux/types.h>
    7 y4 A1 ~( Z7 q2 J! [2 m
  29. #include <linux/interrupt.h>
    6 X/ g6 M/ V0 {. V  ^. W* E
  30. #include <asm/io.h>% \; d8 D8 U6 e0 W& r$ Q
  31. #include <linux/moduleparam.h>
    " ~& ~. `' k" g0 F0 |0 G$ V/ `1 G
  32. #include <linux/sysctl.h>
    0 W2 T- h0 [) R% i/ v" i+ Z, Z
  33. #include <linux/mm.h>
    7 T: ?* J: L" x3 t; s. L% O
  34. #include <linux/dma-mapping.h>7 {" x' l( \. C" g# W" I
  35. : j# K/ `( |) U) \: `7 U
  36. #include <mach/memory.h>7 [( q2 E, L; g2 @2 q% L
  37. #include <mach/hardware.h>
    * p* [, P5 Z' V# G6 Z  g
  38. #include <mach/irqs.h>
    ! E" Y' R: ~/ p% W8 v+ I& l
  39. #include <asm/hardware/edma.h>4 D$ l! d; {2 d4 y; G, g, ~

  40. - i! w" |  w% B, {, B' p: G1 R: Y# A
  41. #undef EDMA3_DEBUG8 e4 v2 r$ L& u; {& w3 B: w
  42. /*#define EDMA3_DEBUG*/( n5 h" [8 T* f$ J& }$ x4 F% h8 P

  43. " {, _. o+ r- s1 @  Y1 F
  44. #ifdef EDMA3_DEBUG; l* a5 ^; m9 {  c+ _9 D6 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 h/ Z, {4 u0 q0 f% [) g6 C, I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 s- r+ K/ p/ \& ~8 z! Y- A8 N6 h2 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( J7 J! Q# l& U+ k8 H1 j) X6 f4 a
  48. #else
    7 ]# \5 p6 {5 [* N) v5 c8 \
  49. #define DMA_PRINTK( x... )- v& @$ F$ S& z$ v
  50. #define DMA_FN_IN
    , r$ v$ J, Y+ ?; ?: Q+ J# n* [
  51. #define DMA_FN_OUT6 x: O: @) G) ^. n- k0 z
  52. #endif; ^% {0 T% }' R& Y! Z: ?
  53. , X" k9 |9 C+ F4 p# ^- x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 A6 o; a$ I9 L7 ?  K
  55. #define STATIC_SHIFT                3
    6 u  w" ~. l) J, P- H+ D9 l
  56. #define TCINTEN_SHIFT               204 o: f4 L/ g( g# y: D* B$ Y
  57. #define ITCINTEN_SHIFT              21
    % }& v4 d' e& }  ?- q' F" Y8 j
  58. #define TCCHEN_SHIFT                22% H0 [) R: U5 n0 y- ]7 ]
  59. #define ITCCHEN_SHIFT               23' H3 J9 r; H! V
  60. * r# ?0 [- a( r6 m
  61. static volatile int irqraised1 = 0;, w1 a: R7 i7 }: X  e  V
  62. static volatile int irqraised2 = 0;
    ) n2 t( k  w3 I" l$ {6 ?: q

  63. ! g5 u- g! V) t' X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' }. M% {3 z! I& ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 f2 g$ \( \. V7 g9 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , r! E  R& p5 x  Z) o! {

  67. / S. m! o; C  z  ^
  68. dma_addr_t dmaphyssrc1 = 0;
    - |! z1 i8 [" W8 r6 \" Z3 e9 G
  69. dma_addr_t dmaphyssrc2 = 0;
    2 o1 l! U: U9 H$ l0 T0 j$ T
  70. dma_addr_t dmaphysdest1 = 0;
    7 R% ~: u9 E, R2 e/ ~
  71. dma_addr_t dmaphysdest2 = 0;" _! P6 B0 Q9 C/ J- d8 |. y$ e
  72. ! H& v4 m2 ]- @1 E+ @
  73. char *dmabufsrc1 = NULL;
    & m5 g9 Y  C6 O/ ?: D6 u" g" o9 y7 x
  74. char *dmabufsrc2 = NULL;
      x8 z# T) Y4 k( m1 A4 l
  75. char *dmabufdest1 = NULL;
    1 m% M; ~, f3 |: m
  76. char *dmabufdest2 = NULL;# q( S% F' e5 \% {
  77. . r, Y/ ]4 h, z
  78. static int acnt = 512;
    . o( ~6 z1 L7 u/ N+ i
  79. static int bcnt = 8;2 ?  w! p" }- x
  80. static int ccnt = 8;
    6 K, D/ y( @3 M9 r- ?; p
  81. 3 ]- a' H# K9 G& G1 K, B
  82. module_param(acnt, int, S_IRUGO);
    ( B- |  c/ }' ^5 A& r0 ]
  83. module_param(bcnt, int, S_IRUGO);3 h$ v9 r# s# s4 d  E9 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 r3 P! @3 x3 i- c) i- p+ N5 o! b' m8 l* n5 Q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) ], X0 F) x5 j# {9 b1 |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ }  D/ [9 a' b: D5 n1 w: l# d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  M3 V3 U+ r# @
. E2 ^$ ^+ B  {+ E1 {3 O, q. D
+ o9 {) E% g. j/ x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 08:19 , Processed in 0.041312 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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