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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ ^. |* t: M3 X' s* m% d- W, M
  1. [code]EDMA sample test application
    7 v4 r0 j  j$ d/ a& l
  2. /*; ~" w/ h( l, x& Y- X1 N5 ~1 ]7 e
  3. * edma_test.c
    6 s4 |" k% g, S- S  ]& P1 ]3 K
  4. *
    6 d- R! w2 w1 t, b& A7 a8 K, u3 N
  5. * brief  EDMA3 Test Application- o/ C% E4 S8 l* `1 b
  6. *
    $ P1 A7 b  K' ]2 D& f1 u7 k
  7. *   This file contains EDMA3 Test code.
    7 W( |& F$ w- h7 P- g# F
  8. *5 q* a( J" Q& [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ e+ n2 F; l& i/ u$ V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 X+ `; Y2 n) S. q% f
  11. *         TO CHANGE.
    * l, x- x$ Z* @% a8 J: U* D
  12. *
    : L5 u2 f, L- [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/  J$ J# R! w/ m3 ~# Q
  14. *
    / h: Z+ P( z7 t+ C2 K6 ^$ ]
  15. * This program is free software; you can redistribute it and/or) ~. a# r! C% H
  16. * modify it under the terms of the GNU General Public License as
    0 Q6 t0 C5 r# V: o* o
  17. * published by the Free Software Foundation version 2.1 V) y# w% C; P: S& w* y- [
  18. *5 A& p2 F% l7 `0 l/ w$ w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; _8 R8 G& d' ]" q- \2 G
  20. * kind, whether express or implied; without even the implied warranty. u" b& X+ `* s) l. U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  \4 j) H8 ?  `* s: l. J( \
  22. * GNU General Public License for more details.
    , E3 O3 g* h  y/ D7 h& k! V2 z
  23. */
    ) Q) |! h7 R& N0 ]! J+ k
  24. , b# a3 H8 g# T7 a3 L
  25. #include <linux/module.h>$ ?+ p" W8 o6 x6 F$ `3 C
  26. #include <linux/init.h>5 G: ^. W3 D1 o. q
  27. #include <linux/errno.h>
    4 o' a# v( _6 t& f1 a0 ]7 [% ^
  28. #include <linux/types.h>
    + z% l8 O" c- N5 b0 d0 O& U1 _% X  b
  29. #include <linux/interrupt.h>
    ! O5 f! D8 c/ R  l2 h# I
  30. #include <asm/io.h>! i3 o% b) M6 o5 x, N& Q! u! p
  31. #include <linux/moduleparam.h>
    . e' u& z8 v" \
  32. #include <linux/sysctl.h>3 }, L3 V- {- R% h  r1 a+ s
  33. #include <linux/mm.h>0 m2 N- k, m! @; g6 f0 S( a
  34. #include <linux/dma-mapping.h>
    3 N& B- l+ t& [! A! D# z

  35. * a4 y  T- t+ ?% \9 y; G
  36. #include <mach/memory.h>
    / R+ y- _3 ~( l3 N
  37. #include <mach/hardware.h>" r4 E# ~$ }# p$ t2 E: L
  38. #include <mach/irqs.h>
    ; `( M. ?# B1 s7 u6 H( G% S/ c
  39. #include <asm/hardware/edma.h>, Z" L3 G, Q: M# h+ \
  40. 3 R/ B& J8 T3 ^1 a
  41. #undef EDMA3_DEBUG- i+ Y+ t+ Z' Q
  42. /*#define EDMA3_DEBUG*/
    ; E5 X, n( r' G4 s) [
  43. 1 H% _+ K1 z  |6 o8 d" A7 I
  44. #ifdef EDMA3_DEBUG9 ~) @/ s' g3 w# `$ J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; B! j/ V8 A; i% b# C0 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 N* K9 a' G# V/ g  |, ], ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ N/ Q9 L% S+ K- D! O2 \6 c
  48. #else6 X+ [. l( R7 F( z
  49. #define DMA_PRINTK( x... )
    0 ?: b/ _% H8 n  i
  50. #define DMA_FN_IN- Q. w% d; c8 G
  51. #define DMA_FN_OUT: x# Q; r/ M1 A
  52. #endif# m1 {, Q5 R% d# r7 `- P

  53. ; z* v6 W, E/ B3 D: B( p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% }8 X7 h+ v/ ]8 h: A1 a
  55. #define STATIC_SHIFT                3
    " \* i8 W' C* [# F: y/ E1 J6 w
  56. #define TCINTEN_SHIFT               203 Q) j  Q  o* Q1 A( v( b
  57. #define ITCINTEN_SHIFT              218 r. [2 }( z7 |$ X7 q, z) z
  58. #define TCCHEN_SHIFT                22/ C! m, S9 I' W0 j' Z; @- Y0 V
  59. #define ITCCHEN_SHIFT               23
    $ S+ b$ f& I" e  p" |/ H

  60.   Q7 J! a) Q& i4 h
  61. static volatile int irqraised1 = 0;
    8 C5 P  A3 I3 {, ^
  62. static volatile int irqraised2 = 0;% b& [2 [6 U* Q% `% B, S; `

  63. % @! v* X: s$ Z1 _7 y0 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + {- g/ d( K$ x, R9 |% y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . O. F4 j  u) o. B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & @, n3 G. O+ U9 b7 c/ B; S) X* x% x
  67. % b+ v, e/ p3 [+ q
  68. dma_addr_t dmaphyssrc1 = 0;. |3 O- k2 Z% r* e9 h
  69. dma_addr_t dmaphyssrc2 = 0;
    . N8 o* Q; W; B6 B" Y2 z5 m2 Q
  70. dma_addr_t dmaphysdest1 = 0;$ c* u: T. W/ U. {
  71. dma_addr_t dmaphysdest2 = 0;
    / G. Y/ @& ~/ P
  72. ) e) \! P3 P% |2 D$ ?
  73. char *dmabufsrc1 = NULL;
    . B+ d1 q- T3 }0 [. z
  74. char *dmabufsrc2 = NULL;
    : e9 |4 a4 A/ O& u# J9 p
  75. char *dmabufdest1 = NULL;
    ) {, M& ^0 ]5 R. o: u0 J: k
  76. char *dmabufdest2 = NULL;
    0 Y  O; ^. y" }% s2 L1 n
  77. * M; z" H) ^) V- K+ V2 Z4 E
  78. static int acnt = 512;
    " N) `6 [6 H  N; m. z* B
  79. static int bcnt = 8;3 {0 x# H, t) V& D* c, j5 s" }) I
  80. static int ccnt = 8;4 X9 b% p  {; T7 j+ H+ G) I# Y5 R
  81. # ]( ~4 M( w8 `
  82. module_param(acnt, int, S_IRUGO);
    $ k" i3 `+ I; {
  83. module_param(bcnt, int, S_IRUGO);
    % S0 A, n% N! x( S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& Y  Q% R7 E  ]* }) D! d& T' P- |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 \) b/ S* W' [  T6 a
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; Z' \4 ^+ v+ x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. r5 S6 y, p5 d- u
; d/ d5 ~# R2 Y8 {$ J% _- k
% M# x1 \8 b1 h5 y; A0 d1 G/ K( l$ O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-19 20:16 , Processed in 0.036717 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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