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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* x7 {2 ?8 d4 P% W# b* U# |
  1. [code]EDMA sample test application
    " O' N( n: r' t; L) d& a4 Z" ^
  2. /*  E- X$ v/ o  u5 w
  3. * edma_test.c* j& P, {2 p4 j! |  S* t9 i7 }
  4. *  x4 e. Q- C/ j$ G9 o
  5. * brief  EDMA3 Test Application
    . ?4 `1 m0 Y: o' p
  6. *7 n7 G8 d# L2 [; c% k
  7. *   This file contains EDMA3 Test code.+ ~4 n. K8 I8 k8 n. ]
  8. */ X. l4 M$ T- ]5 Z1 v  O
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % \. X6 e2 w9 l. Q' x7 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; }" ?* k$ r$ t) J: O
  11. *         TO CHANGE.8 L4 a) a+ p6 P
  12. *2 C, R- v) r6 [+ e( D. e3 {0 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' X! {% N  [. T! _
  14. *" K( i! Q% G+ f' p
  15. * This program is free software; you can redistribute it and/or( ^1 k( [% i; \" b  D
  16. * modify it under the terms of the GNU General Public License as
    5 n/ O; y8 c6 A- ~$ t- D9 `
  17. * published by the Free Software Foundation version 2.
    " \% m% d3 A: a$ x
  18. *4 C/ v; N) ]7 n& ^8 m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- s% C- K  P1 V2 ?7 ~* {
  20. * kind, whether express or implied; without even the implied warranty4 @5 N2 _' k/ k- L  V& ~# F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; x# S+ Q% ~3 H4 e3 k4 B
  22. * GNU General Public License for more details.
    . B3 g' P- j$ N; Y, A
  23. */' [' U, I" y2 A3 P& l( e

  24. # P. Z3 Y) i+ T
  25. #include <linux/module.h>
    # l+ k7 `; S" e0 z  T; x
  26. #include <linux/init.h>
    5 O/ Z/ u$ @  }5 n% B& o- f
  27. #include <linux/errno.h>
    9 s3 ?" ]( R- S
  28. #include <linux/types.h>
    & z8 F+ P2 X  L! z3 g% v
  29. #include <linux/interrupt.h>* h5 d) E- ~; H$ a: t6 F
  30. #include <asm/io.h>
    $ h. `; ?3 E% [
  31. #include <linux/moduleparam.h>: N' t7 v# y2 Y/ ]7 x: `
  32. #include <linux/sysctl.h>
    * y% T' k- b8 t# T% K( _8 D+ z; Z5 D, H
  33. #include <linux/mm.h>
    . E! s4 c# S# Y% w
  34. #include <linux/dma-mapping.h>
    5 ~/ O, L1 ~" _
  35. , `7 F& D( Z* f7 i; S
  36. #include <mach/memory.h>
    1 Q3 p: q8 f5 A7 W8 a! X
  37. #include <mach/hardware.h># S) F$ Q/ f: [2 A# ]
  38. #include <mach/irqs.h>8 Y) n! R) l, j* q: Y! A7 q
  39. #include <asm/hardware/edma.h>; v8 a4 Y$ X8 a- m: H5 l

  40. ; }+ b5 q6 W: L/ S) d$ F
  41. #undef EDMA3_DEBUG
    " Z* Z6 l- \, U; h
  42. /*#define EDMA3_DEBUG*/
    1 T/ \/ N: ?+ h+ D/ S

  43. 4 \% L: @  X# G3 z8 h6 A
  44. #ifdef EDMA3_DEBUG
    - q1 V0 ]/ A. l4 u$ Y8 W4 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " K( F+ d* @' u4 d6 v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( H5 E; k) E3 O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; D6 B5 W! _* y) P& A2 x$ @) o
  48. #else
      W6 a  `/ F1 g, J2 w. @# _
  49. #define DMA_PRINTK( x... )
    , `* `( V+ c. o! }5 U
  50. #define DMA_FN_IN
    / Y! M7 S% N5 U  q* T; `+ s, \2 B) x) a
  51. #define DMA_FN_OUT
    7 Z- `2 l$ O" \  K1 Z
  52. #endif
    + i3 D( p/ j2 l, }, c

  53. ; V( N# ?' \, r* Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ t. A8 N% h2 B# ?) ?
  55. #define STATIC_SHIFT                3* Q, r+ t$ G1 k6 B3 R2 b
  56. #define TCINTEN_SHIFT               204 Z" O, |  Z: K2 }9 r) u1 P0 s
  57. #define ITCINTEN_SHIFT              21
    ! G& i* B2 j+ x+ ^! w
  58. #define TCCHEN_SHIFT                227 H4 h/ T  c# P& S
  59. #define ITCCHEN_SHIFT               23
    ! v6 \3 W: g( Z$ H3 d8 n) P
  60. ) m7 o) E# \  Y! _! q
  61. static volatile int irqraised1 = 0;% T! J  v# w" z( ?, P: Y
  62. static volatile int irqraised2 = 0;
      O- G. M5 V/ B8 c, d+ T
  63. 4 ]- K, h3 r/ V) _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 S) N; @) k: Q9 T  J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 {' z+ t- p+ F5 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 T: N5 m4 m0 {' b0 X8 [

  67. 0 C9 }- ^# s- }' ?" q9 K
  68. dma_addr_t dmaphyssrc1 = 0;
    - f+ _2 d6 f' e5 o: {- H
  69. dma_addr_t dmaphyssrc2 = 0;
    ' D0 z9 W2 d3 m* G" a
  70. dma_addr_t dmaphysdest1 = 0;
    + W7 I1 R/ z1 r5 ~2 A
  71. dma_addr_t dmaphysdest2 = 0;4 m  S' t3 F8 E# r

  72. : s$ H) m6 E. U4 \
  73. char *dmabufsrc1 = NULL;# |- x/ l2 X9 f( B" f+ C8 v$ U; b6 o/ b2 f
  74. char *dmabufsrc2 = NULL;- e9 {$ e9 ~: k9 N0 ~# j* x
  75. char *dmabufdest1 = NULL;1 N9 i( S' Q% o/ M
  76. char *dmabufdest2 = NULL;
    0 P+ N3 {! T2 A2 t1 T
  77. " x7 |+ O" U" ~$ Y3 q
  78. static int acnt = 512;
    ; ]  e* ^* [- v8 Q1 L% p
  79. static int bcnt = 8;) d# z; N6 [2 q; o3 b' l% m' Y! N
  80. static int ccnt = 8;
    ( G" j! C3 o7 A* @/ B& R

  81. $ s% d8 y3 R: f
  82. module_param(acnt, int, S_IRUGO);. T# x# f% g# g) N" z) `. t
  83. module_param(bcnt, int, S_IRUGO);
    - f2 e4 U& A! x3 U# \1 A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 |: B4 F$ k0 E  l  \
9 X- w" H  o5 J; Z+ H  @* N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 `' a0 X6 j3 \, m+ z6 [: x# K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 P5 @9 A& n0 v& n0 y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 h1 p% M2 G: g' u; _8 Y$ K+ J, b

$ ], K+ H/ F; O% I! m( c% d
0 @/ `! Z, Z0 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 22:28 , Processed in 0.049189 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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