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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# ]$ T" F9 o; G. M2 N
  1. [code]EDMA sample test application0 A9 h! t+ V. Y7 g6 M. |/ R
  2. /*
    ! K% u; [5 E# G' [- S
  3. * edma_test.c
    4 [. Z" V' O0 o; E; i9 i6 t: N
  4. *
    ; Y! f' o1 B4 ~- [4 C
  5. * brief  EDMA3 Test Application
    , C  ?9 j: Y7 Z- [6 H. L& Y
  6. *4 ^8 D: ]5 q* }* G  m9 A
  7. *   This file contains EDMA3 Test code.
    7 Y& t0 F! X: w8 F1 \6 G
  8. *7 u% B) P. z$ g6 E3 |# b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 v2 F- w" T2 f, z0 M  K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , u* d. l& Y6 F* a/ R; r8 f) J
  11. *         TO CHANGE.
    7 W  `9 N1 a0 X  x: t
  12. *. Y# G  q3 @1 t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( V# P  U! d5 m9 ^, Y5 m: E" I
  14. *! H" `/ \+ h: i$ ^
  15. * This program is free software; you can redistribute it and/or; S4 h: P7 X( y5 D
  16. * modify it under the terms of the GNU General Public License as" Q6 R/ x( e8 B5 a
  17. * published by the Free Software Foundation version 2.0 g' ~* ]- Z) r. b5 P! j. z3 I
  18. *, a% j5 O# r. J* F& m6 m: J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ U) q, x1 t; K) [) E* S
  20. * kind, whether express or implied; without even the implied warranty. a0 p6 @- o# k# W1 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& G+ L) R  z. m% v& n! u( L1 Q
  22. * GNU General Public License for more details.# O" t/ Q) h( s% _
  23. */
    " J; V9 p' y9 g$ m# Y' [4 _$ J

  24. 6 H6 K, i8 @1 Z. P
  25. #include <linux/module.h>
    8 u$ ^# o6 S+ h
  26. #include <linux/init.h>
    . c' u, H5 f% {' r
  27. #include <linux/errno.h>
    4 D5 o6 ~! ~! n( F9 R/ h) a) \
  28. #include <linux/types.h>5 L+ u" q1 l& c. i
  29. #include <linux/interrupt.h>
    ( z0 X; t' M1 B& S1 K
  30. #include <asm/io.h>* b+ |: ?' W9 B
  31. #include <linux/moduleparam.h>
    - \! O; ]% [2 M" O( v2 i- ^
  32. #include <linux/sysctl.h>; R) L  v9 V6 B7 i# i
  33. #include <linux/mm.h>/ X- p8 r# Y9 H$ L6 h- R" t
  34. #include <linux/dma-mapping.h>+ u7 @  q1 g8 h8 }
  35. , t( o5 n6 S" v# l
  36. #include <mach/memory.h># q' F& z* T' B2 m1 z5 {, k6 _
  37. #include <mach/hardware.h>
    * ?5 G$ J/ {6 F
  38. #include <mach/irqs.h>9 M; |& A5 s+ n$ N
  39. #include <asm/hardware/edma.h>
    * Q6 y: Y, q- n" O) n! Z9 l+ q

  40. ' n! X- I5 d4 b" [. l& l
  41. #undef EDMA3_DEBUG7 t7 g! z+ v+ {" q
  42. /*#define EDMA3_DEBUG*/
    : Y; |* |; W" T' k( D# W- Y  w
  43.   P1 w# y7 S& W$ j
  44. #ifdef EDMA3_DEBUG! |! a! M& R; w' a! ?; I; L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 {  i/ \9 C0 R* d: d2 E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! H( g; V- U9 Z+ _/ B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 Z* h0 A& [# K* f
  48. #else
    ) v7 A8 ^% d0 G" n3 H
  49. #define DMA_PRINTK( x... )
    % i- G) ^  B6 u* B1 z6 D$ H5 t
  50. #define DMA_FN_IN
    " j$ U( G" h. w( m2 \& f# |" b+ k
  51. #define DMA_FN_OUT6 N4 U6 H  G$ p' q2 V4 Q
  52. #endif* c% e! s* S. f( Z
  53. 3 |- D+ O" g  U2 w# F- z; w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 d3 F3 @4 H$ {
  55. #define STATIC_SHIFT                3
    7 ?! f; Q/ W0 \$ _* w1 G0 F. \
  56. #define TCINTEN_SHIFT               20
    + j2 g8 F) X4 [6 U" {8 i  [
  57. #define ITCINTEN_SHIFT              21
    ; W1 v9 n; ?# A! C/ G, Z
  58. #define TCCHEN_SHIFT                22
    4 t: d0 W3 }0 Z- M" n  }! P3 {4 ~
  59. #define ITCCHEN_SHIFT               23
    + N0 v7 k$ j. ?6 e4 A: {

  60. 5 c! k' T0 }$ e9 o! W. N0 g
  61. static volatile int irqraised1 = 0;8 r* |3 E7 N: @  _8 Q+ h
  62. static volatile int irqraised2 = 0;
    * F- h1 v% M5 p: s7 \. r2 g0 p

  63.   V! i6 b7 j& h5 c. g. ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  c; {1 ~9 ~0 g) F  {+ q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 r! z& ~' y: }. h& j& O5 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 m: p3 ?0 {4 P5 d2 E

  67. 3 i; y  g+ g$ K) P
  68. dma_addr_t dmaphyssrc1 = 0;
    0 v/ _9 u9 {9 |. a0 l+ U% n
  69. dma_addr_t dmaphyssrc2 = 0;1 W- E& m" h1 ]# u3 A) Y
  70. dma_addr_t dmaphysdest1 = 0;* S. m; f0 C( h/ \6 a
  71. dma_addr_t dmaphysdest2 = 0;
    ; t4 G5 E! x& q6 P( S
  72. 3 B+ p- x/ n" I. _0 \
  73. char *dmabufsrc1 = NULL;
    4 c. l$ `/ [2 k% r; T/ v
  74. char *dmabufsrc2 = NULL;/ @* Y6 }- c% m- }; v7 s( D# A
  75. char *dmabufdest1 = NULL;
    % U) `( C. {; w; U
  76. char *dmabufdest2 = NULL;
    # Q! [8 F/ H7 e" d" L

  77. + X+ ~% V! x! k. {% q: p
  78. static int acnt = 512;
    9 D9 O: T! \& R  B
  79. static int bcnt = 8;6 [) l  o2 I  M
  80. static int ccnt = 8;% b8 ]- e: o5 W* N+ Q7 S
  81. 6 Y8 t$ }, `9 ]$ x
  82. module_param(acnt, int, S_IRUGO);8 D( l( D3 t. I5 @
  83. module_param(bcnt, int, S_IRUGO);  C% }" ?8 z' \2 H; ~0 |6 o* h4 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* C# i3 T4 K9 c1 S  g$ f- S
+ g9 E% z+ {# S% U  j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 X- R" z! B! i$ G* rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) Q' l2 M& K$ Z- s1 w1 T
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ W, R- [& N, y  L
6 I0 y* U- A( d. n

6 ~9 J3 a5 \  [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 19:22 , Processed in 0.052199 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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