OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# P1 a$ u( O' v' e/ m! S
  1. [code]EDMA sample test application  d) K( H" y. M
  2. /*3 C' S0 h4 N: |5 V( U
  3. * edma_test.c
    / m: T$ P$ O7 F' R3 r: s
  4. *
    ( _' Z$ ~3 y8 y9 I! L" ?* b( ?
  5. * brief  EDMA3 Test Application
      w1 H; T1 M# I
  6. *  @! n, |& \) e# r$ _; K; L
  7. *   This file contains EDMA3 Test code.
    / s* [; f% S5 z9 }. z9 L; N4 C
  8. *
    4 A4 S& T* A$ G& a0 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! ]2 [& [9 o9 u3 `! E$ u0 N
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 W- @* z  C; F) C
  11. *         TO CHANGE.( ~% P2 t6 E; E0 M3 }; ~# t/ \
  12. *
    . t3 g& E3 G2 d& j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! a: T8 z/ r. n  U$ B/ b$ d
  14. *$ |5 N0 k3 n$ q! j0 v* X
  15. * This program is free software; you can redistribute it and/or5 |5 J8 ], }( v2 h3 U, d, p
  16. * modify it under the terms of the GNU General Public License as3 v6 t! Y) U( h8 P- h* m0 u5 ?7 C
  17. * published by the Free Software Foundation version 2.
    6 H" o* Z& c9 o/ Q, \
  18. *2 _2 Q5 b. r9 r4 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      x( O) b  @4 W/ v+ V) ^
  20. * kind, whether express or implied; without even the implied warranty! r$ W9 w8 B) {) F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 m2 o6 V  L& t8 O& V
  22. * GNU General Public License for more details.2 ?. g5 G9 g9 c9 H. g, }1 z
  23. */: r. ^) y  D8 f( a& R, i1 `- w

  24. 0 _% B1 _7 u7 @# j; l
  25. #include <linux/module.h>8 m8 K' m! P4 Y6 s
  26. #include <linux/init.h>
    + A, G( n/ Q0 _: ]  B
  27. #include <linux/errno.h>
    7 k5 d; C6 ~- r5 q5 j; W& ?! s0 K
  28. #include <linux/types.h>
    * o( ?! {0 Z6 w
  29. #include <linux/interrupt.h>
    0 U- K8 g* |4 d6 M
  30. #include <asm/io.h>
    ' _1 r; c2 T. f( t
  31. #include <linux/moduleparam.h>
    # `. p* i0 g- N! `, U8 v) J
  32. #include <linux/sysctl.h>9 [% o. w5 C6 A' o* h
  33. #include <linux/mm.h>+ F( Q; F& {( K* p( t7 C- Y0 q
  34. #include <linux/dma-mapping.h>
    5 y9 s! ^; P, d2 T* m6 `

  35. + ~3 b0 s$ R* ]6 g  G/ e4 _; I
  36. #include <mach/memory.h>
    3 D3 }- H* V6 @6 H
  37. #include <mach/hardware.h>
    ' s6 e" ]% e6 z+ `: j
  38. #include <mach/irqs.h>
    9 u5 J1 s$ i6 a# B! H) m3 _4 P
  39. #include <asm/hardware/edma.h>
    9 e! z* `4 C7 z+ K0 I, y9 n$ ]( j
  40. 2 v  ^$ {2 d4 u! ~% [
  41. #undef EDMA3_DEBUG
    * t; r0 h; |1 M3 [; ^+ h
  42. /*#define EDMA3_DEBUG*/2 {( R$ C; P( O: r
  43. ( Q! G4 E6 A9 a
  44. #ifdef EDMA3_DEBUG
    ' u* Q# v# J, m  y  R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 |6 P6 C% n8 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 {3 O8 G+ q/ v* O' H$ q9 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; w' x2 _( g0 h; f
  48. #else6 I! F7 i3 ~4 [% D8 j
  49. #define DMA_PRINTK( x... )
    1 N+ K1 o! W4 g
  50. #define DMA_FN_IN
    & v' K) Q: r3 z& J+ [! B7 P
  51. #define DMA_FN_OUT
    ' v; s& t; E" e5 ?
  52. #endif
    $ j- c. ^; s! t# l- `3 @

  53. 3 ?4 N. D0 i& v1 e9 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# e1 z& u1 X, _# \; D6 u
  55. #define STATIC_SHIFT                3
    : C. Z7 o3 ^- p5 w$ s' c
  56. #define TCINTEN_SHIFT               20
    ' C  I/ H3 N3 I$ L7 C6 q6 {
  57. #define ITCINTEN_SHIFT              21
    + m; K: E6 [% ^& x' a" Y& B' p
  58. #define TCCHEN_SHIFT                227 m+ t: b  l( ?2 n
  59. #define ITCCHEN_SHIFT               235 c  e0 @7 ]0 }) n1 ?, @
  60. 3 _3 R; L/ F" n  \* C7 q$ D
  61. static volatile int irqraised1 = 0;
    ! h) ~2 R: a: D" M
  62. static volatile int irqraised2 = 0;( Q  R. g( Y& f: A) l! \$ `, T* L
  63. * P+ J6 Y5 }4 ]) @9 E5 o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + i$ Z# Y  J2 B6 F) N1 f# U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) N8 s9 W% ]* K/ o5 d2 `) h7 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 K! m2 u) b4 e6 s3 w7 {
  67. 3 d/ u$ a, \5 n( Z
  68. dma_addr_t dmaphyssrc1 = 0;9 o" t5 d; P, T$ v! x5 L- h6 p4 p
  69. dma_addr_t dmaphyssrc2 = 0;- o, Q# a  k9 N& o& {
  70. dma_addr_t dmaphysdest1 = 0;  i, x  S3 E/ ~! C. C
  71. dma_addr_t dmaphysdest2 = 0;' @: P7 Q" y2 w

  72. # w' D3 p$ ^* p
  73. char *dmabufsrc1 = NULL;6 r  v* a) X3 Q, A# f& Y7 A
  74. char *dmabufsrc2 = NULL;( k: J" W" U& u" J3 ^  k' [
  75. char *dmabufdest1 = NULL;
    9 `4 e, ~3 z" Z, n3 v8 [
  76. char *dmabufdest2 = NULL;
    0 D3 J$ i8 p5 O, B
  77. 5 D/ ~& D% b7 L$ F
  78. static int acnt = 512;* X1 r( |0 f* {7 g! D# ^# Y" ~+ w
  79. static int bcnt = 8;, E' R7 D6 ^1 ^
  80. static int ccnt = 8;: P! K1 e# h6 g. |% }! L

  81. 4 m9 K9 k+ m. Z4 n  I
  82. module_param(acnt, int, S_IRUGO);
    6 v; W7 f# }. S$ q8 D* H" e  n
  83. module_param(bcnt, int, S_IRUGO);6 j. Z0 p! g$ q  t9 }) e6 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" B0 U, o- M% M3 P+ c1 J! Z* R% q) b% E! C2 z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- G2 A7 f% s' D/ l. C; Y
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 E: b+ L: K" _/ k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 R. D3 |+ E! s

4 [% H) k( x% V8 Z: ]/ ^) r8 {) s6 C; c" z* C, w$ |- ]; l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 07:36 , Processed in 0.037903 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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