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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 @' U% Z+ R6 a
  1. [code]EDMA sample test application
    ! p" A5 ^; r5 o4 }) ?
  2. /*
    ( K2 s* n* \$ X7 g6 Z1 W7 V! f
  3. * edma_test.c
    $ j' K& d9 z2 @$ C
  4. *, v- N' n  s% D( ]6 j
  5. * brief  EDMA3 Test Application
    / A) h, J2 S0 r
  6. *
    7 x( G" ]- C9 W% R$ E# V
  7. *   This file contains EDMA3 Test code.
    6 k" Q& O- N1 e2 X4 T4 K# J
  8. *
    - @$ `: ^% O9 _( ~4 E; `/ E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 D/ a& h) A( B/ J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ ?6 D& U/ T; Z+ o1 ?
  11. *         TO CHANGE.
    " O0 {5 W- h  e; j& M
  12. *
    - o( J2 b6 J  q/ K6 }  m* |! b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 e8 _9 l- `. w
  14. *
    5 p# K* v: [  G) y: N% q) u+ R; j
  15. * This program is free software; you can redistribute it and/or
    8 ~* o8 A1 ~8 n! ^! p$ c& h8 U3 `
  16. * modify it under the terms of the GNU General Public License as
    0 m, o* O' b/ T0 _7 V
  17. * published by the Free Software Foundation version 2.4 [& }5 f; h) W; q) t+ W; _% L4 t
  18. *
    ! F+ ^8 C4 y" L" |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 }3 V9 s) }) L- p+ ]8 v5 p
  20. * kind, whether express or implied; without even the implied warranty+ S' X! k5 P; @7 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 H5 I5 [1 R9 Y; T8 c& U+ l
  22. * GNU General Public License for more details.
    : [8 K1 H4 @) v/ C5 c
  23. */9 _6 v# T# m3 l+ o' M

  24. ; J* w0 `7 K& {0 R% B/ m/ Y+ l9 Z. b7 }9 m
  25. #include <linux/module.h>2 ~% q5 @, g8 e
  26. #include <linux/init.h>
    2 B3 \  P8 K. a+ h
  27. #include <linux/errno.h>: ?% z! v+ {; |) \- g# Q1 [
  28. #include <linux/types.h>  |+ T5 o! D% Y( @
  29. #include <linux/interrupt.h>
      b% y( f. V* p6 i3 s
  30. #include <asm/io.h>( w( s2 R) s: a% q% W) e% s# h6 h
  31. #include <linux/moduleparam.h>& `3 I8 t; j, D( q  @
  32. #include <linux/sysctl.h>8 D# T; k0 {/ C3 _  L& j5 R9 [/ O
  33. #include <linux/mm.h>
    & s" u  s; f# G+ F4 I5 h
  34. #include <linux/dma-mapping.h>
    % V# }" h8 K; @2 a8 h
  35. ! q! s. e( L( t, k9 ?0 y( \! f- i
  36. #include <mach/memory.h>
    6 I+ r9 F& u- O3 S& a6 R
  37. #include <mach/hardware.h>. o" R  c* q1 E. e' D
  38. #include <mach/irqs.h>
    2 n; y( q2 ^$ ~5 u
  39. #include <asm/hardware/edma.h>
    8 e7 C* J; [' j. k; L$ Z8 l

  40. . V0 F% Z+ e  }$ v% P
  41. #undef EDMA3_DEBUG
    . O5 y2 e5 H0 K9 l3 v
  42. /*#define EDMA3_DEBUG*/
    7 N7 I6 R" Z& c/ Z" y& `
  43. 4 I2 G. g9 c% T9 d. }+ Q: p
  44. #ifdef EDMA3_DEBUG5 z  R2 f1 P# a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & a3 R0 E+ i9 @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / R; y" c, d9 J% R4 o. Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); Z+ |  k6 c( {$ b
  48. #else& r; M7 v' ?# c5 x" c. r2 Q# ?
  49. #define DMA_PRINTK( x... )- w6 o- C! l) b7 Q8 H6 P/ H: p
  50. #define DMA_FN_IN3 n0 V" d2 S/ Q! i# D
  51. #define DMA_FN_OUT7 Q' L& J( ^( ^0 u9 f- W* \, \
  52. #endif
    9 F) A, R" x5 Q" i3 W) x
  53. 6 Z! {+ O. X4 c5 a* g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 N! n. a, \1 t7 O" Y8 u4 ^
  55. #define STATIC_SHIFT                3
    ! w3 A! p4 F* g- |# ^+ v
  56. #define TCINTEN_SHIFT               20; ~3 N7 B- |5 J2 [2 g6 {" d& K
  57. #define ITCINTEN_SHIFT              21: j+ l# l* K; ]) X: a+ g; M
  58. #define TCCHEN_SHIFT                222 L) j8 \( [' L0 F' f- t- i
  59. #define ITCCHEN_SHIFT               231 N) D1 z8 u* `

  60. " W  ^( K( r* Z- j( ^7 f1 }7 L
  61. static volatile int irqraised1 = 0;
      _. A, m" u/ W- q
  62. static volatile int irqraised2 = 0;
    6 y# Q$ `6 v3 F" X
  63. & c9 T1 a2 r  l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 |4 P0 H. Z7 a1 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & U% I6 @; N& ^0 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 O" {1 W- L( K) O* b3 f) O3 c

  67. 0 I! F0 L! ?0 ~* v+ b
  68. dma_addr_t dmaphyssrc1 = 0;
    7 R- k, i1 V6 [- A; r# _5 w  @
  69. dma_addr_t dmaphyssrc2 = 0;3 q, {6 F" a5 u) K# ?
  70. dma_addr_t dmaphysdest1 = 0;* A3 `' ?# a7 C: p- E
  71. dma_addr_t dmaphysdest2 = 0;
    / M, E( y, o3 K. ?8 Z& i: A# |
  72. 4 ^4 X9 ~' J+ R9 V
  73. char *dmabufsrc1 = NULL;/ i, b8 X$ S( {: p" _
  74. char *dmabufsrc2 = NULL;
    / j0 Z3 Y2 h" E! \5 x) R2 s4 ^
  75. char *dmabufdest1 = NULL;/ ^  L' @& C$ S$ t3 q5 g
  76. char *dmabufdest2 = NULL;. M& C: U5 [  M  p
  77.   ]# U+ J6 q( v0 x8 f
  78. static int acnt = 512;+ ]. Y: O) F$ N; u
  79. static int bcnt = 8;- U$ T/ {' G' O- x
  80. static int ccnt = 8;( o  _7 H2 r2 R

  81. , S2 W" d3 h; \: m2 E' o% x
  82. module_param(acnt, int, S_IRUGO);
    . _5 Q( i/ i6 s7 c1 H
  83. module_param(bcnt, int, S_IRUGO);4 s/ G5 M9 ?4 v6 L) U% L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 |0 F, X" R: k# Y" d- f; T9 _

$ W, \- R3 B. S& c      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" @( b7 M2 R' ^" S: @6 x
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 L& G# F' |6 s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( A& b/ x, u' V+ ]( t6 a' g% v% E
* [1 a6 }8 f0 s3 M) j1 o+ ]( s# z0 K- V+ m  p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-24 16:12 , Processed in 0.041014 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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