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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 t* s5 W/ Z  x% J( r* l$ g2 I$ f
  1. [code]EDMA sample test application
    ( P  S7 a5 N+ r6 u
  2. /*
    + U) H4 ]7 }) G8 m/ u
  3. * edma_test.c
    2 `) m, t6 f/ S  L! N9 I! |& o
  4. *1 U% M+ W; Q, z) P) c
  5. * brief  EDMA3 Test Application
    " w8 p  L1 R7 a( Q( ]2 U) D$ p
  6. *1 N! T; N- ~0 P7 r
  7. *   This file contains EDMA3 Test code.
    - j3 L' w' F  q8 U# L  z
  8. *# d- i: ~+ E9 O% F6 f, ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 k3 M& U% @$ B) f! t/ ~' P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ K1 J+ \$ E1 c8 L, f" Y
  11. *         TO CHANGE.
    % j+ b. j# `) |* @: z$ a& S
  12. ** w. O! J0 I( t" f! b- t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 {, f- }/ v8 \7 _6 m
  14. *
      ?) J/ s; \3 ~  g7 X3 I/ ~
  15. * This program is free software; you can redistribute it and/or
    # K9 ?# k. Y8 h& D% A0 b6 k
  16. * modify it under the terms of the GNU General Public License as$ T7 N  T( _: m  m! P* {
  17. * published by the Free Software Foundation version 2.
    # n. e6 p7 W) k
  18. *7 T, P/ R) v: A' s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) I- L1 I" W3 s. P
  20. * kind, whether express or implied; without even the implied warranty" S' b- T) v/ |! }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & P# K8 @. a) }9 m, R
  22. * GNU General Public License for more details.
    ' a" X" b) F: ?' Z; [8 Z
  23. */
    1 B* m6 g8 y& v( ^7 V
  24.   _( l- d/ p  N
  25. #include <linux/module.h>  a, V5 K8 T& y" V- x
  26. #include <linux/init.h>
    7 c7 t! `6 P; t0 X9 J# g9 l
  27. #include <linux/errno.h>
    8 n0 R4 E6 H1 |6 `* D
  28. #include <linux/types.h>
    2 v. \( u) |: r3 a0 A# Q
  29. #include <linux/interrupt.h>1 e4 x, d6 V8 B3 `- q
  30. #include <asm/io.h>
    & ^, {1 I7 r- u; j* |0 c0 L8 Z# y
  31. #include <linux/moduleparam.h>
    - y4 I2 n6 M- w+ O
  32. #include <linux/sysctl.h>
    ! m! X1 ?/ ~8 i+ ^, Z' w
  33. #include <linux/mm.h>* u6 |7 }* f9 X
  34. #include <linux/dma-mapping.h>
    - _9 X& j/ ~3 @
  35. ; P+ Y* z" [: s2 D. B* L
  36. #include <mach/memory.h>% M5 `5 X# J3 r/ ]; o1 v
  37. #include <mach/hardware.h>8 Y" d2 b8 S, e; y! m3 z
  38. #include <mach/irqs.h>
    ! Q3 }8 K# Z' x! p( R
  39. #include <asm/hardware/edma.h>* i$ j' O) s- [9 x/ G

  40. 5 I( I& a$ J0 V' @7 l& j
  41. #undef EDMA3_DEBUG
    6 M! c7 X0 z6 m5 M8 m0 j" {
  42. /*#define EDMA3_DEBUG*/: n3 R: I6 w6 J2 B+ W; g

  43.   R' U3 g0 o7 k+ w" R1 d: T
  44. #ifdef EDMA3_DEBUG
    / m* I0 D( [3 Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 }- k6 I6 h) K$ _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 o2 ~) a1 T( l7 d+ r" r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % T# W( M1 w% i2 y1 }6 F
  48. #else, {; q. @) D0 g' u
  49. #define DMA_PRINTK( x... )
    0 n% ?4 |5 C: J
  50. #define DMA_FN_IN
    ( Q& O: M' T; [% K2 ^! C
  51. #define DMA_FN_OUT
    5 \$ O8 ]8 A  X- h! v4 P
  52. #endif: g/ E9 l' M/ b# l+ T2 `5 v0 R6 h9 \

  53. 7 N0 H9 j" t) ?1 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 C( d/ L, E, ~5 X3 k. [8 @
  55. #define STATIC_SHIFT                3
    " I/ r: T& ^6 u6 S: s: `/ k0 j
  56. #define TCINTEN_SHIFT               20
    ) J' p; a- W- R1 I2 w
  57. #define ITCINTEN_SHIFT              21
    - w( ]1 l/ N2 C: Q8 C% r
  58. #define TCCHEN_SHIFT                22& |; A* h; I$ _+ a8 p* P
  59. #define ITCCHEN_SHIFT               23
    ; C% Q8 x* M: C4 \

  60. 7 {; B5 l/ q/ i. e. u
  61. static volatile int irqraised1 = 0;
    # _6 ?* e5 J8 u
  62. static volatile int irqraised2 = 0;
    $ {' y; Q$ K( P9 A2 O. U6 B+ g: [

  63. 4 B9 ]$ \2 `) n5 k2 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % D8 m* z) E# j" M7 L2 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ d7 U1 |  ^" }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 G. \( T! N+ d8 q2 l; T3 O
  67. 4 t  f) a' a4 l/ t# R
  68. dma_addr_t dmaphyssrc1 = 0;# g$ Z4 b  C1 ~( B
  69. dma_addr_t dmaphyssrc2 = 0;% I2 p! t4 k" P4 {
  70. dma_addr_t dmaphysdest1 = 0;$ C" _% d: b6 U8 X
  71. dma_addr_t dmaphysdest2 = 0;
    0 q' e; o+ L- Q* W

  72. ' u( M2 s5 x2 F% ^
  73. char *dmabufsrc1 = NULL;
    9 q" h3 P8 S5 o! ~) u
  74. char *dmabufsrc2 = NULL;
    6 E6 N9 I9 E: ]% J9 W+ @
  75. char *dmabufdest1 = NULL;+ q8 }6 h4 E0 X, F$ t- Z
  76. char *dmabufdest2 = NULL;
    8 J4 e. |' p5 w4 T+ @7 }

  77. : v' W% n1 }3 g; z
  78. static int acnt = 512;- @1 E; i: \5 V0 _- x! Y/ D. O- a7 S
  79. static int bcnt = 8;+ D: |' A+ A, D, ?
  80. static int ccnt = 8;
    0 d( W" B# d' V9 _

  81. 3 I( j3 J. A0 Q
  82. module_param(acnt, int, S_IRUGO);+ Z0 m, U" y7 s9 }' B$ o
  83. module_param(bcnt, int, S_IRUGO);
    % M& z8 \7 c. l# B# d+ R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* j+ c$ P. F( {4 n* [+ B7 z
$ d  e0 W- r& h9 c# z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& Y  r6 |' [& I. w  M1 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 m% I0 ?" `) b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 ~/ q: l: v6 R, p
  ?* v$ v5 |# t% j- _" H8 g
8 Z% n' I! e0 I" B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 03:28 , Processed in 0.040576 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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