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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 Y- R# `* x* t: _" o% I2 |
  1. [code]EDMA sample test application
    7 u& @7 P4 @" R
  2. /*: L( v+ ]( o3 K6 X
  3. * edma_test.c
    8 ]8 Y, O8 k  i$ U( }
  4. *: A. V1 b4 J" O7 n3 P$ P
  5. * brief  EDMA3 Test Application5 s1 [) M+ T- c0 C' P2 ?8 y: j
  6. *
    ' G' y# c8 P& `1 j; ]
  7. *   This file contains EDMA3 Test code.
      ?- i* n3 }4 d: r$ ?$ Q8 Z
  8. *
    , D, \+ D) _+ w, _& F
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * W3 H' S4 j. k5 }5 B" g! @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - Q2 {2 _5 a; [9 Q
  11. *         TO CHANGE.
    $ e7 N: R  s  y+ Z
  12. *
    ( D. t7 R: p! ~7 L3 I: J/ Z$ J1 k& a- d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      F+ ~$ T+ Y9 ~( n, G' d) ]9 q8 c% C5 f
  14. *
    ; a8 U, o) d8 Y! g
  15. * This program is free software; you can redistribute it and/or
    7 K  R" i" a2 d' M; s
  16. * modify it under the terms of the GNU General Public License as/ Q5 A$ l4 c1 V. }' {
  17. * published by the Free Software Foundation version 2.1 e/ D# i& F# U0 E# Y! G
  18. *3 }. [' ]$ }2 n  v* |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* ^: |& p% s: K0 x( h
  20. * kind, whether express or implied; without even the implied warranty# K5 H4 i+ [4 }( r2 j% c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ D  O+ Z/ i5 S: d0 {
  22. * GNU General Public License for more details.
    5 ^4 r5 C. [! `
  23. */4 J8 F# t! k8 M0 g: W$ D/ l) x: ~/ R
  24. 7 r" D# C" r+ L8 I, f- W% ~3 F
  25. #include <linux/module.h>- V0 H3 h& G- K$ K4 \0 s' U+ F
  26. #include <linux/init.h>- s* B9 t4 o, R6 }1 }
  27. #include <linux/errno.h>9 x& R5 {7 [* v: J* f- X! i0 N
  28. #include <linux/types.h>
    + W$ ]7 d, `6 Z$ w" e
  29. #include <linux/interrupt.h>  B1 A4 A9 h4 i, u- W- q$ a4 s
  30. #include <asm/io.h>
    4 p4 _' _* a/ S4 R& T8 y/ @
  31. #include <linux/moduleparam.h>
    8 A  A! U7 p4 [0 H1 V8 r9 F
  32. #include <linux/sysctl.h>- w( |  C/ j' B+ e  r  J+ @
  33. #include <linux/mm.h>
    / x" X" V6 b# z1 {7 C! D
  34. #include <linux/dma-mapping.h>
      [& n! |9 b+ `

  35. , }& |5 C7 s' u  C, m' b
  36. #include <mach/memory.h>9 g: ~+ g8 L' Z: V
  37. #include <mach/hardware.h>: u! D- e. w1 ^+ M
  38. #include <mach/irqs.h>
    5 n. D) |- P8 w$ n3 s  H
  39. #include <asm/hardware/edma.h>
    + m' o# Q5 S) j& D! O/ K) [
  40. 6 l& r7 U" v/ c" k* `4 l3 g+ ^
  41. #undef EDMA3_DEBUG* q/ P5 }, V5 F* X" B/ p* V
  42. /*#define EDMA3_DEBUG*/
    ' x1 [/ N) A0 u$ R

  43. 8 I/ H. H$ n* n
  44. #ifdef EDMA3_DEBUG7 v5 ^& a) d5 v( E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 z' V4 g( W; P8 z2 v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ d1 A+ r' J3 Y3 O+ U# A7 H8 U1 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 D7 f% l: J7 z6 |( B$ A* {) S
  48. #else
    ( N( S8 R9 k- S$ P
  49. #define DMA_PRINTK( x... )
    5 N0 R# Y; }- h. H% m; N( U
  50. #define DMA_FN_IN
    . r/ H8 d2 ?0 {% Y9 N/ x$ |. V% i/ J
  51. #define DMA_FN_OUT
    9 l9 Q+ A% Z6 D
  52. #endif' z2 J2 p" O9 \* J. L; P

  53. - g6 K0 N: v. q. n' s' f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): [  n: y# [- F- `+ w
  55. #define STATIC_SHIFT                31 n$ R3 k. m5 O
  56. #define TCINTEN_SHIFT               20: @: d& t& y( l) m- f$ Q+ H% P
  57. #define ITCINTEN_SHIFT              21
    - M: s  m5 D9 P" S
  58. #define TCCHEN_SHIFT                22
    6 U1 p$ t: X4 I% {3 A
  59. #define ITCCHEN_SHIFT               23
    ( y- a7 a5 O  Q/ H$ c
  60. . }- X: R5 [8 @) S8 d
  61. static volatile int irqraised1 = 0;
    8 [9 t4 H# Z, Y. [! L
  62. static volatile int irqraised2 = 0;4 I( k% R& u; @

  63. 3 k" C* [, ?+ A0 E/ o6 q1 {4 P/ X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 d6 n% r) y; w1 f/ @0 V" L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ R2 L7 d8 S2 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  ?: N3 _* V1 _  j% R

  67. 2 C- m4 u+ R) X- a+ o
  68. dma_addr_t dmaphyssrc1 = 0;( M* R. ]4 B0 V* U& ?+ x
  69. dma_addr_t dmaphyssrc2 = 0;
    * g: S8 o) b9 B' b8 M4 N& r
  70. dma_addr_t dmaphysdest1 = 0;
    : W" s) l& i( q- c
  71. dma_addr_t dmaphysdest2 = 0;( I: i! \1 z8 O9 W
  72. ; @9 B1 A# c' g6 {. H! J& S7 O
  73. char *dmabufsrc1 = NULL;
    " f/ x! ~3 n9 m' K
  74. char *dmabufsrc2 = NULL;( q( V' D: z! k$ k. R! z) h
  75. char *dmabufdest1 = NULL;
    9 F: e" R: P. w# w, @# \, g% v
  76. char *dmabufdest2 = NULL;% H9 y7 i/ Y; N- k3 Z- i

  77. * J3 B. I  \, R- u( b2 N2 {
  78. static int acnt = 512;6 ], O. J* c& ~% F
  79. static int bcnt = 8;
    5 ^7 N5 G9 o: S2 X7 ~3 j/ U% K# Y
  80. static int ccnt = 8;
    & c/ ~: u* g) B# z7 \( d- L! M

  81. $ g% W/ T$ }: o# a1 C; _
  82. module_param(acnt, int, S_IRUGO);
    3 U/ Z# G8 w- N; D+ s
  83. module_param(bcnt, int, S_IRUGO);
    ' v8 J$ ?' D: S1 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% Y8 J3 z  g) U! i5 F' P/ q/ J6 R' S3 B0 @; g; v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! X( v( q$ n2 r3 A3 C& W$ D4 jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ w, R; p" i, U8 w- \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- |+ D7 G) G- f+ I  `* `( Y- R3 I) y1 A2 q. J* N/ A- ^
! Q0 M! J* o2 Z$ V* |0 {7 {& `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-24 01:15 , Processed in 0.047973 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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