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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * w/ J* H* }" M$ J1 t
  1. [code]EDMA sample test application
    7 E1 A$ G) @" J; Y6 h3 D
  2. /*
    ) D# u, Z$ w4 z" ]5 q* _/ b9 h4 }
  3. * edma_test.c1 B: s' }: G4 `
  4. *
    ! D0 u2 t4 h# J( ?
  5. * brief  EDMA3 Test Application+ f  \/ m8 s0 _6 g+ Z: B, u
  6. *
    ) v  ^  [. f, A8 }3 D# u
  7. *   This file contains EDMA3 Test code.7 P% h3 |1 @5 p3 I
  8. *  C* P. i) e: s3 u. x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# q4 ^2 y* l- ^$ `8 M6 H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 ~% J) z; p/ j( ]* L% T: ~
  11. *         TO CHANGE.
    : N' G' q' @6 y' `" _" H/ M8 x
  12. *
    ! s, X$ S1 J$ G( _9 ^! [% d- a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    9 R3 c  b5 [: d+ r
  14. *' V; B/ P! {: P- Y+ g9 y
  15. * This program is free software; you can redistribute it and/or
    * |' G. U, ]4 K2 H/ \
  16. * modify it under the terms of the GNU General Public License as! g8 [6 m* s: u7 j
  17. * published by the Free Software Foundation version 2.
    / K6 ]0 h  P5 m- _! u# T+ X# e
  18. *4 z8 K# s! m: v& K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - u- o. m1 Q, C" h2 X
  20. * kind, whether express or implied; without even the implied warranty6 z0 p, y  D+ ~1 W8 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# b) r( X# L; A6 R' i1 u7 K; _
  22. * GNU General Public License for more details.; S  Z& u) J7 o7 R7 W
  23. */
    ( a' r$ q- |" ^* O# t

  24.   H  s5 y/ o; C0 ~
  25. #include <linux/module.h>2 ]; w/ L4 a) _* F& x; b, \4 N' o9 E
  26. #include <linux/init.h>
    " |6 X. f$ X$ G9 w$ W; b) E7 Q
  27. #include <linux/errno.h>" Q% F) m0 @9 O) i7 I
  28. #include <linux/types.h>
    8 c+ m  \6 e6 |$ m: A9 }6 d
  29. #include <linux/interrupt.h>; u8 [9 Y* T( D) d6 i6 C
  30. #include <asm/io.h>
    4 f/ A( ^& ]! Y; W5 \
  31. #include <linux/moduleparam.h>
    + H1 |0 S0 U! A( E' n8 j% E
  32. #include <linux/sysctl.h>
    0 X/ o3 E6 i/ e# q- K8 i
  33. #include <linux/mm.h>" ]% T% {6 g- g5 O: u
  34. #include <linux/dma-mapping.h>
    8 @4 m( P" }2 R8 c) K

  35. 2 W6 s4 p3 f* p. q: s
  36. #include <mach/memory.h>- l! M  B# j8 t7 a
  37. #include <mach/hardware.h>& H- U3 |0 ]$ u) |: w
  38. #include <mach/irqs.h>
    ) i; `, n& M' x
  39. #include <asm/hardware/edma.h>6 ?7 G7 ]1 u$ V6 E% H5 M3 R5 y

  40. 0 v8 J( l9 I+ P! a' a& d; u3 C: N
  41. #undef EDMA3_DEBUG
    9 W) T/ u9 P7 m' O4 F
  42. /*#define EDMA3_DEBUG*/
    & G. \6 [! A1 J8 ^2 x: B

  43. & c6 d8 `2 d8 h& i+ F( u; |
  44. #ifdef EDMA3_DEBUG
    " {. e; F; {5 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). x8 w' V* O3 }: k. i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" N* V9 v& n4 j' E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' @! Z# t( K' \: o6 x5 T( C! b5 w1 ^
  48. #else5 i  X; O+ B0 f- A; i
  49. #define DMA_PRINTK( x... )
    ' P, z4 a8 Y: E5 O( I8 W' }7 c: C. ]' z5 P
  50. #define DMA_FN_IN
    8 R( ^/ o# h# y, y- S. w
  51. #define DMA_FN_OUT' Z8 j" e- |  [/ B. _0 Z
  52. #endif
    6 Z3 }, I: u" I" ^# ]

  53. 3 A9 |$ o3 z( {8 Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); B7 u& v  b1 ]  d, ?1 D
  55. #define STATIC_SHIFT                3
    7 W- t* g+ n$ V$ P8 w
  56. #define TCINTEN_SHIFT               202 B. _; T. m; y! l
  57. #define ITCINTEN_SHIFT              21" A& t6 n/ k- b3 O# R
  58. #define TCCHEN_SHIFT                22
      P9 i) U, j" O5 \6 P) P
  59. #define ITCCHEN_SHIFT               231 R& S/ A+ s) g% T# `5 j

  60. ( ^9 l" I' F$ \; H$ z- b1 ]9 h
  61. static volatile int irqraised1 = 0;
    6 Y/ E5 B, z$ Y4 m7 U( N
  62. static volatile int irqraised2 = 0;& p; S/ H, ^  n9 A5 p7 Z
  63. 9 a0 s" a( \" }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 G& M7 G4 j6 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( t" o9 U  @! Q( T7 E/ b$ D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' [) _  U1 F; B2 o( @5 g

  67. 2 |. T8 r* e! r9 N
  68. dma_addr_t dmaphyssrc1 = 0;
    ) _. W" g' c  r5 j
  69. dma_addr_t dmaphyssrc2 = 0;* k1 G& u7 n7 n$ i. s4 D( I  e' g
  70. dma_addr_t dmaphysdest1 = 0;
    , W1 C- b& r- d9 C: u
  71. dma_addr_t dmaphysdest2 = 0;
    / y- c# n$ t5 p1 c4 L" V* [

  72. . z$ @" Q. v/ _; @
  73. char *dmabufsrc1 = NULL;
    5 E# m7 |* w2 R) c
  74. char *dmabufsrc2 = NULL;
    . O; Y8 {: e( [% G
  75. char *dmabufdest1 = NULL;3 y' [+ @( Z7 J# k) U% u' I7 {
  76. char *dmabufdest2 = NULL;! B" k* l* ]1 v
  77. ( S2 P1 w! D: f& r' \! r$ w2 c
  78. static int acnt = 512;
    : a) ]3 F# I6 _9 @) Q  X
  79. static int bcnt = 8;6 B$ ]. D9 v3 v; D' s( O% n- l' L
  80. static int ccnt = 8;; }0 P: V1 y6 l  ]

  81. ) W5 V# V" ?) ^( C) r/ h
  82. module_param(acnt, int, S_IRUGO);
    % ?+ B1 H$ p1 Y5 t( P) f
  83. module_param(bcnt, int, S_IRUGO);
    : \' g/ E/ C7 p$ P$ s) k, a+ o: U$ |! y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% b  s, U) r7 b3 O# w
6 v# i; ^9 {4 w, {) J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 F# F; {7 i. A: t! B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: l3 B+ p4 ~5 `( p1 f# y. r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" }$ k# T/ c  w( M8 Q# p' }' E% B$ G7 x; T. \
+ g& `* L/ n1 J9 I6 F8 W3 S4 j4 L# J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 22:11 , Processed in 0.043721 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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