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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . J% `7 d6 G+ q& L
  1. [code]EDMA sample test application. X+ q7 l+ \6 _+ ~+ ^( X8 ~
  2. /*
    6 w/ W2 K6 N9 \$ R* X' G4 G
  3. * edma_test.c+ a* z# e) s% q% A# f! @
  4. *
    # C+ M  t: J( Y5 L
  5. * brief  EDMA3 Test Application
    / a4 |6 M6 s" b: ?
  6. *
    + c3 G2 {7 |* C2 h1 \' x( I
  7. *   This file contains EDMA3 Test code.9 t4 }5 f: \% l: N6 ?+ f/ R
  8. *
    5 b6 M6 X  k* o% s9 Z4 j- m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    0 u4 {8 Y8 g: [1 Z- v9 e! L& `
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 E: A% j2 ]9 {- W! m! g1 |
  11. *         TO CHANGE.
    4 I# {. J9 ]7 S- ~% u8 z
  12. *  c1 K* }$ O% u2 J% J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 q. G5 c7 u  Q( j9 l% k
  14. *
    7 ^7 N" Y: i) x# M
  15. * This program is free software; you can redistribute it and/or
    0 |9 @5 a( V: l# x1 j
  16. * modify it under the terms of the GNU General Public License as
    ) A* o5 t* k, A  |* x
  17. * published by the Free Software Foundation version 2.
    5 U* ?$ |" E2 i! [  Q& n1 t" F. B
  18. *
    & j0 h/ Y, M' O: b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 E9 P" x5 }- Y4 g5 j6 X; H6 T. V' t
  20. * kind, whether express or implied; without even the implied warranty8 I3 k2 E5 Z) _3 m' k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! l- Y  |) [0 ^* C
  22. * GNU General Public License for more details.: K; ~$ h/ q4 t
  23. */% U) e4 U2 r% Y. X  U( u

  24. ) _7 P0 l" K$ A1 u/ q
  25. #include <linux/module.h>
    1 k. @# S9 N5 X+ U/ o! L1 O
  26. #include <linux/init.h>5 J' R2 w( R6 I$ [+ `$ u: A
  27. #include <linux/errno.h>$ ^3 B8 r+ M2 j* z
  28. #include <linux/types.h>
    $ B0 o! Q+ o* Z4 o
  29. #include <linux/interrupt.h>  K$ P0 g8 b1 ?$ g8 B" i
  30. #include <asm/io.h>! O8 J, z. F& ?: d
  31. #include <linux/moduleparam.h>; h% A+ z0 X7 g& |
  32. #include <linux/sysctl.h>
    ; e2 I2 ]5 x/ k8 ?3 h: y
  33. #include <linux/mm.h>% O# L* b* y* }/ j  Z" w0 O9 Y
  34. #include <linux/dma-mapping.h>
    1 f+ J# ^$ A# c1 W4 S
  35. 7 {: A8 U) P# L1 X1 Q' G
  36. #include <mach/memory.h>
    6 d. r6 L1 {4 v+ {7 u0 {
  37. #include <mach/hardware.h>0 e- [0 M9 N( Y) _* x
  38. #include <mach/irqs.h>( d9 Y( u7 F. I  l" x
  39. #include <asm/hardware/edma.h>
    # v( x5 i4 Z9 B/ y% H
  40. : N( [/ T. Q' \$ B
  41. #undef EDMA3_DEBUG% n  F( q2 Y$ }. \
  42. /*#define EDMA3_DEBUG*/
    6 f4 k* j2 b' b" V8 O5 i
  43. ; i9 M6 l4 u0 L3 U$ S
  44. #ifdef EDMA3_DEBUG5 z7 \  J4 h. q9 j  D2 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( Z4 a& E! }+ ?* n) w! c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% I- M/ ]  s( G6 ]8 l3 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), Q, e" o- K1 N' Q, y' f2 }
  48. #else
    * ]  q6 r# Y: U& n
  49. #define DMA_PRINTK( x... )  H  G6 F' l! ]! {5 N5 C0 S- X
  50. #define DMA_FN_IN
    1 P2 z1 j- @3 Q; e5 G
  51. #define DMA_FN_OUT
    6 d% [1 U% @& d; v) z* C  g
  52. #endif
    # U' r5 o# u9 f, o
  53. ! g( m! X' u& W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & i6 y' i7 Q/ i2 d6 f5 C  V  D* A
  55. #define STATIC_SHIFT                3; A3 J% Y: c" v- h* G- k
  56. #define TCINTEN_SHIFT               20% K% `1 W* _' O# ^5 s
  57. #define ITCINTEN_SHIFT              21
    9 n$ b" a: \0 Z  `4 o8 P: M
  58. #define TCCHEN_SHIFT                22* n7 P, u; j! x+ D: W* ?; V
  59. #define ITCCHEN_SHIFT               23  [( g' b! w. ~& j
  60. : A: Z- f5 U7 z+ _) C
  61. static volatile int irqraised1 = 0;$ L3 {2 E0 |) v& v9 h& c
  62. static volatile int irqraised2 = 0;
    : U2 ~/ s8 M& y' `* w% X8 I: [

  63. * B! P3 c! K3 @. r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' H6 |! C% [. T0 G/ g  U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : G, ?3 c5 {% h! l: e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 f  R- ^& G+ n3 B% A2 Q
  67. ! O0 E, @8 z$ \/ x, `
  68. dma_addr_t dmaphyssrc1 = 0;! |  _6 z/ w# f! K& d- ^
  69. dma_addr_t dmaphyssrc2 = 0;
    ( X& j6 ~* ~5 K% C7 D
  70. dma_addr_t dmaphysdest1 = 0;* l0 f0 G6 C9 _: x/ W5 w
  71. dma_addr_t dmaphysdest2 = 0;  Y. W5 d3 C* c' F9 V- s2 `
  72. ' v. R; H9 d* z$ F2 ~# p  q
  73. char *dmabufsrc1 = NULL;  q# d( v) r  V7 J; Q. Q
  74. char *dmabufsrc2 = NULL;0 r4 q9 {: D5 E" ~* H6 Z, {  E
  75. char *dmabufdest1 = NULL;
    8 [- y" F/ I' m8 x( G9 W5 b
  76. char *dmabufdest2 = NULL;, d: z" G$ ?3 r9 O
  77. 9 ?$ p5 i7 G( s( L! q# m
  78. static int acnt = 512;; n9 H8 c/ y# L; h# t$ i
  79. static int bcnt = 8;
    0 O& P; Q: d! P3 F; H) I
  80. static int ccnt = 8;
    + E! r8 b# Y, l
  81. 6 _4 H% G9 C& i; n2 Y$ e2 R+ E4 ]
  82. module_param(acnt, int, S_IRUGO);1 o, m7 Y3 \" b2 e; S% K" T+ f
  83. module_param(bcnt, int, S_IRUGO);
    " `* w9 Y  R6 \) A' Q5 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 p7 d+ A3 f$ h5 @  h# j- W* ~9 H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 N& M) K% F9 S( M4 C; S5 ?7 t$ Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 U% q4 h, y# Z! b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! O2 [, V4 E: e
, H9 t8 F; Q! _* I: v5 R3 s5 h) U4 K1 B- w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 11:49 , Processed in 0.042938 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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