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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
+ B; T( E5 Q2 ^1 G5 n$ B: Z' R
  1. [code]EDMA sample test application
    # \4 @& u4 G3 W9 \7 B. _
  2. /*6 v1 |3 Z: ~: _- Z# M6 a2 Y; j, n
  3. * edma_test.c
    ' R+ ^9 U+ B' m, K! M; o5 t1 ?
  4. *, Q) ~; n! T; G: e* i1 k9 _
  5. * brief  EDMA3 Test Application  C; Q9 c8 W* D8 `
  6. *
    , {- X; G" U8 |+ q; b: C8 l7 [
  7. *   This file contains EDMA3 Test code.# w/ B0 a1 I/ \5 J
  8. *4 Z; \7 N9 Q$ q2 a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. a' d2 t" t( O9 k* y" M: W3 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; }7 }6 p$ ]$ {
  11. *         TO CHANGE.7 r( u5 E- v' c! ]5 Z: ^( S9 v
  12. *$ z! B7 p$ H6 c( k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ \' Z' O. o! J; m! J- ]8 Y# x5 B( A
  14. *
    % T) r& ^5 R+ O* q0 W* ]
  15. * This program is free software; you can redistribute it and/or
    7 ^" g. {' u6 C
  16. * modify it under the terms of the GNU General Public License as
    ( F0 v6 G5 X3 y
  17. * published by the Free Software Foundation version 2.$ A8 }5 G7 k4 _) {* C7 ^
  18. *0 c8 f0 j( D2 s- A2 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : ~! ^* m1 ^2 r3 C
  20. * kind, whether express or implied; without even the implied warranty4 S: e, z9 [, L$ ^- ^) x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- U* R- q0 A7 e7 |3 k
  22. * GNU General Public License for more details.9 Z) i5 B8 l; ?' b# G/ e7 R
  23. */) [6 ?, n, K3 K2 u" z

  24. # C6 W  p# u1 ^$ p4 h
  25. #include <linux/module.h>( u: h! _1 M( e" y4 }1 O: ?
  26. #include <linux/init.h>
    ( g. m9 q, y( f) L% d# H
  27. #include <linux/errno.h>
    ) o/ X6 Z. N, h
  28. #include <linux/types.h>
      {" F9 Z8 g/ j5 a/ z3 m
  29. #include <linux/interrupt.h>8 D' }* y3 n' \* D( G
  30. #include <asm/io.h>
    * B; U* W5 [; x6 v$ t  l7 r
  31. #include <linux/moduleparam.h>+ T  z0 l% X" N0 x; Y( U6 M( h
  32. #include <linux/sysctl.h>
    $ s# ~5 u0 h- y( x  |
  33. #include <linux/mm.h>( k+ b5 K) H$ u" Q# m
  34. #include <linux/dma-mapping.h>/ x" X! {) y2 b: Y( W
  35. ' M, I. x0 u" K1 e# L) {7 ~8 _
  36. #include <mach/memory.h>( W9 M9 g/ D- q$ x7 a
  37. #include <mach/hardware.h>+ {) }, V) L1 l# I0 }! U
  38. #include <mach/irqs.h>. a* H0 l! e; F% E! n( T6 i
  39. #include <asm/hardware/edma.h>$ x9 \6 d1 i$ [

  40. + I8 U( M# ?! r' ^% m
  41. #undef EDMA3_DEBUG
    " L/ b* K/ ~6 p/ F% y1 X4 _$ Z
  42. /*#define EDMA3_DEBUG*/
    % t7 j& `# c  a$ q; _4 X- D
  43. 2 N# c2 |% q, n1 o" T- J
  44. #ifdef EDMA3_DEBUG$ D# v6 _/ b, u* K( g3 x2 b" Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)" C4 ?) x" U; Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 T* b0 z# R* v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* ~. ]6 o! D/ T, z
  48. #else
    # b1 B* \5 k" W: K% o
  49. #define DMA_PRINTK( x... )
      g5 `+ S+ y/ S8 P6 i& r- B  ]
  50. #define DMA_FN_IN/ Q( J4 }. G4 B# C9 C" q; \
  51. #define DMA_FN_OUT9 M2 t/ e/ T  f
  52. #endif
    1 d5 V# Y& Z' c
  53. ) U& M, B8 ?6 K2 h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / B# \0 N  I7 g! K1 T+ y% b
  55. #define STATIC_SHIFT                3
    4 x7 \" b8 P4 @( i
  56. #define TCINTEN_SHIFT               204 u9 m6 g$ E/ }8 m5 }
  57. #define ITCINTEN_SHIFT              21
    5 v4 m- f! d% S3 N' x5 @
  58. #define TCCHEN_SHIFT                22
    2 {3 o; s% }! m
  59. #define ITCCHEN_SHIFT               230 ~$ C3 J% R* @) ~6 S

  60. , m" Z9 n3 }4 a$ v1 Z
  61. static volatile int irqraised1 = 0;4 q" ]; I9 z8 U! ?( H5 Q+ K
  62. static volatile int irqraised2 = 0;
    % r, _& ?) d; c: l8 Y5 N

  63. 7 A$ P5 {- L" z9 q8 q/ P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ^9 G* Q9 J/ y  R/ j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! P! C) k% D+ a  L* n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! B+ Q: Y/ D& T$ f

  67. 8 d' W; D; _2 m: U7 q; ^
  68. dma_addr_t dmaphyssrc1 = 0;; e5 c  v4 P" D; p, S3 a
  69. dma_addr_t dmaphyssrc2 = 0;& Q/ l4 Z) }7 A4 z
  70. dma_addr_t dmaphysdest1 = 0;! e/ E7 |1 L- g8 a- ~  z: J. {
  71. dma_addr_t dmaphysdest2 = 0;
    # G# ~; |9 M4 T* B8 R: V; g, y4 j
  72. ; Y8 ]8 f6 G- m- _8 B9 [, P0 h
  73. char *dmabufsrc1 = NULL;
    1 o$ B) Q& i# g: B8 V% b
  74. char *dmabufsrc2 = NULL;
    , U8 B7 y$ z- M3 a& ^3 Z3 p' T
  75. char *dmabufdest1 = NULL;
    ; {! k8 N  x* S0 u
  76. char *dmabufdest2 = NULL;; x8 D, L7 y. b0 ^- I$ U1 K
  77. ) {/ s, N; b, e+ z
  78. static int acnt = 512;$ [( x) v/ P1 j) ~/ Q
  79. static int bcnt = 8;" T/ h) p( a: z* q1 f
  80. static int ccnt = 8;
    5 G* k1 Q3 {) J6 r8 E

  81. 1 n5 ?" I# S7 N- h# u/ b5 I
  82. module_param(acnt, int, S_IRUGO);& @7 T: q. S$ L+ I
  83. module_param(bcnt, int, S_IRUGO);) Q/ V' W3 ^3 o; x% C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 e1 z% A- N5 M7 V  ~9 z  s5 X% I

1 ~! R; b) Y/ C7 V) f& @! w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 N/ w; f/ {* r+ D9 sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" w' C8 h) h% |$ r, C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ H& k' C& r; c
5 b6 U8 ?: f2 T4 h$ x
2 B! x5 n. L0 P# ~1 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 00:39 , Processed in 0.044028 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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