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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # y! ^7 S) }/ T. n
  1. [code]EDMA sample test application
    5 L' p0 F# c9 W( a" c% U
  2. /*- N* N- Q9 V4 r6 |* H2 d$ |
  3. * edma_test.c
    & h! T( I( a* |+ N" ^4 c/ X
  4. *1 W7 |# }% c8 j$ T( ^' K, U
  5. * brief  EDMA3 Test Application: u) R' U* _1 j2 r% k
  6. *& b3 l+ _1 n3 J
  7. *   This file contains EDMA3 Test code.: h; Q7 G9 |% |! H2 c/ W8 J
  8. *
    ( r' l8 E8 l$ h$ W8 {% t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) F# {$ O" v/ r+ w+ a2 C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 Z5 }4 o- R+ _1 R2 q1 @7 S" J5 H
  11. *         TO CHANGE.
    ( X( D' K$ ]1 u, j/ ?% j9 [
  12. *
      Z) n7 N$ M2 g2 d( B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) ^, e) m0 X8 m9 K2 ^
  14. *5 u% L' s) s- X8 r
  15. * This program is free software; you can redistribute it and/or# O( S& D4 W8 |: v1 D) a
  16. * modify it under the terms of the GNU General Public License as" M9 C* g$ s* [2 t& z7 u
  17. * published by the Free Software Foundation version 2.
    5 B: i6 h. G$ m7 |4 m9 G" w% Q4 u
  18. *6 ]$ X2 g! n6 ]0 `' a* w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: `2 k& O* _' y- b
  20. * kind, whether express or implied; without even the implied warranty. L" O2 c" R: `/ ?, l2 @$ w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 ~1 ?% t; H+ z) R; n
  22. * GNU General Public License for more details.
    5 n5 t3 Y, Q  j1 j7 q* |  x
  23. */- l( Z( l  {+ F

  24. # k3 H0 b- f4 C$ _9 W
  25. #include <linux/module.h>
    : Z& u2 I8 i, L0 p9 m: e) S  H
  26. #include <linux/init.h>
    + d& E) e7 g5 l  @9 g" [
  27. #include <linux/errno.h>
      K- P/ b& o( I. `8 Y1 c
  28. #include <linux/types.h>
      y$ I! n% D( O' [
  29. #include <linux/interrupt.h>
    % r( H: v1 h5 g- Z8 l5 \
  30. #include <asm/io.h>9 x' I! K% Y) ], S* _6 c6 V- y
  31. #include <linux/moduleparam.h>) m7 _& l6 q# c  Z3 ?& ^' p0 r
  32. #include <linux/sysctl.h>
    $ M2 Z$ m1 N: G6 s' _
  33. #include <linux/mm.h>7 ]+ ]  o2 W* x1 m5 o% a
  34. #include <linux/dma-mapping.h>* t+ s* [1 ?) u4 x
  35. 1 @5 d& X/ ]0 a; \9 {- Z+ K
  36. #include <mach/memory.h>
    & n' m! y; |9 w* J9 P: z
  37. #include <mach/hardware.h>0 N$ g1 D2 m% L# c
  38. #include <mach/irqs.h>
    2 z( H6 ]; J4 W7 A  Q5 Z; G
  39. #include <asm/hardware/edma.h>
    * w) M4 {9 p( J# }) E! ~% V

  40. 7 N, r7 V/ i$ J! t4 t
  41. #undef EDMA3_DEBUG
    7 n4 r  Q9 {# X. x0 J
  42. /*#define EDMA3_DEBUG*/
    4 n* E/ L6 t( @: I. a' c& d, M; X
  43. 2 L7 q* H6 Y7 d6 }( Z% g+ H
  44. #ifdef EDMA3_DEBUG7 M$ H6 J1 S! f9 K* w- E* \" d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). ^# B, N) f$ M" Z5 ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# c+ R: W; Y9 }! o- ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): J9 \1 f& A% m8 f0 B/ F7 u% J
  48. #else; G; F9 }. }3 R0 N% R) M$ C
  49. #define DMA_PRINTK( x... ): c. p8 T- h- a& L$ _
  50. #define DMA_FN_IN. Z( W% v" ~" D, Q! `5 \) m3 b+ ?
  51. #define DMA_FN_OUT/ [: j2 o! I$ }
  52. #endif
    ) o2 y7 D: s  [( A+ m

  53. 6 U3 I6 l9 e" i8 t, r0 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% L5 a. o) _% w4 b' F: ^2 n( j
  55. #define STATIC_SHIFT                3
    $ f0 P4 x4 V/ w" i* b
  56. #define TCINTEN_SHIFT               20/ m8 T# `( o: z: k  V: g
  57. #define ITCINTEN_SHIFT              21, R, t7 o: f$ |. ?" x0 F
  58. #define TCCHEN_SHIFT                22
    ( ^6 P4 X' ^- m
  59. #define ITCCHEN_SHIFT               23
    * E9 `9 @4 Y; Q3 o, @
  60. 4 v: E/ m; o% a/ [  [9 N; h
  61. static volatile int irqraised1 = 0;) U6 G; |" S0 q& Q: n9 b
  62. static volatile int irqraised2 = 0;5 K( C, N8 f+ ]  a$ U4 J# m
  63. 4 S) i9 s% ?. a4 p5 g# Q) M0 x+ h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ^$ b& p3 \; o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 ]( N% H% h7 `3 c( R! V- M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 ~2 E8 m& M! X. S$ o
  67. ' k5 c0 r% d' K5 R0 F: D3 s' \( n
  68. dma_addr_t dmaphyssrc1 = 0;
    , M- o! u. S/ W
  69. dma_addr_t dmaphyssrc2 = 0;& @5 S/ Y$ Y% @- N8 D
  70. dma_addr_t dmaphysdest1 = 0;) Q( y! A2 _! ?  T
  71. dma_addr_t dmaphysdest2 = 0;6 C: @% X5 M- U: Y

  72. 0 p& I/ ?8 U1 [1 h% O; S% \2 Q9 d0 A
  73. char *dmabufsrc1 = NULL;* ^. j  f/ D6 w1 l
  74. char *dmabufsrc2 = NULL;
    3 ~$ N/ e' {" h4 _7 B6 I
  75. char *dmabufdest1 = NULL;
    $ a. h- ?( L) I& z6 d1 Z4 x
  76. char *dmabufdest2 = NULL;; Q" |2 v; w/ o. P" i

  77. $ g- C# I' G: G5 p
  78. static int acnt = 512;
    1 q  a4 H; Z1 d2 v
  79. static int bcnt = 8;1 ?( i7 i  Z- W( c  s
  80. static int ccnt = 8;
    9 _5 h, D9 |; }) C( Y
  81. " }# G4 v- \# M' d; _) \( b( G2 m
  82. module_param(acnt, int, S_IRUGO);
    & F% j8 _! h3 D% A
  83. module_param(bcnt, int, S_IRUGO);
    8 [' `1 d' r1 h5 X8 L9 V6 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ i9 s- Y  t2 l/ d

4 k7 z4 U) N9 S* s! J. X+ Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' |  l- @+ t9 ]2 c
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; R* {3 C4 B5 r0 D9 @( _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  H. ?& {; m6 w8 w; M, m

, A) X+ F0 H8 N- W
( q% ^+ F. R0 f% g! m2 y$ a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-21 03:34 , Processed in 0.039819 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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