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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   ~* \* |9 g/ U- d3 S7 n
  1. [code]EDMA sample test application3 y" l& g4 U$ U5 |
  2. /*" R: r  Y& h9 A+ P5 I- o
  3. * edma_test.c
    3 Y4 |: |4 ~6 I7 I4 T: T
  4. *
    * C$ v2 y# d% l+ ^1 r2 S3 ?
  5. * brief  EDMA3 Test Application" j; }  j  R$ V' _4 r$ v( }
  6. *$ P- f2 c4 F% F+ E
  7. *   This file contains EDMA3 Test code.
    1 h* {0 D8 w/ V2 L
  8. *
    9 Z) {- W$ Z  u: Q+ O% P0 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 S) F* n9 Q* d- V9 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . M  E1 D' O1 f: B: s. U& O
  11. *         TO CHANGE.
    " b7 g2 f* D/ S
  12. *
    & Y2 L% x- q1 _6 \" S- R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 J3 T: c6 L$ @1 P. k
  14. *
      X+ B( D& K' u) f! N* n  [. Y  u
  15. * This program is free software; you can redistribute it and/or
      [# S0 r9 L* ~2 [
  16. * modify it under the terms of the GNU General Public License as
    * x  v/ v, \* R% B/ H) P/ R1 B: k
  17. * published by the Free Software Foundation version 2.6 S8 S9 L. X# B- Z
  18. *
    8 ^; W$ |# P( v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( f, C" D  K8 q2 S
  20. * kind, whether express or implied; without even the implied warranty
    7 h) k6 K: b" k0 J2 A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! X8 a- |! x- n; y. W" i& f9 k$ ]
  22. * GNU General Public License for more details.7 H5 n. D! v0 W+ P/ r0 m0 Z
  23. */8 S8 P  P& K- }% v

  24. + R1 j6 ~. [' Q5 j4 E5 l# E: E
  25. #include <linux/module.h>/ t7 X0 {- k" A1 m( S. c
  26. #include <linux/init.h>4 m+ u& A  J: u4 h& ?& t
  27. #include <linux/errno.h>
    - i- _; Q) }7 r1 Y/ `* Q
  28. #include <linux/types.h>/ _: V2 Z% y# r3 C* j
  29. #include <linux/interrupt.h>" J- l" D. J+ G8 w4 P5 N, o
  30. #include <asm/io.h>
    1 E$ x; S( p9 q
  31. #include <linux/moduleparam.h>
    6 T1 G( @8 t) I( j, J
  32. #include <linux/sysctl.h>
    , e1 m' v2 C& K0 R2 Q
  33. #include <linux/mm.h>
    , m  N0 p9 I8 }" v# m
  34. #include <linux/dma-mapping.h>
    : {( z; Q) z, R3 _+ A. r

  35. ) {. e4 A6 t! E; X
  36. #include <mach/memory.h>: d5 U. W2 |/ d' ?4 l; M
  37. #include <mach/hardware.h>
    ! e) \0 N3 O1 d; O2 Z
  38. #include <mach/irqs.h>' ~0 D8 \$ q  B4 G3 l
  39. #include <asm/hardware/edma.h>
    . R8 z* o; d5 R" |7 w

  40. 6 {* l: r- G" A: F
  41. #undef EDMA3_DEBUG) A6 h+ K* {& ?, Z6 G- V
  42. /*#define EDMA3_DEBUG*/: X& z2 d' z" Z! e/ ^, g

  43. ' I! Z% Q! F- F5 p
  44. #ifdef EDMA3_DEBUG& h, H2 j+ k7 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 c1 N, [9 N7 w& V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ `+ D5 Q7 l4 f! J" O- h& K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); v, z7 r4 a; I8 S) R3 l: z* W
  48. #else' V/ |" x( i1 f( N! z
  49. #define DMA_PRINTK( x... )
    2 n- u, H% z1 h5 h4 I8 K% F
  50. #define DMA_FN_IN* }4 {2 W7 t& k7 W% X2 i
  51. #define DMA_FN_OUT' ?  `! A1 ~5 R6 R7 R; O
  52. #endif; n$ h7 ^/ `- k# a

  53. ! C; x1 i! e- A, ?  L8 a+ ]5 j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* ]+ V5 W" x1 T* ]3 S
  55. #define STATIC_SHIFT                31 r) b0 {! A6 h' A- C% ^
  56. #define TCINTEN_SHIFT               20' A' u( W% R& R. t- A1 S
  57. #define ITCINTEN_SHIFT              21& {- l, M) f7 {
  58. #define TCCHEN_SHIFT                22; |) t- [4 {- x+ [+ F" ?
  59. #define ITCCHEN_SHIFT               236 N# @# ]. T/ [$ Q
  60. $ e7 m6 J7 Z8 t: o" j
  61. static volatile int irqraised1 = 0;
    # s2 K( n$ J9 c+ g
  62. static volatile int irqraised2 = 0;
    * M/ p& a& N6 N; l5 A! Y
  63. 2 M3 L8 Y. ^' I. u7 P% g: n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 }& I+ @, {  b! q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# n3 z9 Q$ x4 _  |  M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) K; c  c' Z. V# T

  67. 1 g) l* W, J+ D: T# l
  68. dma_addr_t dmaphyssrc1 = 0;# i9 N! {$ w8 d1 s$ I0 a
  69. dma_addr_t dmaphyssrc2 = 0;
    7 U3 w+ |* n" z) b2 i
  70. dma_addr_t dmaphysdest1 = 0;$ n8 h* S7 n. n' N# V* J2 @
  71. dma_addr_t dmaphysdest2 = 0;
    ( v$ }7 j) A* s, ~/ D! y
  72. & F8 m0 n. }6 E3 K7 S
  73. char *dmabufsrc1 = NULL;
    8 `8 c3 R7 T& P- ~8 o6 i
  74. char *dmabufsrc2 = NULL;8 x) t+ M3 ]/ N7 X3 F
  75. char *dmabufdest1 = NULL;. L2 @. |$ W# }- f; p+ ?$ p
  76. char *dmabufdest2 = NULL;# c/ `) _6 P# O$ v
  77. : `9 i/ |" C0 U1 i3 y" d, S& C
  78. static int acnt = 512;9 [! z3 W! b* K2 ?
  79. static int bcnt = 8;& ^0 S9 A2 M- ~6 a! ~6 s
  80. static int ccnt = 8;
    : G$ a9 N) H% D
  81. ; y6 E( B1 O$ e7 ]7 @! U
  82. module_param(acnt, int, S_IRUGO);
    1 E# n9 i+ r# M; _) p  Z9 Y
  83. module_param(bcnt, int, S_IRUGO);
    $ o* \3 [' u, q: L# v+ ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: w3 l! L+ O1 u! L! p/ {7 s4 G" t. ?9 t8 B  q8 k4 L: t5 p
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 f/ J' O; A; H. darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( w5 M. K  {# r
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
2 }# @0 I+ b& l3 T7 [7 Q: k* Y8 L9 s" {0 o" Z) p, y) g3 @3 v) [

* O, s% Y: _& ?8 A$ d
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 23:38 , Processed in 0.040327 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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