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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 k  @. D8 `, K/ S5 N6 y
  1. [code]EDMA sample test application
    . y0 J+ y9 G/ i  x. Z7 n: T
  2. /*3 Q. o  Y, k8 }: F
  3. * edma_test.c
    - a; E' Q& @8 g; v4 n9 m, C
  4. *
    6 I+ ~$ {! [. X' F
  5. * brief  EDMA3 Test Application
    ' _6 X& L2 q7 z$ A9 I$ I* K( O
  6. *
    3 f( @7 f1 j) v/ W$ U0 P9 F
  7. *   This file contains EDMA3 Test code.
    0 Z. }7 q$ b% _2 B$ V8 T) w
  8. *7 \( F; [& K$ r5 l$ ~% |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 |$ Z' ?! N) N2 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( r1 @) X0 u. r1 t) R$ F* S
  11. *         TO CHANGE.. K9 u+ S$ G. d# w  u) t
  12. *. m" Q* n$ @7 n! A: O/ E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// w5 ^8 Y' C  x
  14. *6 H/ j/ ?6 m8 r5 h) \* E
  15. * This program is free software; you can redistribute it and/or
    5 |9 M  Y9 H8 u6 E
  16. * modify it under the terms of the GNU General Public License as0 C+ Z) J/ @, ]- R! k: @& }
  17. * published by the Free Software Foundation version 2.* H' L3 I* v3 ?- y" i3 D" p
  18. *; R5 I3 c4 q  ^8 j7 ]8 J# q- T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : d) _9 r1 v' }: _4 {4 V
  20. * kind, whether express or implied; without even the implied warranty
    ) n; ]+ j' F. ~7 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ d- F! e* N( A# q
  22. * GNU General Public License for more details.5 b! t- ]: h& T$ u  t7 U: k
  23. */0 C% t" s  w) M, t; g

  24. " N3 K  y, Y5 D$ S. I; ~* f# V
  25. #include <linux/module.h>
    1 a: H0 _- l! a+ h- ^
  26. #include <linux/init.h>
    3 m) H8 i2 m4 G' F. g; r4 {
  27. #include <linux/errno.h>
    7 \: _+ e4 F5 T. u7 j" U
  28. #include <linux/types.h>6 `, L: B8 A8 j; c9 [
  29. #include <linux/interrupt.h>/ o4 u' q5 `. ^$ a
  30. #include <asm/io.h>
    " }' W9 w$ e) s5 K0 t9 r
  31. #include <linux/moduleparam.h>" R  `( s- p6 y) R, l, j- [2 L
  32. #include <linux/sysctl.h>1 m$ Z! {2 x& C$ ?2 s+ O
  33. #include <linux/mm.h>
    $ K$ Z0 z! ?' ?- e! j& s+ n
  34. #include <linux/dma-mapping.h>
    ) K' K7 ]7 g% \  Z) |

  35. " C% F, Z- k2 X% a" l3 o5 E
  36. #include <mach/memory.h>
    , W% d8 n+ X7 v
  37. #include <mach/hardware.h>
    - G1 o' l% E: z9 I# ^
  38. #include <mach/irqs.h>8 O( c6 ~- O: U+ k& {4 s0 M$ r; S! X$ \
  39. #include <asm/hardware/edma.h>5 A7 r  H5 `7 a% v) @0 }5 Y* X- a

  40. 6 r1 s4 E" D3 Z! Q
  41. #undef EDMA3_DEBUG5 t" K* b8 ~/ }0 Q! Q' G
  42. /*#define EDMA3_DEBUG*/
      Z- v0 u+ B. Q$ J6 L  C/ V) {! K

  43. $ I+ }3 Z- V/ m7 Y: m- T1 `
  44. #ifdef EDMA3_DEBUG
    ( `+ _9 x; R5 H9 F. ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 T# X2 W. ^, T; N/ \, R( v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! b6 N2 L+ ~5 W" i, g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). S6 g- X# X( u
  48. #else
    ! F% q+ {' H* N! b0 w
  49. #define DMA_PRINTK( x... )
    * C& n# X( V  e8 I2 ]! ~, S! J
  50. #define DMA_FN_IN% L7 y; B& `" D( Z' U; A
  51. #define DMA_FN_OUT: E6 y( b9 {  i2 e/ q' g
  52. #endif4 h. ~' X, Z2 z. [* ]/ l

  53. 5 P, a( k6 v% I5 [* D& u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' B& Y! Z4 {8 {/ `1 ?, s& v- O# o
  55. #define STATIC_SHIFT                36 {7 B8 |  V& U  m
  56. #define TCINTEN_SHIFT               208 R+ q* X7 C/ X" k6 C; W
  57. #define ITCINTEN_SHIFT              21" x, @. e+ v/ Q  _
  58. #define TCCHEN_SHIFT                225 c0 e: t2 ?- x
  59. #define ITCCHEN_SHIFT               233 z4 N) q/ b8 g9 ?  K5 ]5 k. H
  60. 4 W4 [, b1 S" k, b/ S# F
  61. static volatile int irqraised1 = 0;% j3 K9 s3 [8 H
  62. static volatile int irqraised2 = 0;2 P5 k6 f# j  L
  63.   V8 N1 C! \* \4 F) A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 j% D. Q' B. g; X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & {! q" H: U  Y. ?0 |3 f) d, l& j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 O2 j" `/ m9 q; X" W
  67. 5 h  E3 @- O8 O
  68. dma_addr_t dmaphyssrc1 = 0;
    & R' E* I6 o' N" M! ?7 o% J
  69. dma_addr_t dmaphyssrc2 = 0;- C- X6 y2 V9 O3 a3 h
  70. dma_addr_t dmaphysdest1 = 0;! d. m' g  l4 n5 d. N
  71. dma_addr_t dmaphysdest2 = 0;" L/ h8 l2 R: [. ]. w: z

  72. 7 u! Y9 k) G% K4 l
  73. char *dmabufsrc1 = NULL;
    ) z2 h7 f& Y& M$ V& [, F2 X
  74. char *dmabufsrc2 = NULL;
    ' R! W) S! V, e/ y  I* X
  75. char *dmabufdest1 = NULL;
    ) Y6 P1 ^6 `# e1 y5 ~
  76. char *dmabufdest2 = NULL;. z; Q4 L$ t; h( c2 g

  77. 5 N. ]. F0 Y5 J6 v$ ~
  78. static int acnt = 512;
    9 Z' d( r( i( W2 \# S
  79. static int bcnt = 8;" }+ e& h- q: F6 d2 b
  80. static int ccnt = 8;2 d" C0 \; \+ U! ^0 A

  81. $ B, J5 c" L4 w  }9 J( i3 O/ P
  82. module_param(acnt, int, S_IRUGO);1 w6 q- b# Z, j# W2 O( {
  83. module_param(bcnt, int, S_IRUGO);
    . i9 j; B5 w, [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' N8 N% X- X( o5 m0 V2 Z( y) p# E& S: v$ i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ }1 K- t' y* ^) D7 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" z8 z' C. h2 R* g3 ^# Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! b1 i! f5 B4 c, ]; D

+ z6 E6 s4 e- _: e* E' f7 q
2 c8 u& g7 N0 h3 S6 y/ V1 d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-5 19:51 , Processed in 0.041607 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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