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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 b7 ^3 @( J1 q
  1. [code]EDMA sample test application/ O# Q; U3 f. @% S0 c0 b
  2. /*/ L# S- P( ]) ~0 Q! V
  3. * edma_test.c8 c. @3 a- x4 C; u( \! ~  w2 q
  4. *7 [9 k# z- `- K
  5. * brief  EDMA3 Test Application- k. O$ a# G; R5 I3 U4 ?
  6. *+ \9 ?  p6 O9 [& q2 D
  7. *   This file contains EDMA3 Test code.
    5 E4 f' K4 r% `
  8. */ h  r/ K# F$ H* ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& |7 n* r$ u; k& w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# @. [/ j2 z$ t! Z5 W2 n
  11. *         TO CHANGE.
    8 D' S- }! V) s
  12. *
    8 D' |( P( p1 g0 X7 u, C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: x  Z' O2 x$ S' w5 Y' F- F
  14. *
    3 F& M$ H# Y" q8 b" i2 g6 Y
  15. * This program is free software; you can redistribute it and/or( M% O  D0 x6 }1 @4 u4 c3 R8 X
  16. * modify it under the terms of the GNU General Public License as
    : l& |) z# u8 [6 {9 O5 N
  17. * published by the Free Software Foundation version 2.6 m5 o4 n# ~4 I( K% u; ]! c" I+ Y
  18. *
    & i7 C8 o5 {7 P$ g, o; A) _" T: C3 Z$ U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ s3 S. \9 d7 F5 ?) Z0 U2 J6 t# d
  20. * kind, whether express or implied; without even the implied warranty$ e: y. }) ]: W; I3 [. l1 P) h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" N% @9 \6 Q. b1 m; H8 _$ _- ?
  22. * GNU General Public License for more details.3 n! ~1 f$ x' X, g1 v
  23. */
    , H* U& a: F1 {7 g
  24. 4 a# n. X% u) |6 A3 a" [$ _
  25. #include <linux/module.h>
    4 |- U8 u" d% v  m% l
  26. #include <linux/init.h>% A' n* @* R" M+ E6 I! _
  27. #include <linux/errno.h>; d# K' _2 O9 @3 G3 F
  28. #include <linux/types.h>+ J1 i5 c1 Y3 B+ K7 X; e) X
  29. #include <linux/interrupt.h>
    ; }' a+ S& t7 \& ~5 \
  30. #include <asm/io.h>
    . I0 i( m2 W9 I0 l; a* B+ w
  31. #include <linux/moduleparam.h>
      G# F1 w& V( A1 h' }
  32. #include <linux/sysctl.h># x' E! S' [. L( o% E# u# F
  33. #include <linux/mm.h>
    ( T) ~7 R# Z, r' u) A: @. L
  34. #include <linux/dma-mapping.h>. M3 |0 l4 ]# E; R% ~. y
  35. ; b: O% f7 b# }; X
  36. #include <mach/memory.h>
    # J7 u9 o, Z+ m8 z: k
  37. #include <mach/hardware.h>
    / M1 A; D' E  g: r+ f
  38. #include <mach/irqs.h>$ q/ t7 w' ^/ o0 p
  39. #include <asm/hardware/edma.h>
    7 K) q( G) t, T! P9 A  T( v
  40. 9 C6 B: `$ Z$ D# t4 A# s
  41. #undef EDMA3_DEBUG
    ! r% X8 \4 q+ _* P( Y: W, t
  42. /*#define EDMA3_DEBUG*/
    ' S8 \& @) _! X, c" f0 D3 i( |

  43. 3 K0 d. E6 t9 n6 o; q2 c
  44. #ifdef EDMA3_DEBUG
    ( M/ o8 K" M5 X- ]" o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 q4 j) f% w* g, V- i" e: W# L, n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! b: M& X! v7 f" }4 @4 V3 L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). {. C% i4 F8 R. M( H9 x2 a
  48. #else, w& ^% A% t0 S
  49. #define DMA_PRINTK( x... )
    - I6 N4 z- Z/ q
  50. #define DMA_FN_IN
    & Z) W+ s0 D, i3 w
  51. #define DMA_FN_OUT2 i+ D2 o9 i# J7 T* j
  52. #endif3 Q6 h" l' k. z6 l1 B

  53. 5 I# W5 J3 c; e& y3 N# @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" \( h0 G3 \6 ~
  55. #define STATIC_SHIFT                3+ p" F9 q* j+ n: d9 q& h) }
  56. #define TCINTEN_SHIFT               20
    ' x+ J7 A/ q& N! }: V; v
  57. #define ITCINTEN_SHIFT              21
    % M0 X) m/ k6 J
  58. #define TCCHEN_SHIFT                222 a( z. {6 ^5 `& a
  59. #define ITCCHEN_SHIFT               23
    ' B9 a' x+ |8 B1 {/ j

  60. ( ]( f9 f# C4 n9 v/ }2 R+ _, Y  D
  61. static volatile int irqraised1 = 0;$ x4 i3 _) b  x9 J* f: C! D
  62. static volatile int irqraised2 = 0;
    ; E0 b0 S2 E0 l" Z# n
  63. ; f1 R, s" I7 Z; Z7 ?& t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' ]% N7 A. A) P: ~- ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 L/ o) K2 M) n( C! r% x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , h# g, g3 ^, H4 D

  67. & g7 c! D6 L# n) m
  68. dma_addr_t dmaphyssrc1 = 0;
    , M) ^. }! a. V6 [( K
  69. dma_addr_t dmaphyssrc2 = 0;* Y' l% \2 z$ ]! m7 J: f' R; S' d
  70. dma_addr_t dmaphysdest1 = 0;7 B- J6 V% L, z1 C+ w, c1 c( A
  71. dma_addr_t dmaphysdest2 = 0;
    1 v! m; p+ `' n( O" Y7 h

  72. : N# J, ]' j9 G) Z
  73. char *dmabufsrc1 = NULL;
    + E! E' j) M3 l' @* E5 k8 ^
  74. char *dmabufsrc2 = NULL;) x$ U  U1 j, j7 Y/ O
  75. char *dmabufdest1 = NULL;; A- P( E0 A0 g, \
  76. char *dmabufdest2 = NULL;
    ) G) c2 j5 \. m2 Q" ^, I

  77. & G+ f$ G9 F. s7 M9 e
  78. static int acnt = 512;
    $ ]$ f8 a1 a7 i/ j* x  v
  79. static int bcnt = 8;* t. D! v2 F) u0 f
  80. static int ccnt = 8;/ i- d' L* m: Y9 m
  81. 6 S" w8 c* u5 g8 p* o
  82. module_param(acnt, int, S_IRUGO);! Z3 L" V: f  v9 P0 ^) u
  83. module_param(bcnt, int, S_IRUGO);9 s1 [9 d+ b( L- a' {/ Q2 j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 r& @: S7 o( B% L1 _  G1 [* Q" a' M( M  Y- k+ J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! |8 z5 O. j  Q1 x3 Q: R
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. ?0 h3 V; _- A1 x: N& Z& D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' L, l8 u% L4 a9 ~1 E& f# A
- v9 C' g) {& B" X3 `

5 y& g9 W. p6 e* K: [: `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 02:22 , Processed in 0.043012 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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