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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . x1 e% d& Y  b7 i( U
  1. [code]EDMA sample test application
      [7 e/ z; @0 e6 o5 b
  2. /** R5 ~6 R6 {. H/ o* K
  3. * edma_test.c
    % r. ]: r. k0 H; O6 Z
  4. *
    8 j8 r1 }* U9 @8 e7 j
  5. * brief  EDMA3 Test Application- E5 D2 Y# q/ {7 V# V: C0 O
  6. *
    + g. Q! u' T! Q- i- _" H
  7. *   This file contains EDMA3 Test code., G# a- P7 Q2 w$ U- G, ^% _
  8. *
    2 v8 E) g( @  x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * L1 {8 }) B7 Y* f5 j1 D; e# K9 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# x5 [% p% c; e7 A
  11. *         TO CHANGE.0 a) A9 Q0 q* J' _( j
  12. *
    0 `; S) L" V. y+ Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# @- J) A$ @! M4 X: h9 t9 q
  14. *( k8 O* E9 T# v1 V' @: q
  15. * This program is free software; you can redistribute it and/or
    ' [) c6 {  w" A- Q- }
  16. * modify it under the terms of the GNU General Public License as) o8 G% M& J2 ~( I, ^5 q% x' _
  17. * published by the Free Software Foundation version 2.
    8 Q9 j1 Z# d$ D, K6 J! s  b
  18. *: D- S$ m% n9 w8 v! N% }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; m  T1 h8 {' `$ S1 E& ]
  20. * kind, whether express or implied; without even the implied warranty' b) h# o$ B. N  U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* y* X2 N" r4 P' t! l
  22. * GNU General Public License for more details.
      m5 w, n1 c* U* g
  23. */( `) Y4 u9 G& s+ i5 U+ O, G2 X& G7 V

  24. 9 U7 E; V  l" q. f! q6 H
  25. #include <linux/module.h>
    5 l# {/ d2 o1 ?8 x0 q8 S
  26. #include <linux/init.h>( c1 J" g: h: H8 a
  27. #include <linux/errno.h>
    , h! i# s  E* j$ l1 A
  28. #include <linux/types.h>; r; n. m% Z" v
  29. #include <linux/interrupt.h>4 Z# ], z1 H4 e* z0 U* [. e
  30. #include <asm/io.h>
    % W. S/ |2 F2 x2 N& y% j
  31. #include <linux/moduleparam.h>- n7 X' G% I) G8 f
  32. #include <linux/sysctl.h>
    ) k9 {- }3 y; M- E  e
  33. #include <linux/mm.h>
    $ ?/ \: r  p* d
  34. #include <linux/dma-mapping.h>6 p! i1 w/ g5 u

  35. & A+ P$ R* o1 m( |, y
  36. #include <mach/memory.h>
    4 d& P7 U- o- R+ r5 A7 L' w4 I
  37. #include <mach/hardware.h>
    ' C! @) }8 E4 l0 n, t& B, @
  38. #include <mach/irqs.h># \' V' @1 d2 c, s
  39. #include <asm/hardware/edma.h>9 o; g* J8 H7 o% B8 m

  40. 0 s1 j% D+ s' O& C2 A
  41. #undef EDMA3_DEBUG
    ) }% Q. w- f0 q& {  U/ n5 c( @
  42. /*#define EDMA3_DEBUG*/
    ' n% ]. A: n" Y2 I8 C5 Z' c
  43. % `: _0 q1 ]# G( w& J6 q. D; E
  44. #ifdef EDMA3_DEBUG
    . n- k9 X! }' ^+ m( Z" R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! x( H+ l6 R" w( ?; O1 j0 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 R& k3 y0 {  _+ T; Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) |; w9 t$ w+ U- d) W! X& p
  48. #else) T, B3 T: X7 ?2 \
  49. #define DMA_PRINTK( x... ): d( T5 X- O3 \& y
  50. #define DMA_FN_IN
      g; x& J% N3 c" x: Q, O
  51. #define DMA_FN_OUT
    / t  ?7 d  n% r% C5 Q
  52. #endif. v* l8 e) s2 k. Y" a. z- M
  53. 7 @3 w: w' |9 }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 e: S/ t) B/ {3 ~9 N8 O
  55. #define STATIC_SHIFT                33 t. [/ I- \. ^+ s
  56. #define TCINTEN_SHIFT               208 P# e" i& M, Z7 [
  57. #define ITCINTEN_SHIFT              21
    5 M3 X9 Y8 R- }; M- W7 q
  58. #define TCCHEN_SHIFT                22+ w- A* C+ P" _  n6 B
  59. #define ITCCHEN_SHIFT               237 p; y# E$ o3 \! {  l

  60. & s. H$ `0 K3 u1 i( G( `$ c
  61. static volatile int irqraised1 = 0;2 P# v5 u( k- z, c) W7 v
  62. static volatile int irqraised2 = 0;: e5 ?$ g+ x: b0 ?: S, |
  63. % c9 Z% G. S/ D4 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 D/ ^) j# R% d" X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ p& v% B/ U- v$ K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- i- l; t4 i' j9 }, r4 l" p

  67. 6 f7 I- w8 e6 {. A8 D2 _
  68. dma_addr_t dmaphyssrc1 = 0;
    ) h3 P) Y) `% |6 H8 u# A! J5 ^1 H
  69. dma_addr_t dmaphyssrc2 = 0;
    1 L( o- {  M9 k& p7 ~0 S
  70. dma_addr_t dmaphysdest1 = 0;
    7 }& @+ F: K7 m" _* _& r5 g. m6 \
  71. dma_addr_t dmaphysdest2 = 0;
    & n9 O" K6 T2 i" l
  72. ) A+ E% Q; W6 \- n
  73. char *dmabufsrc1 = NULL;
    7 ?) l% {  E7 n. E, ]" _+ }
  74. char *dmabufsrc2 = NULL;
    ! f/ s2 h8 P. x& {3 K; ?; B
  75. char *dmabufdest1 = NULL;
    9 M: |$ D/ |9 r" z
  76. char *dmabufdest2 = NULL;
    7 ]$ n) a2 N% h, p! Z/ y' E2 E

  77. 2 u- P6 O' A) u% ]
  78. static int acnt = 512;
    . P4 a( L: }0 p  M0 D$ u  D' W
  79. static int bcnt = 8;* S' U# S2 y5 |7 a4 W$ j; c3 \; `
  80. static int ccnt = 8;
    " E0 ]  T& L! t* D
  81. 6 v$ g. {' l8 j, a$ q
  82. module_param(acnt, int, S_IRUGO);# E# t5 O" e* [, _
  83. module_param(bcnt, int, S_IRUGO);
    . j/ \* J  v% }8 w9 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 |+ z/ |1 z" }
& f' i' o/ N/ d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" P' }& E$ Y3 ~3 v1 A8 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: _7 Y& ^" W8 r( k: Q0 J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! ^9 f9 C" p/ U  w4 |$ r

; i+ h/ _/ U1 W' B* v* A6 m
* f- M: @0 J  c0 Z' y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 07:53 , Processed in 0.037244 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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