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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- ~' l' a7 {7 J5 i: N; W
  1. [code]EDMA sample test application" U& }/ L7 C( s* X
  2. /*
    0 ~! K, ^( _1 G' a  H- q' e0 q
  3. * edma_test.c7 N5 e- B4 D- k4 k0 E/ u& S
  4. *
    * J3 ~) z7 F0 M! V( S
  5. * brief  EDMA3 Test Application. M# ?: d+ s  r0 e
  6. *) P4 @8 b- B, q2 R
  7. *   This file contains EDMA3 Test code.
    : P8 I. Z) P$ L0 _/ F6 U
  8. *
    ! B. x) _' L2 P3 A8 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 L! _) W5 Z5 h) F# }9 f! k3 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 v3 u% m5 y6 a* b9 H6 c& j1 ~* q
  11. *         TO CHANGE.' Y9 G* l1 S  h  {. c6 z
  12. *
    5 r& m4 z/ `. y1 ]7 V/ {3 E8 B' ~
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  Q+ {. \! z! }( A
  14. *5 b+ a, v) G' v0 v
  15. * This program is free software; you can redistribute it and/or" _' H; A+ H! q3 l
  16. * modify it under the terms of the GNU General Public License as& c9 M* `+ }+ B6 e( }1 c7 A
  17. * published by the Free Software Foundation version 2.! d- ~% V9 o# w- M) i$ Y
  18. *
    1 C6 ?2 }" j* d! }) I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ f2 }  c6 z3 W: E6 F
  20. * kind, whether express or implied; without even the implied warranty
    + G3 w1 @! ]2 Y+ n
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " c+ S  `) G  j) M3 a
  22. * GNU General Public License for more details.. B$ a5 k3 P8 d* s$ q
  23. */
    ! ^- c( Z0 ]5 ?: m

  24. 7 ~4 d. P0 w1 D, g0 p' e
  25. #include <linux/module.h>
    $ k0 Y. A& r8 X
  26. #include <linux/init.h>" ~8 U; @$ F, l6 I
  27. #include <linux/errno.h>
    ! e( Y% n1 J- y
  28. #include <linux/types.h>
    , J; ?7 ?& y* A0 f
  29. #include <linux/interrupt.h>
    : ~! ^# R" ]% ^3 F# G; A) T
  30. #include <asm/io.h>
    2 p& f( s. c& V) Y
  31. #include <linux/moduleparam.h>: o! Y! ?, I. c$ a
  32. #include <linux/sysctl.h>
    3 W4 u" x* y9 y
  33. #include <linux/mm.h>. W6 d, d# ]) K4 P* o/ t
  34. #include <linux/dma-mapping.h>
    3 I- a% }7 s: ^3 N  N0 S' z' s' B

  35. : ^8 m! z$ R) h9 p
  36. #include <mach/memory.h>
    2 [% U( T0 o1 s5 f* f1 Z* [
  37. #include <mach/hardware.h>8 ], T# _+ N' ^( m3 P2 n$ N% l7 X
  38. #include <mach/irqs.h>, M) Q- H: n) v3 G7 g
  39. #include <asm/hardware/edma.h>, G6 K: Z8 j- S3 E0 V

  40. ) K: g/ N% |  V' A* N
  41. #undef EDMA3_DEBUG
    : \0 M9 l7 E2 [+ R# `
  42. /*#define EDMA3_DEBUG*/
      M( k- `7 E) q$ ~9 J
  43. 4 {6 R$ I4 y4 O3 B7 s
  44. #ifdef EDMA3_DEBUG9 Z9 n* {& U! E/ |& p2 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * D! A" ~" I  @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 [. y* Q2 F5 ?/ U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' a9 K6 M. m9 x9 G8 s9 x2 V$ b* N* u
  48. #else
    ; {% k! ^1 r" g9 |& a$ Z6 F
  49. #define DMA_PRINTK( x... )4 f. \8 _; R. a* y# d
  50. #define DMA_FN_IN
    + M- Z) Z/ v+ W. A9 v: ^
  51. #define DMA_FN_OUT
    / [* U- u, b- x1 M0 s' |: R' T
  52. #endif
      m; {7 l6 G" d5 [& P/ e3 B

  53. 7 {2 b$ ?3 I/ ]# }$ b% f' I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! Z* \- y  m# F
  55. #define STATIC_SHIFT                3
    * E3 N( p7 A8 D9 T0 `
  56. #define TCINTEN_SHIFT               20
      |( W" v( o- f7 J! m
  57. #define ITCINTEN_SHIFT              21
    % p3 M5 C- I" \3 w
  58. #define TCCHEN_SHIFT                22( |4 M4 Y  |% E& W3 C& D4 U
  59. #define ITCCHEN_SHIFT               23; f  c+ ]( L$ |! @/ @+ s
  60. ( _1 g" \% L9 z2 \$ d4 v, `/ B' Z  u: T
  61. static volatile int irqraised1 = 0;
    4 d1 G! m# ?, q/ t! K* T' U$ P
  62. static volatile int irqraised2 = 0;6 B: ?4 H; o& ^0 K! G  J, D  H

  63. * y- g* n- D3 d7 c. t+ a# O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 F' U$ i- X* P/ [# K8 X% A' {- [* E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " i: T9 ?( n9 n" q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ]8 m& k3 a6 v: l3 I
  67. ( b  k7 j1 W) K6 F
  68. dma_addr_t dmaphyssrc1 = 0;' r8 r/ D" q- D
  69. dma_addr_t dmaphyssrc2 = 0;: |5 i' X& P9 l5 P, G
  70. dma_addr_t dmaphysdest1 = 0;
      w4 ~, f+ i$ `
  71. dma_addr_t dmaphysdest2 = 0;2 x$ Y1 h& Q/ q- Z! f1 T
  72. * E6 e+ R9 Y: Y; a% ~3 D# L
  73. char *dmabufsrc1 = NULL;
    ' k; u$ A' b8 c4 r
  74. char *dmabufsrc2 = NULL;
    - _( t* T. o/ Y
  75. char *dmabufdest1 = NULL;
    5 s% E1 e9 E( V$ p
  76. char *dmabufdest2 = NULL;5 @9 \  V9 j5 v2 f5 a
  77. * i2 D* j  `6 S8 g- N
  78. static int acnt = 512;
    : y3 B& ~# u3 ~, q  Q$ O0 U
  79. static int bcnt = 8;0 v$ V: b, b% R; Q) P5 H7 b
  80. static int ccnt = 8;& g8 I) r/ B1 x4 ~0 w8 S" z
  81. 5 S+ e  j# q! e" I8 C: ?
  82. module_param(acnt, int, S_IRUGO);
    3 t4 Y7 q! z; @) \# j
  83. module_param(bcnt, int, S_IRUGO);4 I. u3 |0 D4 y" _2 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% s/ n: Y+ B6 ~" s$ e
$ V7 w# e3 P4 {) {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" f8 D! }; _3 ^, H- Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 n% \  S5 M# I* h7 E% N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% L( i9 D" P& l, K8 N* g
. x: x  x7 r6 Y  c8 x! q* ?  g1 e" q# ^6 J4 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-9 18:39 , Processed in 0.045609 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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