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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 6 G% g* y) v0 h; e$ d  C" y! l
  1. [code]EDMA sample test application
    - \+ H7 T6 j, Z) C: N2 i6 m7 H$ N
  2. /*
      O: T" a! w# }
  3. * edma_test.c  J: }1 e0 |6 k- [
  4. *
    4 O, S8 ^# f: \& D8 W9 B
  5. * brief  EDMA3 Test Application
    7 z/ _0 z  I4 \+ T- E
  6. *, @/ U: l' S6 ^+ {" I/ `: }
  7. *   This file contains EDMA3 Test code.
    ' U5 @& }* H) ]* x5 j5 Y
  8. *
    " h& X' V( H; ^, p0 s  O3 D3 T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 N% N2 d5 M* I/ F7 U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      P3 c; v! v, |; e6 v
  11. *         TO CHANGE.- L# l( W7 y/ p; a
  12. *
    & v7 {) f% k2 _& f* h& ^8 V1 |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ i$ M, w' w# i( O( S
  14. *, |: x2 D( D8 g' L+ Y6 N4 M6 @( \
  15. * This program is free software; you can redistribute it and/or8 |  R7 `- g0 b* B3 Q+ L6 Q4 a
  16. * modify it under the terms of the GNU General Public License as6 N; t- s* f2 ?* \# k& n/ |" Q
  17. * published by the Free Software Foundation version 2.
    9 n5 H9 v/ m- m: [% |* B
  18. *4 C2 ?8 l, h7 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 ^. D$ |/ i3 L
  20. * kind, whether express or implied; without even the implied warranty& X/ R4 k( [$ {1 S# b5 P& O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 w; V: {+ @9 d0 a1 t; L7 F3 g
  22. * GNU General Public License for more details.
    6 b% u3 _6 Z( g- _" @$ {
  23. */
    3 q# ?+ W% }4 B* ^6 F2 }+ a5 B5 L

  24. ' c6 V9 [4 I' Q" s1 m  o
  25. #include <linux/module.h>: _) z; y8 `' P6 x5 {8 A% n2 V0 U
  26. #include <linux/init.h>
    $ \4 H+ E# L5 N
  27. #include <linux/errno.h>% u7 U5 |3 D1 F5 ]4 U, y2 P
  28. #include <linux/types.h>
    . R. i0 q. v0 _! v; n; q4 i' F
  29. #include <linux/interrupt.h>+ {2 `* s% r: f, i: m9 R
  30. #include <asm/io.h>1 I  I0 g4 z* K. U
  31. #include <linux/moduleparam.h>
    , v+ W. l( ?0 A) J/ E% }( U
  32. #include <linux/sysctl.h>
    & F2 U- h$ v( F& {5 Y7 _
  33. #include <linux/mm.h>7 Y& s8 m! K1 J! O) w. d
  34. #include <linux/dma-mapping.h>. U4 e+ P- q8 c: |" i; [% x

  35. 2 H9 A! O; e3 s# t! o; v  }% }) X
  36. #include <mach/memory.h>- ^+ d8 y+ B+ g( h6 u
  37. #include <mach/hardware.h>4 W$ S1 @5 T! f* e$ f
  38. #include <mach/irqs.h>
    % b6 }7 ]3 l: g/ X/ z3 v$ E
  39. #include <asm/hardware/edma.h>* ^" f  h, i, `/ Y( k9 L7 k: H! `
  40. 9 A+ G; R% v* R" e. c
  41. #undef EDMA3_DEBUG
    , {: B# N/ @) j0 z8 M" D
  42. /*#define EDMA3_DEBUG*/
    & ~/ c2 V( D/ G9 _5 Y  t

  43. # {1 c/ q" h( ]. t# |# x" ]
  44. #ifdef EDMA3_DEBUG
    ! o& _' g7 U' W) V# J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 I, z/ o" g. v5 h1 ~- p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ v# t5 [* g3 f6 d" C( l, m5 c) |* {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : R3 p* T* N9 R& v( H) K
  48. #else: p7 E0 c$ t. y4 _  X
  49. #define DMA_PRINTK( x... ). N9 N% m) O2 ?" l- w/ }& \$ [% b
  50. #define DMA_FN_IN$ S3 I4 @" y) W2 Y: x- J4 @
  51. #define DMA_FN_OUT
    ! ]3 s' j& p3 |( h8 ^& o
  52. #endif
    7 o; F- L+ |6 q+ B

  53. - M. C4 z/ J+ [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & {3 S+ R# p& w0 N1 \# G
  55. #define STATIC_SHIFT                3, s7 C. W2 k/ t. H6 `
  56. #define TCINTEN_SHIFT               200 @6 I" t: |7 O' S
  57. #define ITCINTEN_SHIFT              211 ^5 F% g* }' U8 z5 D' o& S; f
  58. #define TCCHEN_SHIFT                22
    ) o0 R$ N, C6 Z! x! W, I+ M  a
  59. #define ITCCHEN_SHIFT               23
    * e) s1 R( G! x9 Z$ x" ^" u: Y
  60. 4 f1 T" C: a1 [
  61. static volatile int irqraised1 = 0;
      [1 F" e. N; b% a3 |; Z
  62. static volatile int irqraised2 = 0;# t2 t  ?2 D) t3 L2 y/ q# f
  63. # Z; v/ y- ]  _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " _3 @8 \; q6 n- S0 |: J4 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ m6 E$ X# N  `8 k6 ^0 \6 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: Y! _' t9 z) o7 z% Q. x: A
  67. % n) }4 G) @5 f, _' x* \6 a. n: p
  68. dma_addr_t dmaphyssrc1 = 0;
    # B2 p  _' Z' T% v6 Q' Y
  69. dma_addr_t dmaphyssrc2 = 0;" Y! D5 U. o8 q: q* [
  70. dma_addr_t dmaphysdest1 = 0;
    3 u' c- G; O1 B' r
  71. dma_addr_t dmaphysdest2 = 0;& N( I! E5 R( J3 |  e$ {

  72. $ i" V6 W; ]6 X5 Y# F' E
  73. char *dmabufsrc1 = NULL;# W0 q( ~& b& U# X
  74. char *dmabufsrc2 = NULL;
    & Q* M; u: a* B0 H0 T4 P
  75. char *dmabufdest1 = NULL;6 d, d  d5 W" [8 c& y9 d, h
  76. char *dmabufdest2 = NULL;
    8 |# S+ A$ ^, n9 p

  77. % s6 G, L% L/ E' V( W/ @
  78. static int acnt = 512;
    0 F, F# [& \7 @' B6 X
  79. static int bcnt = 8;9 M* K; F% Q- Z
  80. static int ccnt = 8;
    9 u/ F+ G4 ^' _, i

  81. : ^; X# f+ ^: U3 V0 L# z' B
  82. module_param(acnt, int, S_IRUGO);
    $ |' j. c/ Y) u4 s4 y2 d+ X
  83. module_param(bcnt, int, S_IRUGO);4 L* {  P5 N% q$ V% o7 h7 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 w8 K) J5 |) m
0 Y7 O! w& C3 n: V3 }
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, M: G; X9 s2 l1 K9 {8 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ k. s6 O) a+ T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% N2 I6 g: _4 r% _) S

1 ^) t8 t! `: M! r) F# j1 T) ^5 O* Q  q/ g( s' j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 04:48 , Processed in 0.041571 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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