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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : f' o8 K% {- R, @' D+ w- c( h
  1. [code]EDMA sample test application
    % ~# K7 e1 D+ z; W( Y$ g
  2. /*& ?) ~7 ^& x  |! N$ W3 o
  3. * edma_test.c6 }6 l$ m- `+ B3 `* e. `& N
  4. *5 b! u2 V0 G( T  i
  5. * brief  EDMA3 Test Application/ x  ^( G$ m1 @, {
  6. *
    % V0 V1 U$ j( }4 B. @7 P+ {
  7. *   This file contains EDMA3 Test code.! b9 J+ s; Z/ F1 z
  8. *+ m: o  h0 M+ ?3 D9 U: P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 w3 T, h5 w- G: m+ K* I) p3 ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ X2 [, p  q2 F, e
  11. *         TO CHANGE.) V& z$ k7 L& c2 I4 B
  12. *: Y. X, v1 Y$ t! y4 s4 k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 c. M1 @% f& |$ H( H- O4 ?
  14. *
    % [# _, X$ o: e! I7 ^, h
  15. * This program is free software; you can redistribute it and/or: ]- S9 K$ ^/ r/ ^- Z6 ~
  16. * modify it under the terms of the GNU General Public License as+ `, m% z- t0 p3 E( j
  17. * published by the Free Software Foundation version 2." |0 }! j& r+ s$ m5 u
  18. *
    / K/ K* ^$ D/ ?! d% C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 ]0 a' p& G* w+ D8 A- b6 A
  20. * kind, whether express or implied; without even the implied warranty
    # j  b& ]  W& D% n/ M* R+ L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 v# r% T5 z5 J, u- s( p; r
  22. * GNU General Public License for more details.
    $ e( G% U% w& b2 M3 E# t& q! e
  23. *// h0 T' x6 D9 C

  24. ! u4 e& Y4 a2 g6 I: {8 g
  25. #include <linux/module.h>
    - @1 R8 G9 F* x6 Z, d2 x9 S( x
  26. #include <linux/init.h>) L: M" L" R8 F; t6 x7 z% P3 B2 L# e
  27. #include <linux/errno.h>, J  b4 i- ~& c0 O. q
  28. #include <linux/types.h>
    1 r7 Z/ E0 s2 T/ c4 M
  29. #include <linux/interrupt.h>
    % V9 |& a. \# h1 ~! _& L8 d
  30. #include <asm/io.h>
    ' u3 k! l) v2 h( f, N& u8 L* G( v
  31. #include <linux/moduleparam.h>
    ( c4 r$ a: ~$ d" n6 A; o
  32. #include <linux/sysctl.h># _8 J1 J7 l# U& Z& E' M
  33. #include <linux/mm.h>
    6 l* @& s& t+ j0 w; `
  34. #include <linux/dma-mapping.h>
    1 a0 {, h' x$ V: ^( p& S
  35. ' p" R; n7 f, W6 {
  36. #include <mach/memory.h>
    : v  Y3 E% G4 @! h1 N  S" B
  37. #include <mach/hardware.h>
    % I: Y/ y2 s0 r3 o
  38. #include <mach/irqs.h>2 }6 O0 u7 V$ @2 Y: t) a0 T3 t
  39. #include <asm/hardware/edma.h>/ r) I6 w4 ~; ^0 ~# d+ g
  40. 7 c( \5 D4 i( |$ j+ D8 w# i
  41. #undef EDMA3_DEBUG
    - S, S* @$ Y- o9 X
  42. /*#define EDMA3_DEBUG*/
    * w' m6 x! B' Q2 e
  43. . B, B# ~, f2 D( f- S
  44. #ifdef EDMA3_DEBUG
      t6 q! \: a' e3 u: d9 L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 R' K) ]9 \$ c& L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* L! r. I' l$ X/ ?# p: g& o5 g. i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  m8 ~3 L& m& S4 K/ ~/ @  r
  48. #else! f) B- h5 h; ^" O
  49. #define DMA_PRINTK( x... )
    % }7 X! k$ ]% {" Y
  50. #define DMA_FN_IN
    # j: x6 f( `5 x  U
  51. #define DMA_FN_OUT8 g" s9 ~. |+ O2 B
  52. #endif
    7 Z% b- q  l% f' p& P. @6 _

  53. 4 K1 Q; \6 j' k! ^, y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 G- m1 Z: J- f3 d1 d
  55. #define STATIC_SHIFT                3, b4 ~9 x; }# ~" @  {
  56. #define TCINTEN_SHIFT               20
    . e+ R/ Q. j) v" E
  57. #define ITCINTEN_SHIFT              21
    . f6 d3 ]- ~% D) Q- ?$ _9 q/ X1 s
  58. #define TCCHEN_SHIFT                22
    7 G* J) g: a, \- Y, s; j
  59. #define ITCCHEN_SHIFT               23
    ) M, T$ \5 X5 N$ ]/ r
  60.   E( h0 g, w. Q. b
  61. static volatile int irqraised1 = 0;
    / b# K- ?3 K2 K: r& D( X
  62. static volatile int irqraised2 = 0;
    1 E" Q3 ]9 K; M# Y5 Z% }! i$ l

  63.   T! j- E/ |' J* P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 M/ y2 T- H" _$ T* [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' \" k6 r! ^9 G/ s! y7 U$ w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: J3 N) z; v# j4 K
  67. 9 C( L" ?" d# Q7 g( m2 v# D9 S
  68. dma_addr_t dmaphyssrc1 = 0;8 D' U/ j  @- m# p' W* Y
  69. dma_addr_t dmaphyssrc2 = 0;
    " b3 B  N3 W6 v5 o- m. E
  70. dma_addr_t dmaphysdest1 = 0;
    * h5 c( H7 k4 c
  71. dma_addr_t dmaphysdest2 = 0;! a8 S  [& O' `4 C
  72. - [7 P4 J  L7 R5 s, o5 x, h, }
  73. char *dmabufsrc1 = NULL;
    9 T6 d; o! n" X% H8 v" W/ i
  74. char *dmabufsrc2 = NULL;1 }( s  z6 {& `6 g# J0 D
  75. char *dmabufdest1 = NULL;
    % ?  J6 j& a8 g4 d4 F/ k* D, J
  76. char *dmabufdest2 = NULL;* e0 G9 B. ^+ v8 S
  77. - k* m5 B4 Z; _) q, b! j5 w) ]
  78. static int acnt = 512;+ x1 Y: I1 Q" C9 f! c
  79. static int bcnt = 8;) i; t# k8 a0 Z0 X8 N/ y' t8 X
  80. static int ccnt = 8;
    , t5 [2 u2 j7 F% A; q8 _
  81. 5 W  I8 M9 _, s
  82. module_param(acnt, int, S_IRUGO);
      e7 `+ s1 y' z
  83. module_param(bcnt, int, S_IRUGO);$ s' H/ o/ v# V2 ?5 l3 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# [6 a2 T* C* j/ l5 G) T6 k

  m% w4 w0 \5 y1 q$ W      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 Q$ |8 k5 y8 N6 j, n9 |# S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- {6 w! u- Z/ u6 _6 j0 B     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: X$ B# W# f0 y+ }9 p% y8 n  x$ a
, T6 c. i, I& u

4 i9 J. W' m6 O+ Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 13:29 , Processed in 0.043475 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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