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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* B& z1 ]! B5 D* c( M) V4 n3 J
  1. [code]EDMA sample test application
    : K! z' d4 x( o7 H+ H- x
  2. /*& r9 |( I$ e1 k3 T! a
  3. * edma_test.c$ h/ L' M1 W8 e: `% }" v
  4. *$ c1 z' Z- X1 b$ T* b
  5. * brief  EDMA3 Test Application0 ~/ ]; R$ W* G+ p* i9 x
  6. *
    4 j+ i* f) g7 ^) O; D, Q
  7. *   This file contains EDMA3 Test code.7 L9 \/ Z# |* A. o
  8. *
    " c' i4 O/ R$ Y6 k# N2 T. A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE1 I+ {7 e  i; l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 e6 M- Z% \$ J1 D; K
  11. *         TO CHANGE.
    2 o  o; U$ z1 O' i  X5 s+ }
  12. *
    - I/ e  |8 S0 u* p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , \, |* x! y) C" g$ B
  14. *
    6 n8 O. z& x# Q- R$ Y9 l# `# {
  15. * This program is free software; you can redistribute it and/or
    ; Y" N! b6 f3 W& f+ S
  16. * modify it under the terms of the GNU General Public License as
    " E  ?3 T; c2 E! x- N8 v5 U. g8 w# c
  17. * published by the Free Software Foundation version 2.
    9 C! l1 t: p3 E- I) r
  18. *0 Y. K; B; o. _! ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' J  ^/ U5 v8 v0 e0 C1 \
  20. * kind, whether express or implied; without even the implied warranty4 V: C! m& o6 y! P! e1 ^  l
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  F9 x% R+ w: W8 u7 |
  22. * GNU General Public License for more details.
    * o: l. Y/ }( |! L: r* @. G
  23. */
    $ E. P# x0 H0 A) b9 G
  24. ' f: {* c9 ?0 a( `
  25. #include <linux/module.h>% @  J" c+ ^8 C
  26. #include <linux/init.h>7 a9 H1 {7 a, b- o
  27. #include <linux/errno.h>
    : e+ I; z( v! u$ p* j, H+ P
  28. #include <linux/types.h>
    - O" C* l8 X% y2 B
  29. #include <linux/interrupt.h>* i) ?% Q: e3 K, b& j& R; {% y- t
  30. #include <asm/io.h>, }2 y5 q, x; J7 [. Q
  31. #include <linux/moduleparam.h>
    ; r, t" A( M& X* B0 S  ^
  32. #include <linux/sysctl.h>
    , `+ U( e- o" W! Q, _& L
  33. #include <linux/mm.h>
    3 v* z& B& Y+ L
  34. #include <linux/dma-mapping.h>
    7 l2 S- i, l1 x5 r- s/ r
  35. 1 x& X7 P1 F0 ]2 M, W- C
  36. #include <mach/memory.h>
    ) x8 O2 b3 f; o0 _4 D# V
  37. #include <mach/hardware.h>" p, [) N" g/ T7 @! @' K
  38. #include <mach/irqs.h>
    ' h2 o' r8 W! K2 m  l3 B2 ~
  39. #include <asm/hardware/edma.h>7 f1 M; f5 S1 o5 n3 B
  40. : m1 B( o4 `0 O0 T) {
  41. #undef EDMA3_DEBUG
    # [3 l1 T4 k8 g
  42. /*#define EDMA3_DEBUG*/( B1 F8 z, r0 s/ `

  43. 5 i" b: f" F& i! E, Q1 x
  44. #ifdef EDMA3_DEBUG
    ( N6 C2 z. N$ _  _# ]% c4 J+ h. `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 D3 e, x: Q4 I5 u5 A* ^2 N  S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & p+ M, Q9 l/ {" h8 B- V4 J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' [8 o. d7 ?) u( R/ b' p
  48. #else0 e; b: L8 i$ Y( a7 b
  49. #define DMA_PRINTK( x... )- p3 Z) R$ x% q! d- ?; c
  50. #define DMA_FN_IN% c* {- H, |- n, B
  51. #define DMA_FN_OUT
    1 |5 n& g; E3 o! g& `
  52. #endif
    ; ]- U. S. T; f& x! z: f

  53. 4 j9 \) Z0 ]) q& L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      a+ l, Z, Q. Q: ]' K: V
  55. #define STATIC_SHIFT                3" X2 q- `2 u, _9 N( b" b
  56. #define TCINTEN_SHIFT               20
    # {* g, E5 {3 J9 t- y& @
  57. #define ITCINTEN_SHIFT              21/ x4 l4 Q- i2 A1 O1 y
  58. #define TCCHEN_SHIFT                22
    % J; I  ^. m- z/ @
  59. #define ITCCHEN_SHIFT               23" t+ Z- D9 c6 m6 j

  60. 7 H9 A4 I" |; q, b, g
  61. static volatile int irqraised1 = 0;5 U7 D4 n' l: R1 N% |, j
  62. static volatile int irqraised2 = 0;
    4 ], [- s, d( \
  63.   G) [2 l! q- {7 \/ [! T& p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 j. O. R) E! P7 ~3 s+ N5 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! n  X% S" Q+ \; c# d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: K$ x; P5 j' \# {3 `2 b/ ?

  67. ' M/ X/ k. H3 B# D: w6 Q
  68. dma_addr_t dmaphyssrc1 = 0;' S. W% e) Y- d: L# Y6 }
  69. dma_addr_t dmaphyssrc2 = 0;
    & U' Q+ _' m, ^3 J+ {- F" J
  70. dma_addr_t dmaphysdest1 = 0;4 I- k( v" ^! l* _# \
  71. dma_addr_t dmaphysdest2 = 0;- \# c+ f, y4 e
  72. 8 \7 _5 e# J7 i' `  j0 J. A
  73. char *dmabufsrc1 = NULL;" j' m& e) a; p4 X+ V- S
  74. char *dmabufsrc2 = NULL;8 S" {. D* G/ m8 z# O/ D7 R, U3 v
  75. char *dmabufdest1 = NULL;: r! Z+ {$ w- N
  76. char *dmabufdest2 = NULL;, P1 q, q# |/ [- l5 Y" ]& a0 U3 C
  77. 7 _) f0 B& S! D
  78. static int acnt = 512;4 X9 L3 T4 h: p
  79. static int bcnt = 8;
    9 t' @& P! C% t3 z0 k# U/ E
  80. static int ccnt = 8;
      C* w# s0 [; j" |9 \+ ^1 @
  81. 2 O! r0 P/ q  L8 C: l9 ~- e
  82. module_param(acnt, int, S_IRUGO);0 P' G4 Z9 p+ P3 y  U9 D' a
  83. module_param(bcnt, int, S_IRUGO);1 o6 L. Q$ o9 B& r. g% }
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- a6 A) x4 T1 I$ `
0 o4 c  P8 z4 s2 Q9 A" G4 w  `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, I& M3 G$ ]% G5 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 K% i3 ?: j1 @, B( S! y; G6 q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 R" l+ k- d" B7 n: H# a( Z
: b5 T0 e( ?# S: |' E3 g, K' A1 g$ z3 G/ n. x) H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-23 00:04 , Processed in 0.048186 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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