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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; N# U( a1 {( T8 @3 \: c
  1. [code]EDMA sample test application
    4 P7 F2 I! |1 Z* D% ~  p
  2. /*
    ) e2 ?! u& i* I9 D
  3. * edma_test.c
    # g% T$ ?' G, {! O* Y7 Y% d
  4. *, B" z8 C/ }1 [% `+ g
  5. * brief  EDMA3 Test Application
    7 k: `" F3 T0 g5 d* C, N
  6. *
      G1 j5 S. ?0 ]5 ^9 F! g' r
  7. *   This file contains EDMA3 Test code.* m" j' j7 b+ ~9 Q' |- ^
  8. ** O' J9 i1 K$ C; C6 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% m: ^/ E& t7 ^# o4 W: H/ ~! X* u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* [$ z: |% W: {, [# ?, [$ D
  11. *         TO CHANGE.( P* {  A7 M) f. ]8 O
  12. *' a4 M; `8 M% C2 I0 J$ [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " R. i/ ~7 K. g& P) z2 A9 K
  14. *
    4 g% |3 d9 D6 X6 _
  15. * This program is free software; you can redistribute it and/or" m. X6 W# o: {3 `, k) n, K: |) e
  16. * modify it under the terms of the GNU General Public License as
    + R, C9 Z9 a8 D3 s
  17. * published by the Free Software Foundation version 2.
      _& E( U6 @) ]) \+ n9 H# M0 [) y* H* \
  18. *
    8 }. Q  O( K0 \8 p6 u0 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 M9 B9 A8 a/ b6 c+ A8 U
  20. * kind, whether express or implied; without even the implied warranty4 `6 R# ^( [6 ]7 e; B) K  h# O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  Z1 f1 Z" z  ~% v
  22. * GNU General Public License for more details.
    + M% |& I, d" v$ V5 @, E
  23. */$ l! L4 @0 R' ^  `. n/ K3 q

  24. 2 e" e7 }4 x- f, S9 k2 ~$ h* ?
  25. #include <linux/module.h>
    + T' ^. P! S! X8 B/ N9 z' q3 v
  26. #include <linux/init.h>- s" T+ }) s) d- }. j
  27. #include <linux/errno.h>  |: h2 L" j! I; A  ]6 I
  28. #include <linux/types.h>. W$ j! \* v' e# ~0 B# v$ A* Z
  29. #include <linux/interrupt.h>
    1 _+ a7 A' l0 J" J! c% G
  30. #include <asm/io.h>" U& K  p: k% b# F: h; W
  31. #include <linux/moduleparam.h>
    $ c. E) a1 A5 E8 K) ~
  32. #include <linux/sysctl.h>
    8 m3 u- t' T) L6 Q: H+ ^
  33. #include <linux/mm.h>" P( r' y0 T! E) k
  34. #include <linux/dma-mapping.h>- F+ L4 i5 O* T8 h8 V" w: B
  35. 7 V% [. L0 w+ X$ I3 l
  36. #include <mach/memory.h>
    , H4 y/ d( @9 G, I0 G, E. g
  37. #include <mach/hardware.h>
    . x( S) Q  X# @. l& i, q* \
  38. #include <mach/irqs.h>6 m, \6 ?3 ^  T6 ]5 s% r
  39. #include <asm/hardware/edma.h>/ M- R7 y1 R6 d! e$ \' }0 u: ?

  40. ; u7 U# i2 n! t0 C6 ^% d1 `
  41. #undef EDMA3_DEBUG
    / m! H1 y4 W% N) C' E" g. l9 T0 }8 z1 J
  42. /*#define EDMA3_DEBUG*/% K+ |/ y5 R- f4 k

  43. ( @" ^, U8 O6 T5 j3 N9 L
  44. #ifdef EDMA3_DEBUG
    2 i1 B+ i5 F, R+ Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 P" C7 D% E  r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' |; ^; g6 W0 Z: h. x( K; k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " ~! z. x1 x( e& H
  48. #else
    2 L/ M8 p- B! [
  49. #define DMA_PRINTK( x... )$ b- c  g( d. U1 H+ d
  50. #define DMA_FN_IN& P7 l9 Y6 e* f" A
  51. #define DMA_FN_OUT! o3 z* ~+ V4 T& p
  52. #endif$ b+ ]& V& E: T2 p2 Z7 L3 q/ y
  53. 2 @& Z# l" ]9 s  G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 w, w9 h7 f; {6 _5 h9 g5 m0 I
  55. #define STATIC_SHIFT                3
    . y! `% e3 v7 z% t2 ?% k2 G+ W
  56. #define TCINTEN_SHIFT               20
    % L+ h% ^0 Y$ C) G& R6 u
  57. #define ITCINTEN_SHIFT              21$ O. z, `7 j% r% V# D. _/ n
  58. #define TCCHEN_SHIFT                226 {( Z6 E9 w3 Z6 g1 |1 D8 i& s/ j
  59. #define ITCCHEN_SHIFT               23
    ; B- G% Y: i' t0 o; r+ H4 P
  60. $ @8 X7 u5 m6 z2 ^
  61. static volatile int irqraised1 = 0;
    ; P  Q+ f+ h  e" n. G
  62. static volatile int irqraised2 = 0;
    . M7 D. ~" `9 W" ?, o2 j5 h

  63. * r$ r9 r# k5 ^2 n- G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ M! w- u' x5 R3 r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  E5 z' i* ?$ y& A+ ~9 s7 T. f4 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Y0 r' E2 R& U' a  M# Y

  67. ' }; i+ E9 |! j
  68. dma_addr_t dmaphyssrc1 = 0;
    + }8 n/ h( _" G3 Q: ]; M
  69. dma_addr_t dmaphyssrc2 = 0;& x4 l6 E! {/ J2 E+ C: u7 N
  70. dma_addr_t dmaphysdest1 = 0;1 H' g. P; s% `: z* O
  71. dma_addr_t dmaphysdest2 = 0;; L0 E* j  L9 ?1 U* A; @! D
  72. ( ^6 X" J# s. C$ j: K
  73. char *dmabufsrc1 = NULL;
    . i; H  @5 B! O6 Q2 w4 K6 r
  74. char *dmabufsrc2 = NULL;# I5 w) O9 B+ a6 L
  75. char *dmabufdest1 = NULL;
    $ b$ X& m& f0 Y
  76. char *dmabufdest2 = NULL;2 A1 @, O5 X: |/ }

  77. % f+ T( y/ m0 c! P/ n7 t% f2 a: y
  78. static int acnt = 512;
    $ ~3 v- m5 u9 c( D( K# {; F
  79. static int bcnt = 8;
    ) n; m* n, ~3 d+ ^" q1 X% N
  80. static int ccnt = 8;  W, _: x" v! T# O, k! }

  81. 3 Z' h- |7 C: B6 A' ^
  82. module_param(acnt, int, S_IRUGO);
    , d" O( \" p: s$ h3 X# e" P+ ?$ ]
  83. module_param(bcnt, int, S_IRUGO);
    # I0 ~- w4 h0 Q, F2 u. q1 D1 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 m/ _5 V' I; ~, j2 p" g$ o5 G
# n9 k$ Q' B& O; f% y, ~3 {. z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ D0 y+ Y: n: H0 ]arm-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 Y  B) E$ J6 p9 B/ Q' P' G- c     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& u, p" g! ?* y6 B; n7 S
0 y+ T$ y# q/ ~9 c7 h7 [. r6 F  P) y+ ?  X; H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 00:33 , Processed in 0.038336 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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