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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 p3 h2 b4 r4 G8 o. f& X' }
  1. [code]EDMA sample test application# U& E; L$ o7 P9 }: @8 x( @; y9 B
  2. /*' b  ^6 M% Z! c* E) i; P( S# n9 n
  3. * edma_test.c9 Z& k% ^2 q% f) b# P+ Z
  4. *6 z1 ^/ z1 r6 M0 Y. z2 U
  5. * brief  EDMA3 Test Application7 O" I7 E9 r+ o) B7 `% N4 O. o
  6. *7 W4 F+ U9 C: F! ~0 ]$ {
  7. *   This file contains EDMA3 Test code.
    % n" \- Y9 @9 L3 }; s
  8. *6 L6 u. ?$ \2 a7 D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 {) I& m) p* P  R2 B" g! N; [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 Y! r! G, M2 d1 o: g6 @
  11. *         TO CHANGE.
    3 @( B8 s* f: x! e
  12. *
    / ]7 K8 @0 K/ d5 t: H/ b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 y* L5 d; M9 }( d5 M4 }
  14. *
    ( x  L) n# A! W9 n: c
  15. * This program is free software; you can redistribute it and/or
    5 `+ e& _3 s  A. ~- j7 O. ?
  16. * modify it under the terms of the GNU General Public License as! s  Z- c! t+ B& d' @/ y5 W0 \# P
  17. * published by the Free Software Foundation version 2.1 @$ l! p1 a+ U. {/ y9 f; U4 E
  18. *2 B5 M3 r* u1 M+ b* E. i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' {( x- z( p% P5 O/ h& Q9 r0 i. S
  20. * kind, whether express or implied; without even the implied warranty
    ! C! d4 }8 d7 P( X$ @, F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + ^( O7 t% Q2 P7 C7 R& X* r
  22. * GNU General Public License for more details.
    2 \: ^8 C- E% i" V& Y
  23. */
    " k6 F+ J# H$ K+ Q
  24. 0 D$ @% x2 }3 `/ i3 E  f% `
  25. #include <linux/module.h>0 ]* ^) A, [& V( G# d0 B/ S
  26. #include <linux/init.h>8 Y8 a2 A$ F! M& O* V3 a9 n
  27. #include <linux/errno.h>
    $ G5 L2 \+ x" p& T4 B
  28. #include <linux/types.h>
    ; @! R8 ^; R: m2 O  a& Y
  29. #include <linux/interrupt.h>
    " ^6 m* N! Z* `2 \% S
  30. #include <asm/io.h>6 C( k& p/ P/ B! E# P
  31. #include <linux/moduleparam.h>+ f/ B. i, N5 e$ P0 O
  32. #include <linux/sysctl.h>; Z4 U, j& B( K+ t5 w
  33. #include <linux/mm.h>
    - x9 d2 i. a' N. g6 ?
  34. #include <linux/dma-mapping.h>- U* L) a0 z4 J: F; Z: C5 Z  |
  35. - x# x" b' M( b: [- v
  36. #include <mach/memory.h>$ A/ R, W1 e, H* z$ w0 }& L
  37. #include <mach/hardware.h>% R, d/ y, D0 y2 E0 I  z
  38. #include <mach/irqs.h>9 r" x" |: X, U! P
  39. #include <asm/hardware/edma.h>9 P1 N, f% \' l" |  F3 u
  40. % r" e# h+ Y7 j* R
  41. #undef EDMA3_DEBUG
    5 G3 D: m1 i3 _/ c' z8 S
  42. /*#define EDMA3_DEBUG*/
    " W% A0 L/ C! x) O2 o' X+ r

  43. ' G8 d& J# f5 A
  44. #ifdef EDMA3_DEBUG! p$ `# X1 K4 g1 S( i/ [/ i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) r  b- G+ q: ?* _5 b) V9 a: t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ j) P& @8 H. B4 ]3 A4 a; G/ |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 ?: p1 b" z( H+ a2 b
  48. #else
    % i; k  T" q9 u( `  X7 |8 h
  49. #define DMA_PRINTK( x... )6 `6 y2 \# w# e* L8 b% F5 l) y  b9 }
  50. #define DMA_FN_IN
    3 a2 Y% [: Q( G2 H% w
  51. #define DMA_FN_OUT$ y5 R, Q' `4 J5 D& N# l
  52. #endif/ k" P1 L/ y! F# h5 j% v

  53. 4 G2 F$ t1 J4 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 R; p& @9 T6 u) }$ `2 S
  55. #define STATIC_SHIFT                3, x2 q8 U* L$ H% e- L" M
  56. #define TCINTEN_SHIFT               20
    2 N5 N* ?$ J0 J, s! w" T( m( t
  57. #define ITCINTEN_SHIFT              21
    . d" }8 i1 a+ a2 v# d5 [4 S- _
  58. #define TCCHEN_SHIFT                22
    ! V8 b6 Z" I: w: n+ t9 w
  59. #define ITCCHEN_SHIFT               23
    2 c) J7 g3 i, u0 F( n. O% U

  60. % |' l7 k! z6 R5 h/ M' q
  61. static volatile int irqraised1 = 0;8 I9 I6 x2 _( M- T' \3 N: Y/ U
  62. static volatile int irqraised2 = 0;4 _* y% r1 g3 [) \" L: t
  63. 3 m5 }; s. c8 e2 y: `, \* O" o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 N$ L3 ]/ K2 j. e4 Z- J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 i, F/ g0 y6 e& x/ Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 X0 s% r2 Q# M
  67. ' y# o" z6 j' B, g" c; P/ j4 `
  68. dma_addr_t dmaphyssrc1 = 0;/ R3 D6 `+ S5 i0 U7 T5 ]& `
  69. dma_addr_t dmaphyssrc2 = 0;
    * V3 z- l- E2 G7 o8 K3 n
  70. dma_addr_t dmaphysdest1 = 0;
    1 |+ R9 X2 `0 e" K! X6 Y. ^8 p
  71. dma_addr_t dmaphysdest2 = 0;
    * z' U$ i) [: O

  72. 9 ~$ H( ~/ [+ X7 H
  73. char *dmabufsrc1 = NULL;
    # t6 D; i0 S/ z7 F, U- H: ]
  74. char *dmabufsrc2 = NULL;+ R5 p% R# D. B( z
  75. char *dmabufdest1 = NULL;
    0 ]- Z( ?) s8 z  T
  76. char *dmabufdest2 = NULL;* I1 M- o7 Z1 l# ~

  77. * h6 X; [* k: B( i
  78. static int acnt = 512;
    ( H0 q) Y$ q) y" J! R. i
  79. static int bcnt = 8;
    / @+ r: m0 d* o% p
  80. static int ccnt = 8;9 B. F2 w( g: j6 E- P0 G- t2 H
  81. 0 {8 s1 j( ^* r7 E% F
  82. module_param(acnt, int, S_IRUGO);
    7 G8 R# q7 s6 t9 \8 v) \3 W
  83. module_param(bcnt, int, S_IRUGO);
    # c: J7 n  {9 T8 ]1 L) v7 a2 F/ ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# D6 x! M- |3 K4 w+ q1 \3 I2 ?
# O+ |1 l% F4 V9 b  s3 u' k- q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 ?5 a; g0 ~( z2 H* f
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* }8 c: \! `1 Q3 p4 m; V/ p0 i$ ^0 Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. S, \. ?# G5 B' t* A; e7 f0 `. A9 n; C( e# c$ }4 u, z

1 K2 R5 Z/ Q% Q9 M. u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 05:03 , Processed in 0.037054 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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