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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - w. I$ l& R; V* D* I! {
  1. [code]EDMA sample test application
    6 [" N; Y5 U4 i/ w* i6 |* S
  2. /*
    ! N8 i& Q/ Z6 E2 x$ A$ S
  3. * edma_test.c# F3 k. `# s( l" \- X
  4. *1 j2 \$ q4 s/ [9 B: e5 ]
  5. * brief  EDMA3 Test Application1 t( X0 `% R! f# G: W, I
  6. *) h' d$ e4 }  G! C
  7. *   This file contains EDMA3 Test code.
      |; G& o: X& P6 p; c7 |
  8. *
    $ K1 |4 h5 s& J, n5 T  `# G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  g/ V: A4 F3 t: D- h) `2 ^( j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, N6 g8 d3 x5 o6 w9 M
  11. *         TO CHANGE.$ _8 o" ~( Y& Y9 Z6 e
  12. *+ A- g! P; {" Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 ^) F: z5 V$ V, [, O3 p" K( K
  14. *4 J! [0 L& w+ c1 w2 f
  15. * This program is free software; you can redistribute it and/or  k  ]  v1 b: j1 J
  16. * modify it under the terms of the GNU General Public License as1 p1 \: W+ N6 n2 U$ A- C8 E
  17. * published by the Free Software Foundation version 2.3 M9 k" V$ Y/ [' U
  18. *+ r! r$ N6 D8 w+ L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' ?9 T, f/ u& Q) P/ T- i7 D
  20. * kind, whether express or implied; without even the implied warranty0 e* K7 |7 z0 q5 v0 [/ N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : |- H% r- q5 W* A
  22. * GNU General Public License for more details.
    3 M5 {. E5 R) d5 P& ?
  23. */& N! O4 t& x0 q' z. L

  24. + w/ p; T8 L5 _
  25. #include <linux/module.h># \, U9 ^3 |$ b
  26. #include <linux/init.h>
    4 t2 b+ y, I4 Z( `& M. f; i7 {+ u3 R8 u
  27. #include <linux/errno.h>
    8 d. l) c: ]7 I. N' k
  28. #include <linux/types.h>
    # p! Y# O  B2 K7 n# J
  29. #include <linux/interrupt.h>( i  {: t" @2 n: X
  30. #include <asm/io.h>
    # ]; O# G! E( O' r) s+ y, r+ \) G
  31. #include <linux/moduleparam.h>: ?7 ~1 z) S- h" h
  32. #include <linux/sysctl.h>
    ) b) i( N& m$ L9 X; h% h
  33. #include <linux/mm.h>6 H. b4 p; U: h% H( g$ E
  34. #include <linux/dma-mapping.h>
    + F2 b: p* O, N1 Z; }: `7 _

  35. 8 M; {  J1 P7 q* Q5 s. X3 ?
  36. #include <mach/memory.h>
    4 J3 @3 l* T' O( c
  37. #include <mach/hardware.h>& b2 F0 s' K! N; |0 z& C! C9 [
  38. #include <mach/irqs.h>6 |% R( [% l6 ~/ K
  39. #include <asm/hardware/edma.h>
    * W6 _, s. u+ x, Z6 E: ^, c! s

  40. ' V0 I2 B) s( o. v! _
  41. #undef EDMA3_DEBUG
    3 t/ ?" K7 f( ^
  42. /*#define EDMA3_DEBUG*/
    ) V9 O# c, u7 O$ `6 U8 n" w. D

  43.   L% {- r+ A; A  B6 d: h+ I4 A
  44. #ifdef EDMA3_DEBUG* ^3 ^" Z9 s6 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ Z7 z. S1 r9 p$ K6 |' ~' `* [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( g& N- z- W8 k% J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      H/ e0 Y1 q- L( L* a2 C- C  m
  48. #else
    ; _1 z  C2 w# u% F7 q1 b2 ~# Q$ n# r
  49. #define DMA_PRINTK( x... )
    1 E; J4 v" C6 [* M: k! i
  50. #define DMA_FN_IN
    3 m& w& n" t" Z! C0 n, c! ?
  51. #define DMA_FN_OUT- _$ ?9 J: M* A2 u0 |
  52. #endif
    - H- g$ J. t, O: o/ r$ ^# I  j* m! F& K
  53. ( M, k( D4 b& h4 H8 w' N# b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 ]! N# w+ {1 w/ W9 H
  55. #define STATIC_SHIFT                3
    ; R! Y# T) ]' K1 m
  56. #define TCINTEN_SHIFT               20; L& d3 M) R/ s0 E6 b
  57. #define ITCINTEN_SHIFT              21+ n3 {( P$ o* N5 K
  58. #define TCCHEN_SHIFT                22; r: B! C& L) H# L
  59. #define ITCCHEN_SHIFT               23
    1 o2 |: n6 ^* Q5 [9 w1 S0 p" l
  60. . o" g; `, U: r; a
  61. static volatile int irqraised1 = 0;
    ! {7 j& G. C5 x3 H+ i8 m
  62. static volatile int irqraised2 = 0;
    & {8 M: F6 [7 u; `+ A6 }5 r
  63. - c" X7 w+ Z+ e* g) m  }' I' C2 o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 N5 Z, \( G, _5 g+ s8 D" D1 [( Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 J" ~7 m& ~0 x9 j3 b- |, Q% ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, |- e, `% g/ h, l- g

  67. / D- L1 ^% y0 t! E
  68. dma_addr_t dmaphyssrc1 = 0;
    8 {8 M7 T& V3 r: o2 b4 P+ O
  69. dma_addr_t dmaphyssrc2 = 0;' j8 r; }' n9 m; C5 t8 f8 D# @
  70. dma_addr_t dmaphysdest1 = 0;( |. G' L( b* s. N- i) `
  71. dma_addr_t dmaphysdest2 = 0;
    7 ^4 \% S% X' f% p9 k3 b2 ?

  72. ! d  k5 U2 t6 `* T8 x: s; J
  73. char *dmabufsrc1 = NULL;
    9 N1 \/ ]6 S" Z
  74. char *dmabufsrc2 = NULL;
    7 V7 L4 Q, a$ W; ]5 f: s2 C
  75. char *dmabufdest1 = NULL;
      u) d7 X' y# j. S4 {) J* g% O
  76. char *dmabufdest2 = NULL;$ m' B, h$ b8 |& r

  77. 3 o% a5 ]4 S7 t; ?5 I, W
  78. static int acnt = 512;
    % L- _" [) \- p* X+ w9 g
  79. static int bcnt = 8;$ ]  i6 L% H9 Y& p% K" E+ t
  80. static int ccnt = 8;1 Y6 C/ U! n  q, a: x

  81. 8 X6 C+ x' D! j% k% W9 r
  82. module_param(acnt, int, S_IRUGO);  X3 s' ]4 I5 |  f% p+ p# J: @1 v; g
  83. module_param(bcnt, int, S_IRUGO);8 ]+ U% i" Z! O" J4 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 ]4 D6 W- I1 z9 E! b1 R# y4 H
# v' ^8 C# W2 O" M5 a      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. m  {3 q8 n8 r1 e3 L0 y6 H
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, U7 Q  J7 r/ n, J( V3 T# C0 _0 o8 r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! \; q+ R- P( I# u6 \4 T
- i4 Y; V6 f  A+ m) S; P

  [7 V* R, d# l) n' T8 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-30 15:27 , Processed in 0.042167 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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