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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; G: Y( d$ }( P0 J9 F# |+ m! Q6 B
  1. [code]EDMA sample test application
    ) B9 p$ w' ~# \! w# n0 [5 V
  2. /*+ F& [& ]; R3 d2 U4 Y0 Q7 R$ G
  3. * edma_test.c
    / P, T' r6 b5 _5 l' U3 X! v
  4. *
    ; a! h$ k1 b: X* g" G' z+ C
  5. * brief  EDMA3 Test Application
    / Q6 ^$ Y' l# ~) n! e7 O: D
  6. *9 K7 K: C) j8 a
  7. *   This file contains EDMA3 Test code.
    9 n# C$ x4 v  [2 Q
  8. *# q% \# ^( j  d" A5 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % P3 ?1 \3 i. P) X  h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 G: F6 h% W4 B9 s! R: Z; y9 l
  11. *         TO CHANGE.% A" P" g. y! T8 y
  12. *
    3 V% k# f* K) t/ Z3 ?9 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      ]( V1 a5 j( ~6 t
  14. *
    ) X) }% d" l  X
  15. * This program is free software; you can redistribute it and/or6 W$ I8 r: B( i" W7 R/ M6 u2 F
  16. * modify it under the terms of the GNU General Public License as1 h: g  y+ O( O) @5 D8 N
  17. * published by the Free Software Foundation version 2., h2 D3 a9 W, [" q: l; u. j
  18. *
    3 t) r! T" O5 f/ {) w3 N+ _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : n# ?/ q$ l: f4 g+ i. e
  20. * kind, whether express or implied; without even the implied warranty
    # T: X$ \/ }& d  W0 b& s4 D, F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 h: A. l6 \: m3 u# k# P
  22. * GNU General Public License for more details.
    6 \; w8 ^" d& G- c7 `$ C$ i- J
  23. */( U& p$ x) D$ O7 m9 R& F; G1 f
  24. 3 j$ U5 J% k9 ]9 s
  25. #include <linux/module.h>) R+ Z: b9 h. y8 R+ @( X" ]
  26. #include <linux/init.h>- B/ R+ Q7 q+ ~- S) x# n6 _
  27. #include <linux/errno.h>1 T  d4 V5 M9 `8 w+ u
  28. #include <linux/types.h>4 c# n" L6 {+ j1 @0 e1 T
  29. #include <linux/interrupt.h>
    % n$ _! \0 u$ ]( |1 T- h/ X
  30. #include <asm/io.h>
    / w8 w5 i# ~. A3 W- [: H  C
  31. #include <linux/moduleparam.h>
    2 j/ T* z2 d! Y) O
  32. #include <linux/sysctl.h>
    ' k* N$ n, \& F7 |7 u3 S$ @; P
  33. #include <linux/mm.h>1 H6 s0 ?2 X* m: w
  34. #include <linux/dma-mapping.h>
    * w: w* X* ?* z) ~' e
  35. 7 r5 l+ o2 k& z( k2 ^
  36. #include <mach/memory.h>! a0 n% o# N8 T  v0 N
  37. #include <mach/hardware.h>
    ( F/ i' m* [9 A+ ]
  38. #include <mach/irqs.h>
    & u/ c  k( x( I) A4 p+ W' O
  39. #include <asm/hardware/edma.h>
    6 E, E$ v5 t$ E, h$ T- K' j6 y

  40. / q8 O5 X; K9 Z, L9 T  n
  41. #undef EDMA3_DEBUG1 g, n; K! G6 h# _' k2 C& J
  42. /*#define EDMA3_DEBUG*/* i% Z& j4 G- X2 D: u7 E
  43.   l! u9 ~0 R9 g7 N$ H
  44. #ifdef EDMA3_DEBUG
    5 h+ {; B5 C/ ?6 F: s  N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* t0 W& s" E* E3 Y" j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      ]1 F  {: l; _- k2 q! R6 ]$ {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + h1 X$ L. V9 S) c  ^4 J+ }+ ]4 z6 o
  48. #else& l2 f/ O; S, W/ W3 Q9 e
  49. #define DMA_PRINTK( x... )3 K1 T% n* _9 l( U- z3 `
  50. #define DMA_FN_IN
    : F3 u: K3 N& C8 m( R: \( A
  51. #define DMA_FN_OUT
    ) X3 K6 O7 m4 e8 @% R
  52. #endif5 P8 n4 u5 b6 g& S, [) r

  53. & }7 }3 c+ r5 z: h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* g( T% ?: D' x- e) U* s: z
  55. #define STATIC_SHIFT                3
    / C  T( k+ N% ^- _- v
  56. #define TCINTEN_SHIFT               20+ q9 f; [3 H8 K+ V; o1 f
  57. #define ITCINTEN_SHIFT              21
    . g% x9 V- @% K
  58. #define TCCHEN_SHIFT                22  Z* w; j! P0 k2 s3 A9 J
  59. #define ITCCHEN_SHIFT               23
    $ g# B4 R: k1 D+ W! z
  60. 3 V6 v2 f* C9 h7 o4 s
  61. static volatile int irqraised1 = 0;
    8 Y( a( a: h' o6 @7 O- c" z
  62. static volatile int irqraised2 = 0;
    $ p1 W% M; l# X2 P

  63. 0 [, A6 Z+ E0 y( L: [' ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : B% I: A* C, }0 O. e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 x4 B- h4 x- y5 S; W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ^8 z: v* D* z9 I! J/ c

  67. 1 e/ D3 U( ]1 g2 A5 |
  68. dma_addr_t dmaphyssrc1 = 0;$ C1 W5 z( A$ X( `- k$ A$ b& I
  69. dma_addr_t dmaphyssrc2 = 0;* w- k& ]8 q3 {; T
  70. dma_addr_t dmaphysdest1 = 0;
    ; u& \* }/ X6 r
  71. dma_addr_t dmaphysdest2 = 0;' k* a; E2 J, E: @3 g7 |: d" J

  72. 5 K, l" w' B5 \  O! v' [9 y
  73. char *dmabufsrc1 = NULL;
    ( Y/ j  E, ~3 ~0 f
  74. char *dmabufsrc2 = NULL;
    8 ], w+ U5 P% H) q' L+ v* n
  75. char *dmabufdest1 = NULL;; G5 [; x* H# R' J) g, J. M2 t' r9 L
  76. char *dmabufdest2 = NULL;
    * E* i  R% v" a! c" [& b0 B
  77. 9 e0 z9 K3 X3 g: I) Q! s
  78. static int acnt = 512;; o% b: {  h9 D! j; r9 f! n/ f  r
  79. static int bcnt = 8;* L, k1 _) V5 H6 l% z9 }" D- X: [0 ~
  80. static int ccnt = 8;
    : L" {% k* g0 F1 }! a
  81. 3 X* f# L* v9 `2 i; |( }" P% d
  82. module_param(acnt, int, S_IRUGO);
    & J- s; K- j) L& {
  83. module_param(bcnt, int, S_IRUGO);. f) c+ y! |3 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 t7 e6 a* i' z  |$ y/ \- ], z. o  A4 \5 a% J" x$ g8 n
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! y5 T) {0 N9 P/ barm-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' X0 L) w) J& X7 Z# w, H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ ]6 J% b& T9 ?( j2 D& Q
7 J! ~8 F( I$ i7 X8 @" Y. M# x; Y( f8 M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-1 19:03 , Processed in 0.064934 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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