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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + _7 i, o+ W* }* L
  1. [code]EDMA sample test application
    6 D9 [0 ~0 B6 j9 R& O
  2. /*% r8 ?+ g7 @% \7 I# P# f
  3. * edma_test.c
    , y! s( K& w9 _; ]
  4. *3 }  K, I3 V, W0 i
  5. * brief  EDMA3 Test Application* q( X% S; L, d1 q3 v- D
  6. *
    8 Q/ ^( k. \/ \+ J! r  p
  7. *   This file contains EDMA3 Test code.
    ! t  f9 C+ G# E# \
  8. *
      m; n: V/ g1 m6 U$ a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + [$ g4 b6 G/ h2 A! F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 M7 Q. V' T# H: U- X
  11. *         TO CHANGE.5 Z) c( c( C3 x% k1 Y8 q
  12. *0 i' T$ Y9 v$ R; J7 x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) N# o7 q, h! ^& I! ?& _' ?
  14. *
    / b7 N( F2 F; |' a- c0 L
  15. * This program is free software; you can redistribute it and/or
    ' U, T% P& A/ ~( n. J
  16. * modify it under the terms of the GNU General Public License as. n: h2 _& w4 l) j
  17. * published by the Free Software Foundation version 2.
    , N$ c7 O( m3 y# J$ d
  18. *
    - z4 D* @  P  u) F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + E6 r( y* ?2 T* k* W
  20. * kind, whether express or implied; without even the implied warranty
    & W( m( g& a0 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) N& O7 Z/ l0 h; q& \# [6 ]- v
  22. * GNU General Public License for more details.
    ; \9 Z' R' }$ y5 O
  23. *// C9 S/ y. z/ L

  24. 3 R2 ^5 X9 ]8 K) N6 c  W
  25. #include <linux/module.h>4 Y0 {# Z: h4 g8 X) v
  26. #include <linux/init.h>2 \# `) p% t$ h. A$ V
  27. #include <linux/errno.h>3 w' T: \# m6 F- {4 m
  28. #include <linux/types.h>7 l; I, r! K: H1 e4 q
  29. #include <linux/interrupt.h>
    * m8 R# h1 _3 q4 J) g2 d
  30. #include <asm/io.h>' y+ F1 S9 m  i  N, Y: r  m1 s
  31. #include <linux/moduleparam.h>
    5 Y9 \% r$ Z7 q- j4 F9 Z
  32. #include <linux/sysctl.h>
    ; U4 @& u+ U8 w/ ?) s. }& c: V
  33. #include <linux/mm.h>8 j$ q' c3 O" \2 L1 U
  34. #include <linux/dma-mapping.h>" I/ y' g5 p0 R6 Z. h2 C
  35. " O: h- C3 ?( C
  36. #include <mach/memory.h>3 ^7 \1 j( ]6 Z; T  F% |- ?2 k
  37. #include <mach/hardware.h>
    8 T* Y: ]. [! E! @$ H
  38. #include <mach/irqs.h>4 s; a* E! z' B+ ~3 n. n$ J
  39. #include <asm/hardware/edma.h>/ a, K$ F6 b1 G, J# \8 N

  40. # N' U: M. o; S; U
  41. #undef EDMA3_DEBUG% E/ O1 j# a& h5 j+ _6 Y5 s
  42. /*#define EDMA3_DEBUG*/
    3 f& j1 r* Q2 P" z2 L

  43. / C) t! o+ o7 K! z
  44. #ifdef EDMA3_DEBUG( w+ F: t9 f' {; j
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) C* Y9 w+ {  {  |) W$ C/ [; M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 u9 W" Y0 W! o' y0 w, a8 d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& q4 t. @( F* K% m0 ?+ y; X
  48. #else) f' v" ~( T- u9 d& k
  49. #define DMA_PRINTK( x... )0 i; f% U9 A& ]0 f3 c9 v/ f- g% V
  50. #define DMA_FN_IN! q- A3 d/ g/ ]1 \) }* ?
  51. #define DMA_FN_OUT! l! u( a0 W+ i5 u" f
  52. #endif4 r# L  n7 L  Z5 e

  53. 4 R0 Q, u0 @# A4 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 ?7 G% g7 {1 [- J
  55. #define STATIC_SHIFT                3
    ( u% \0 v! Q  f- [3 X# ~; k3 u
  56. #define TCINTEN_SHIFT               20- t0 X( }7 `* J& \% v0 {7 F
  57. #define ITCINTEN_SHIFT              21, ^9 l% G* h4 |1 k# |
  58. #define TCCHEN_SHIFT                22
    - z* M% s1 y, k) [
  59. #define ITCCHEN_SHIFT               23
    % M$ K! Q# \- _2 V. ~/ m

  60. 3 e% p. g4 {. u' ^! n& n
  61. static volatile int irqraised1 = 0;
    4 p' f+ q9 O) w& u2 B
  62. static volatile int irqraised2 = 0;6 R/ a# F* g1 v; V1 X8 `

  63. 9 G, c0 i+ s: b) V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! [2 f$ q' u) Q% X+ q* M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 f* {  w: Q- P7 @5 J$ U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , S" ]9 e( t5 d9 I; ^
  67. 7 f! L3 c1 ]. |9 ?
  68. dma_addr_t dmaphyssrc1 = 0;
    3 ~3 n: S# ]. o
  69. dma_addr_t dmaphyssrc2 = 0;
    : z& Y2 _  |/ M2 K9 q0 q% l+ N
  70. dma_addr_t dmaphysdest1 = 0;( [( m  I1 M% A. y2 p6 h) Z
  71. dma_addr_t dmaphysdest2 = 0;9 r3 a$ ^9 z/ q8 s
  72. + F' O& w' T+ b, O0 a
  73. char *dmabufsrc1 = NULL;6 c! ^0 S& _- Q* a6 O# w
  74. char *dmabufsrc2 = NULL;
    / Q7 l5 \4 _8 m
  75. char *dmabufdest1 = NULL;+ f4 u' @5 b* B7 m  S# i7 r
  76. char *dmabufdest2 = NULL;
    4 [" p* G$ ]6 K9 p0 y. }. e# M6 C
  77. 5 M! F6 @: A, `0 {0 p
  78. static int acnt = 512;' M  B! c0 U0 i5 s& z2 u2 Y
  79. static int bcnt = 8;$ C! j2 ~6 c/ D6 N
  80. static int ccnt = 8;# ~- e4 t) m9 @- H# Z& t

  81. # e1 h0 f2 f) o5 F1 B) ~+ [
  82. module_param(acnt, int, S_IRUGO);
    2 e; ]; b* x6 M8 r/ q
  83. module_param(bcnt, int, S_IRUGO);4 n4 v7 ]8 l1 {. m5 w, ]8 }/ q; t/ K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 W, l3 L$ S1 E. H  e

" r# X  Z% h3 R4 w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 v' J& d% u& H* _  r6 karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ A( ~& e0 Y3 x& y& r( S; U6 I9 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 _9 K, i' E, D
! k+ a- m1 [  `" Y+ m7 V$ |" ]
8 q7 }8 V* z2 C5 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 17:20 , Processed in 0.038881 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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