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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * e6 m8 ~5 w9 k* W( U6 k7 j
  1. [code]EDMA sample test application9 r* K: c* j6 |7 V1 ~0 l! v& R
  2. /*+ ^$ R. `7 h: ?, T, s1 ?8 i, j- @# G3 W
  3. * edma_test.c
    " T( Y4 z  ^" D8 ]
  4. *
    & G% n4 ^  B) H9 A+ Y+ \3 w
  5. * brief  EDMA3 Test Application1 D! p6 g: U9 _' x1 e( o+ W
  6. *! }/ {$ C3 ]2 A: v& c; W
  7. *   This file contains EDMA3 Test code.
    5 Z2 ?6 n/ `; W& o# |( }3 Y. u) l
  8. *4 X# S1 s3 g/ h9 W- C, W$ Y* [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ r( d4 k+ U' M) J7 P  M8 r* [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 r/ I9 t& C& b8 |1 o
  11. *         TO CHANGE.& |0 m* Z! h$ b5 s( t4 P
  12. *: o% J+ y" X; g$ O" n1 i* W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 S$ O$ E7 X% i0 ?
  14. *
    + I* F# {, D1 Z: F
  15. * This program is free software; you can redistribute it and/or' Z$ P) Q4 \" l. n+ V* [* B
  16. * modify it under the terms of the GNU General Public License as0 r7 \1 p. S+ c  s& N8 R  [
  17. * published by the Free Software Foundation version 2.
    ( v" G) D% U) s* |
  18. *
    4 B) o; a; U1 [$ ~" y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * O& R$ {" `1 Q( D% `6 |
  20. * kind, whether express or implied; without even the implied warranty+ a1 `5 z% @( M4 N& L0 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  {. X2 p" I6 i+ a3 E
  22. * GNU General Public License for more details." M- y# h2 L9 K
  23. */
      v( W  y, H  {6 e: E( b" w4 x

  24. 4 H* [" W* B$ K; k, [
  25. #include <linux/module.h>
    5 }8 s& I" w* J' g; Y8 W2 b! X
  26. #include <linux/init.h>
    & i3 e  P* A9 H* N3 i! s& E
  27. #include <linux/errno.h>: Q/ r" @, ~5 g8 }/ U3 d/ A
  28. #include <linux/types.h>
    . S% ~4 c6 }  N/ V4 x$ h4 r
  29. #include <linux/interrupt.h>
    + |% D& z& T0 N/ U
  30. #include <asm/io.h>
    : u! o0 |$ h0 p* j- ?/ n! E, P
  31. #include <linux/moduleparam.h>
    ) [( |3 }3 }: U. r4 E
  32. #include <linux/sysctl.h>
    7 A: B/ _9 b, f- @# z2 N+ i
  33. #include <linux/mm.h>: p* l, L5 a+ b" D' f
  34. #include <linux/dma-mapping.h># ?$ U& c: U" c; b# t

  35. 6 X: I- t: y) J4 L3 l2 p; `
  36. #include <mach/memory.h>
    9 [5 L3 u0 b3 m3 I4 |4 F0 C3 O
  37. #include <mach/hardware.h>
    8 Z4 H' z" `1 _# q
  38. #include <mach/irqs.h>
    % ^7 f3 X0 B  W# q
  39. #include <asm/hardware/edma.h>
    % o) u) s. |5 o8 ~" f
  40. 7 b( K& F4 @4 y
  41. #undef EDMA3_DEBUG
    # I. T+ g& e* K0 Y- q7 k( D+ b
  42. /*#define EDMA3_DEBUG*/, @8 b6 E$ X$ T( ~% r4 Z

  43. 4 \5 c3 G# ]% X
  44. #ifdef EDMA3_DEBUG/ c: O% n) L" C4 [1 g2 ]* e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 E0 Q5 ?2 R/ l- B( H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 ^9 B* G! j% q6 ~4 N* g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ _& b/ J+ u. a) i4 {; H
  48. #else
    / ^) o. O9 U7 w' H. w
  49. #define DMA_PRINTK( x... )
    & W) L; T8 Y+ d4 S  h% f) Z
  50. #define DMA_FN_IN
    3 E2 U( N6 J) l5 Z' @/ n
  51. #define DMA_FN_OUT
    ! }6 O+ U) c$ [; B9 N! ~& q- b0 s
  52. #endif
    ; X% K' {( f+ w3 @, ]" ~1 O

  53. / Z8 {" i, B# C9 e7 |7 C7 E0 P5 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) M; \, W& w% v( x' X, c. \
  55. #define STATIC_SHIFT                3" ]1 b. {& T0 `  n
  56. #define TCINTEN_SHIFT               203 j* W+ s4 y1 w8 V5 C9 U. B
  57. #define ITCINTEN_SHIFT              21
    . G* F: B" j! M$ S9 ~$ c
  58. #define TCCHEN_SHIFT                22
    2 |7 r' j. E& G/ E1 f
  59. #define ITCCHEN_SHIFT               23
    0 o* m  y3 ]8 m6 F
  60. 2 c" c8 A) O  T4 M6 ?% P# `6 f7 l
  61. static volatile int irqraised1 = 0;
    0 \" o0 F/ @0 ~: \. Q5 [( \# N. H
  62. static volatile int irqraised2 = 0;& l7 H, _4 Z( }/ i4 {

  63. 1 |5 Z- c& O& K& Y# f% I; \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : t; D7 K2 H6 j2 T( t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ @  K/ O6 b# m+ P4 Z  l1 M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' d; g6 R) y0 Y1 J( B7 b

  67. ' B' N' F) X2 }+ I/ d- ]2 G
  68. dma_addr_t dmaphyssrc1 = 0;
    + [$ B+ L$ {( p* d$ |3 V
  69. dma_addr_t dmaphyssrc2 = 0;
    6 l, _; {9 M& a) w( Q+ D
  70. dma_addr_t dmaphysdest1 = 0;5 {. A' B  Y4 e" D  N7 U" X
  71. dma_addr_t dmaphysdest2 = 0;' o. e& [, s) q0 \. P: S5 z
  72. ) h# ~% k+ W; p# D' y/ q5 W
  73. char *dmabufsrc1 = NULL;
    4 N1 K8 Y2 j; D1 O5 ^
  74. char *dmabufsrc2 = NULL;& l& e5 G) A8 T9 G8 D
  75. char *dmabufdest1 = NULL;
    9 x1 ]; |  d2 n3 ~/ y
  76. char *dmabufdest2 = NULL;
    , g) M, u& P% V6 V0 Q! g
  77. 6 I9 M  B' S, k4 l3 H' J' v! X
  78. static int acnt = 512;
    $ O7 ]" v1 i5 g0 r9 M& F
  79. static int bcnt = 8;0 J% f# l! {- x" A: f
  80. static int ccnt = 8;
      R2 I( U; J+ R9 B

  81. 0 l2 \& N/ [4 ^! s% y
  82. module_param(acnt, int, S_IRUGO);
    # C! V  a$ {, b% I
  83. module_param(bcnt, int, S_IRUGO);% B4 c$ W  P* z6 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 N% a9 Q$ R4 Q5 S! g3 i# r8 c2 j" Q$ H* I
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 |2 P( ~+ K) n, W! d7 `1 X6 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 \; N& f. M1 F# l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 K- V9 Q& H1 j/ r6 R6 U
; f0 Z- z7 _: O* e9 f  {
, d0 `- n( R$ F5 {+ d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 05:31 , Processed in 0.036837 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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