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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ R! @# C0 L9 C! x
  1. [code]EDMA sample test application" x% m) {/ Z+ p; j
  2. /*
    6 \& ^+ X6 b* M1 c% `
  3. * edma_test.c+ o) u2 |3 F5 y+ h) k. l; S) p+ W- Z- i
  4. *( o% o8 n8 _& `( P9 e" c
  5. * brief  EDMA3 Test Application
    $ M8 Q8 N  j7 k# m/ E7 _0 l
  6. *
    7 I, i7 M- ?0 h7 \
  7. *   This file contains EDMA3 Test code.: V0 O0 ?( h2 C9 f2 J
  8. *  \" n, n/ z/ F, y+ p' g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 b4 h0 P! m2 }0 d! O6 D! ^' z  G/ }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 v1 t* O# o! z$ t! T/ n7 ]
  11. *         TO CHANGE.
    0 u; |7 \5 Y9 P0 G, v9 T
  12. ** M2 m1 }) `8 a, R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 `0 D% I: U5 l5 p: C
  14. *
    6 t, p" ?, V; x: q1 Q% F# H0 X
  15. * This program is free software; you can redistribute it and/or
    $ S: t% g7 F6 v
  16. * modify it under the terms of the GNU General Public License as
    " u) i# M0 f+ j* E3 o0 ?0 `, N
  17. * published by the Free Software Foundation version 2.& T! C# [/ K, P* [$ o
  18. *
    0 V+ Q) p" B$ [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 p! K% n' t* G; |- [
  20. * kind, whether express or implied; without even the implied warranty
    / I/ O' q, R6 h8 k2 [; @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' l, L* f3 s. X
  22. * GNU General Public License for more details.
    : q& |6 w5 e8 r3 x$ Z
  23. */: d2 q: c' c: q) x, z2 ?

  24. ) F8 I9 O9 W" y9 E4 }3 w5 |, G: \, Q
  25. #include <linux/module.h>% g0 E% B, A8 l( z& J
  26. #include <linux/init.h>
    9 N, U! i2 [; a0 r8 j1 l
  27. #include <linux/errno.h>+ l4 `/ n) {4 R4 Y3 M5 b3 q
  28. #include <linux/types.h>
    + \& v7 @5 E9 u" p$ e
  29. #include <linux/interrupt.h>
    - Y' Z: \5 f8 q# U
  30. #include <asm/io.h>
    8 t9 R1 |% P6 d  _
  31. #include <linux/moduleparam.h>
    $ r& a6 L4 o$ c7 y
  32. #include <linux/sysctl.h>
    " O0 p; A; M' F: g* A! J
  33. #include <linux/mm.h>0 i9 k/ N3 }! S8 z# A7 K
  34. #include <linux/dma-mapping.h>+ M! L( `; J' U: U0 Z
  35. 6 k/ Q) ~: M" z( Q, D/ {0 X' |
  36. #include <mach/memory.h>" i9 j$ |- t" ^4 f
  37. #include <mach/hardware.h>% J3 H4 B/ y$ s
  38. #include <mach/irqs.h>
    $ j7 m4 E5 c6 @, X+ }
  39. #include <asm/hardware/edma.h>
    5 ]9 n5 ^7 X% v/ U7 p1 Z7 z( Z
  40. 2 _' v* g3 ^: A$ U
  41. #undef EDMA3_DEBUG$ W4 ~% _3 |% K, y
  42. /*#define EDMA3_DEBUG*/
    : y2 X- H+ ?# |# `* f

  43. . F7 [1 B, q5 X
  44. #ifdef EDMA3_DEBUG2 V( E8 j: b4 B8 Z" @6 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& `- a7 j/ _4 b" k( G3 r7 y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; x' i* L; b* b; {* M! e( g( f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 e* K* [2 ]- W- f8 E* N
  48. #else
    9 I! f  [" M! n% U# d
  49. #define DMA_PRINTK( x... )) h/ z2 I% \( i" ?& B% V" S6 y" ^
  50. #define DMA_FN_IN
    # ~5 j, U2 u7 s' h. q
  51. #define DMA_FN_OUT
    0 |( A+ l- x, C4 Q. {+ B
  52. #endif! u! v. s8 d2 t& u3 G# |/ V
  53. , o9 q5 ?* ~. D0 ?+ j* s) ]: @4 o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( Z* e  n7 ~; k7 _! q) K
  55. #define STATIC_SHIFT                3  w+ H5 X1 a0 v; f3 N4 ^+ f1 w. j- q
  56. #define TCINTEN_SHIFT               20( b$ O. G2 O$ G3 y
  57. #define ITCINTEN_SHIFT              21
    ) e% P/ f3 S, C0 @& K1 [
  58. #define TCCHEN_SHIFT                22
    4 T2 k+ |( O! _) |8 ~
  59. #define ITCCHEN_SHIFT               23
    0 X8 `) S4 d+ {" l0 Z* U
  60. ; Q' b6 ^  V- [7 R$ x* `8 p
  61. static volatile int irqraised1 = 0;* r) e" f& \- F, Z/ d
  62. static volatile int irqraised2 = 0;1 B- R  H1 Q7 R0 V& W! J$ b" o+ J! z

  63. , S$ |5 Z& ~4 Q% `3 `- B& h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - c- o. ^& x( v1 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 `. A. g) B7 _* t2 ?+ L0 \0 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & V! t4 H3 e5 ^/ O4 m& Q! x

  67. 4 L4 m+ V+ h! Y- r0 S2 p2 k1 y
  68. dma_addr_t dmaphyssrc1 = 0;, i. k( \# N7 V
  69. dma_addr_t dmaphyssrc2 = 0;" ?4 U! D3 [/ k1 i( K& i( C
  70. dma_addr_t dmaphysdest1 = 0;
    : I& e* l# f- s2 ]1 y
  71. dma_addr_t dmaphysdest2 = 0;
    / U( @7 b- [6 R

  72. + w5 }) h  O6 }% |
  73. char *dmabufsrc1 = NULL;
    2 Y  M5 _5 A3 `7 |  y
  74. char *dmabufsrc2 = NULL;
    4 g/ u0 T; V7 z
  75. char *dmabufdest1 = NULL;
    + Z4 U" J1 ], @; J% W- {
  76. char *dmabufdest2 = NULL;1 A& y/ h9 x. o4 N% P( G# i2 f

  77. 5 r: q$ {$ K+ l! ^: E
  78. static int acnt = 512;
    8 z: |. o3 R% E" E
  79. static int bcnt = 8;
    7 h$ h6 L- o1 }2 s
  80. static int ccnt = 8;
    6 E& R& A: B5 j0 w. l+ X  D4 c4 ^
  81. . \" l5 J3 Z$ e$ I$ T
  82. module_param(acnt, int, S_IRUGO);0 k# e3 o9 N% b
  83. module_param(bcnt, int, S_IRUGO);: j3 c: A, l. U3 ?$ ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" R2 t3 m% W6 S, N) y1 i8 b( b5 O% S: s' |& y! @. S
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! E4 E" B* Y1 o  zarm-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 E: P# ]3 S8 R8 q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 `5 D1 L- v2 Y7 w  ^
% b0 W$ }. ^: y1 O* B6 {. |/ x0 G; `; k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-16 21:34 , Processed in 0.062688 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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