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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 Y7 |9 C# D% {0 {# O8 j6 H! |+ ^
  1. [code]EDMA sample test application: \, I: Y6 U0 t- c) h; Q, V- _
  2. /*. h8 ^* C. o* P( y
  3. * edma_test.c" N3 S9 H, _7 C. F$ B1 M
  4. *
    3 t9 F5 G7 ^) q. ]9 v
  5. * brief  EDMA3 Test Application
    * Z3 q7 r- c5 r) W. v' z
  6. *& \7 Q0 S; f1 Y" J& {6 K
  7. *   This file contains EDMA3 Test code.7 {' W8 K7 c2 l, z  \) ~2 d; {% K' s
  8. *
    6 W9 j1 m; z( j* H6 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . Y5 T! R- A$ B" p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 n) X" K, E. S% l: X- Q! B
  11. *         TO CHANGE.0 r4 E- ~! d3 E* |
  12. *& ]( P8 `; C6 |9 A* M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : m' R9 |- K* B3 }4 |# c* ?2 b! H
  14. *
    ! F1 k2 A$ d, Y7 G
  15. * This program is free software; you can redistribute it and/or0 x2 \7 {& N1 Q& m
  16. * modify it under the terms of the GNU General Public License as
    5 h. q; K! u1 }; J1 k
  17. * published by the Free Software Foundation version 2.. R1 S+ }: X& G$ O
  18. *
    5 E" s0 I- C! _& x& B4 ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# h# l# t& ~7 N1 f% J9 ]
  20. * kind, whether express or implied; without even the implied warranty
    4 \7 Y, ~9 K3 @1 u# T3 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 u+ w+ x4 T+ I; H9 ]. {
  22. * GNU General Public License for more details.
    9 `* p3 @% {! a* v' |
  23. */- V& V3 j: g; j" v2 s6 ?

  24. * k" @5 [5 c! D$ q, S9 s3 j+ p* @& x
  25. #include <linux/module.h>' u. c; X" K1 l0 C3 |- q
  26. #include <linux/init.h>
    " ~* ^4 k+ \' w- i! Q: A  ~
  27. #include <linux/errno.h>- `+ i6 r+ D1 ~
  28. #include <linux/types.h>" r, \& q6 b, F7 W
  29. #include <linux/interrupt.h>
    6 b7 Q% v. o- S
  30. #include <asm/io.h>
    ( A* E* x. g* Y# i) e- |
  31. #include <linux/moduleparam.h>+ R" y# V, F# W: u8 E" Z6 l  g! ?
  32. #include <linux/sysctl.h>
    - F1 l* N8 z2 y6 e# I  D/ O
  33. #include <linux/mm.h>
    , K( s7 b8 P- e7 Z/ I( v
  34. #include <linux/dma-mapping.h>1 G$ Y3 m. Y$ s. U

  35. & u: b/ k6 D" V% n
  36. #include <mach/memory.h>
    ) o8 a9 x$ p( e
  37. #include <mach/hardware.h>, x6 B, O/ t* }$ ?7 Y5 y1 {
  38. #include <mach/irqs.h>( W; h) u. l2 X# a" [' h
  39. #include <asm/hardware/edma.h>
    / v0 _4 A7 S: A! g2 C

  40. & h+ F: X$ C' c* ]
  41. #undef EDMA3_DEBUG# _$ s" M$ O; _0 l. r; ?: g, A! K+ g1 W6 e
  42. /*#define EDMA3_DEBUG*/  Y: o# W* |/ I. ^# ~+ S" W

  43. . _4 m- t: m6 S
  44. #ifdef EDMA3_DEBUG2 ]! W! Q  }3 C8 m2 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / H% k" }3 U' M, `2 v+ \& a: ?3 H' _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 f& Q( a; @* P. o& |' k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- [3 O, D1 n, Y2 `
  48. #else& z4 T: c( a$ e+ T' w& p! o
  49. #define DMA_PRINTK( x... )
    - g* Y$ Y! r& ^
  50. #define DMA_FN_IN# Z% D* z# J9 p# J0 J" A
  51. #define DMA_FN_OUT2 u3 S" C2 g, C" z& L+ m# H# D
  52. #endif
      l8 a. d4 a+ t3 o  q7 J$ {6 F
  53. ! G; z* B' y6 k/ e4 q: e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 I- N0 a  x$ Z% ^5 r& U
  55. #define STATIC_SHIFT                3
    8 P' f) B% S; {
  56. #define TCINTEN_SHIFT               20
    0 X  m0 E1 I& y
  57. #define ITCINTEN_SHIFT              21( p6 @6 f6 ~* {  I/ s# f# |
  58. #define TCCHEN_SHIFT                22
    : h) R- T$ V* V2 g$ Q% ~3 J1 r4 o
  59. #define ITCCHEN_SHIFT               23
    ' D9 b8 ~: y. g6 h: Y
  60. 0 j$ a& H6 F' ?: Y
  61. static volatile int irqraised1 = 0;
    ; @7 R; F) `3 K7 A7 `8 @
  62. static volatile int irqraised2 = 0;
    + h* @/ T) O5 |! c/ }6 U- i
  63. 9 d% M' o; s$ Y* _: g) X, k( V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 X, y: ~( m( [, C0 c$ \, r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 F6 @5 Q+ m( K& h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ]3 }1 B; U8 W/ b) V& h- v1 `
  67. 2 }9 i5 F2 o8 Y( n  r) _' ^, [
  68. dma_addr_t dmaphyssrc1 = 0;9 y8 a+ Q) f4 H) ^/ K5 T( r
  69. dma_addr_t dmaphyssrc2 = 0;3 k8 s& E% g' I
  70. dma_addr_t dmaphysdest1 = 0;
    : Y/ _- k. I+ \+ j
  71. dma_addr_t dmaphysdest2 = 0;, e) G# ]* ~. N+ c: E3 {
  72. ) B8 _% |8 r) k1 |  v* y1 P2 I" V
  73. char *dmabufsrc1 = NULL;
    4 a3 ?7 s0 n! Q' p5 u0 I" F
  74. char *dmabufsrc2 = NULL;
    1 T3 N$ S3 d; a# {9 |6 }
  75. char *dmabufdest1 = NULL;
    : l) U$ B8 u9 D) E' ?! G8 S0 l
  76. char *dmabufdest2 = NULL;# p4 [2 Y3 Y; ~5 G: s5 z* Z  v

  77. 3 J4 j$ K: @5 `. c+ J- d0 m. t
  78. static int acnt = 512;
    # ]# ?/ h$ C# x+ |/ k* O
  79. static int bcnt = 8;, D# d* u2 E. m
  80. static int ccnt = 8;3 E$ A9 ?2 C+ _* ^9 \9 H1 Z& Q

  81. ( ~1 F7 W1 ]$ y% D% ?/ y  g
  82. module_param(acnt, int, S_IRUGO);3 H8 f0 \$ \  [6 n) M! z! |: }9 X/ V
  83. module_param(bcnt, int, S_IRUGO);' r" j/ b1 ]$ S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& J3 D5 X# z0 b" m/ f: I
, [+ k8 {3 Z) R; Y! e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! }7 g" {) C+ S* j, ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 c5 J& y9 [8 S. D, [) t+ I; p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! Z7 n6 z3 O$ \8 v: Y7 i
) ]0 j" p  \; ~- t
* G$ D2 O6 i8 e: J% o- G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-4 20:52 , Processed in 0.046188 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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