OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) G9 o# _' U# a6 o5 X0 Y- d
  1. [code]EDMA sample test application/ R( G9 R$ y! Q  Y, E  i
  2. /*
    & Z8 U9 h' E+ K3 G8 n; o
  3. * edma_test.c! ^. n9 ~# G3 T7 x' d
  4. *2 x! z+ z8 ~5 x
  5. * brief  EDMA3 Test Application
    ) P; X+ w1 G) c2 P6 t6 u
  6. *
    : v" [% F( P  ~) F7 v" m/ b7 W
  7. *   This file contains EDMA3 Test code.
    0 Y- a* g  W! q1 h6 b$ j
  8. *! p4 L& o' G) O) X4 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* D1 A# i% A1 N- N# ?) G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 T6 ~7 {4 b9 n* k' Z+ J! A+ i
  11. *         TO CHANGE.
    % b' U; h, ~( \
  12. *
    ! S5 N5 m+ y$ A; \' b3 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 d$ X0 h8 Z% q+ \
  14. *0 i8 _8 a0 l3 W/ }" A( u
  15. * This program is free software; you can redistribute it and/or1 h/ O3 D* m( R% d9 V! H+ X
  16. * modify it under the terms of the GNU General Public License as7 |1 \, {* v9 U" I
  17. * published by the Free Software Foundation version 2.( ]! n) Q/ s! f2 C" s2 r
  18. ** L9 F5 b/ N+ |- u! [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , V3 z# |" C7 A8 c: G4 m, x% t
  20. * kind, whether express or implied; without even the implied warranty
    ! X3 X4 e6 K3 `4 D$ G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 H( x2 t; A4 z# _
  22. * GNU General Public License for more details.
    # C4 C# v9 a% w/ n$ E  s5 f
  23. */. e% b+ g5 I; R/ c5 z! b( l2 g

  24. ' I7 k) C6 Q9 w3 W' s4 f
  25. #include <linux/module.h>! g+ D& o/ V% l! X' B
  26. #include <linux/init.h>' R0 Y7 O/ Z! M8 _% V( T  n* w
  27. #include <linux/errno.h># x. h6 Z# I& n2 ?
  28. #include <linux/types.h>3 b, N! l; Y  ^
  29. #include <linux/interrupt.h>
    9 |3 p6 y7 v' P6 R
  30. #include <asm/io.h>
    ' B0 H( C- u! ]- Y& p. P1 X) G
  31. #include <linux/moduleparam.h>: d! p! D2 r" I. z
  32. #include <linux/sysctl.h>
    % a5 p  A$ x) s$ X" p
  33. #include <linux/mm.h>
    0 D$ O  G; e6 f. M" h4 g2 W
  34. #include <linux/dma-mapping.h>
    + A+ |+ W. ~* Z. \5 h2 P) I5 f
  35. & g* X. P  s' n7 A, A/ S4 v
  36. #include <mach/memory.h>
    * X  s! M7 n3 P" x
  37. #include <mach/hardware.h>0 O4 k2 l& ^2 f+ ]6 t! j" G
  38. #include <mach/irqs.h>' U1 X9 K1 k5 g% C% `
  39. #include <asm/hardware/edma.h>1 R5 J# a7 o  x8 ^2 D+ E4 C1 j

  40.   o/ H9 T# m2 s0 N1 T) a$ o
  41. #undef EDMA3_DEBUG) d' ?- W. W3 x9 Q2 V+ i* `7 d
  42. /*#define EDMA3_DEBUG*/( Y8 y2 [0 w5 m2 c7 J! B+ o

  43. : c) S3 O' V' M8 `, Z- V( {
  44. #ifdef EDMA3_DEBUG
    7 ?/ \& b! P& [7 V1 t2 L7 k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). P# Z5 o4 Q6 a2 _8 L8 _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 B4 s; M4 U6 R. v# Z& `* e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) N& t1 M1 n3 r* @
  48. #else
    0 ~, M' M! f2 n9 ^
  49. #define DMA_PRINTK( x... )
    " I# o* f1 N5 b! o0 ~: Z. V2 M
  50. #define DMA_FN_IN
    8 o7 B+ |1 |0 ]- \7 \
  51. #define DMA_FN_OUT
    7 v$ X* D- ?+ B1 A, e" R8 \1 t
  52. #endif
    ; ?  ]8 X' F/ A/ t7 M0 u# _. J

  53. & l: f+ Z* j9 w: F( b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 C" M' W9 J3 L
  55. #define STATIC_SHIFT                3) a; o3 Y) F+ _$ l) T: B( z* v$ H
  56. #define TCINTEN_SHIFT               20% j; R. |  E3 c7 _. B9 Z! M
  57. #define ITCINTEN_SHIFT              21. |7 S% F  h8 ], @7 [( r8 o
  58. #define TCCHEN_SHIFT                22
    - j7 e7 n6 Y: Z- t' S' n; e3 \& V
  59. #define ITCCHEN_SHIFT               23
    * Q6 ^0 u# A# W* U! J
  60. * L4 v; l% A3 X/ E
  61. static volatile int irqraised1 = 0;
    ( b' Z& I% {: X9 N$ ~3 k
  62. static volatile int irqraised2 = 0;
    % H- i; B# F' U* f: F9 o5 k- u
  63. ! J2 `& k1 x. l) x6 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - w& k; F8 f! Y! Y$ m. T; {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 C2 K8 z2 Z! o. k7 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ A5 r9 w; J0 v: {% }& O

  67. 4 e8 Q0 A6 Z) }1 d
  68. dma_addr_t dmaphyssrc1 = 0;# ~7 ~+ u) k/ D7 m
  69. dma_addr_t dmaphyssrc2 = 0;
    1 d$ F) Z+ n- h2 H/ a: F8 e
  70. dma_addr_t dmaphysdest1 = 0;8 [( }2 j6 z) [2 R, b$ R
  71. dma_addr_t dmaphysdest2 = 0;
    * C! {0 _4 {/ h  ?

  72. 2 E" p$ ]) U0 d" l- _' N
  73. char *dmabufsrc1 = NULL;& t9 o) Y3 k: v- k8 x. ^* A- p2 s
  74. char *dmabufsrc2 = NULL;* n; G/ [: f; y; I% a( I* {) D- h
  75. char *dmabufdest1 = NULL;! w9 I  O% O; J( R
  76. char *dmabufdest2 = NULL;- j$ M9 s  V& _& s6 A" s- X
  77. + u5 e  y7 v0 z: s  W) q
  78. static int acnt = 512;$ n6 r. O: p( c7 p6 _
  79. static int bcnt = 8;8 }1 X9 J/ g2 w/ J  k7 o+ B
  80. static int ccnt = 8;
    . r& k5 k( |4 g3 d' ^
  81. 2 @7 u' }* F/ t" l& {2 m) d
  82. module_param(acnt, int, S_IRUGO);
    ' J1 ]7 s% I4 \0 G: y$ y, y3 ^) e7 w
  83. module_param(bcnt, int, S_IRUGO);( O$ N, Q% |4 |# L4 U, Z' l" x5 Z& S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& i2 X1 I' [8 {2 k2 N9 a& F% D( _' v

; ~* J) Q# o0 z) ^/ w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ a8 H- m0 t6 ]" L" L7 Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" g1 K: s8 Q% F4 B1 h0 k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. I! C9 V. X$ Q$ m/ l, ~2 q+ S: r: R& C1 O, g, S) y5 k
! L* L' w$ ^: F4 j% R' M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 06:24 , Processed in 0.038394 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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