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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 h. J% b# Y8 a
  1. [code]EDMA sample test application' e- j8 b) N6 F1 u* P+ N
  2. /*9 t' j. H) n5 n. W, i
  3. * edma_test.c- c  a! I0 G' s' D
  4. *. [8 l5 ], A4 J1 R) Z2 `
  5. * brief  EDMA3 Test Application* z! ?( O! O: I+ A! o9 E
  6. *
    1 A/ v6 p8 b) c) |2 A. q6 e
  7. *   This file contains EDMA3 Test code., S/ ^) j; v& w# j
  8. *
    6 m7 r2 F. @, X$ N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 ]* W; u2 Y7 U/ Z( i  T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( \6 J5 E) `2 r# y# y
  11. *         TO CHANGE.& o* o% h- O8 t
  12. *
    4 _7 o) f, `, o1 x/ W+ \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 d7 \2 E+ b$ \" m6 `; j
  14. *
    , Y7 o! {! f9 `1 S
  15. * This program is free software; you can redistribute it and/or
    + [5 S! [" _% ]3 |  X
  16. * modify it under the terms of the GNU General Public License as) {2 w+ `' g+ \  k7 W
  17. * published by the Free Software Foundation version 2.
    / ~, y: }+ q* h7 d
  18. *) F$ X$ q6 j! P9 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 O# U4 B% Y- \- o% E3 r
  20. * kind, whether express or implied; without even the implied warranty
    ' p8 A! I9 Y/ y6 s' g5 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 a/ \- v  g3 L& z% p3 G
  22. * GNU General Public License for more details.2 p4 ?1 V. v2 @1 m/ J
  23. */
    - \+ c& i, Z- T  v  `

  24. ( ?( p) y" v  h4 R
  25. #include <linux/module.h>
    5 w4 R" s0 G$ f
  26. #include <linux/init.h>; ]. a3 y: l2 ^9 @8 D& o
  27. #include <linux/errno.h>* |8 t3 Z0 {6 D$ d) C/ M8 i+ j
  28. #include <linux/types.h>4 |6 F! a9 l0 N6 ?3 L. h
  29. #include <linux/interrupt.h>2 Z8 l& j& R# j, v- v: U) k4 d
  30. #include <asm/io.h>* w5 O( x' K' G- T' G
  31. #include <linux/moduleparam.h>
    # A' p4 \8 D3 f5 g& w! a8 w9 H
  32. #include <linux/sysctl.h>& p& s- N, R# W% }; z0 T
  33. #include <linux/mm.h>7 l8 ]( d5 @! ~% o  m' s' k# K
  34. #include <linux/dma-mapping.h>. v* \+ b( p4 o  L0 n9 \7 O/ y
  35. 3 b1 p4 u0 F4 B$ u9 e
  36. #include <mach/memory.h>
    - @' z' f3 M) k; S( w
  37. #include <mach/hardware.h>' y: _  {% y5 f! U9 T1 A# s* K) Q
  38. #include <mach/irqs.h>
    6 M: z& C$ i+ X$ Y
  39. #include <asm/hardware/edma.h>. W. E' r( U& o

  40. % y1 |8 F8 x+ S  l7 a
  41. #undef EDMA3_DEBUG7 w7 h% m# m' \6 ~0 o9 _# x# E
  42. /*#define EDMA3_DEBUG*/5 G- ]! |8 f- I2 r3 H9 y0 s1 V

  43. # J* I' C/ x2 u  e0 x
  44. #ifdef EDMA3_DEBUG
    6 U7 v" d- Y  V2 b3 I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* [% w* A4 M1 n: @+ G! a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 q6 t- |% q! l0 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ A& |" m0 U$ y0 B2 m1 M
  48. #else8 X# c! g" e3 d( x9 b; w
  49. #define DMA_PRINTK( x... )& e9 p: e2 j8 G+ ~3 t
  50. #define DMA_FN_IN) m' s- A* G( Q# W2 F
  51. #define DMA_FN_OUT5 x  X. E' v, Q/ f
  52. #endif
    . Q- d- ~: o' M5 I

  53. 7 b: e6 j4 t1 m" w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . {. l" p6 K4 ^! I
  55. #define STATIC_SHIFT                37 m, S/ m3 y8 d# Z
  56. #define TCINTEN_SHIFT               20/ j9 @9 [2 \6 z$ J( W
  57. #define ITCINTEN_SHIFT              21! n' x3 A0 g, [8 b4 `
  58. #define TCCHEN_SHIFT                22
    ' m$ Y: @. {, D5 }  T
  59. #define ITCCHEN_SHIFT               23
    8 N: N9 _  I+ p5 A; ~2 [" y* E

  60. ; v0 l2 r# r1 M& g
  61. static volatile int irqraised1 = 0;
    1 T/ R  o5 b5 H3 T
  62. static volatile int irqraised2 = 0;6 d2 u$ l0 `! I7 w) x
  63. ! l: l: N5 G+ ~, s" y% q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# X4 j% q0 \; u* q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; S# V+ L1 [0 ~. L+ o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( N0 V' W# s" v2 r0 l
  67. 7 N4 N* o- W9 @8 [2 P/ t8 g
  68. dma_addr_t dmaphyssrc1 = 0;' R' V/ f; j  \: s" ^+ O2 ~0 J7 g0 o! ^
  69. dma_addr_t dmaphyssrc2 = 0;
    5 e- r5 u4 m* }) H+ a" E7 R
  70. dma_addr_t dmaphysdest1 = 0;
    . G/ e. t: t( G9 v4 u% H9 y
  71. dma_addr_t dmaphysdest2 = 0;' q8 b- o1 F; W& x

  72. ' m' Z7 G4 M* e# d
  73. char *dmabufsrc1 = NULL;
    $ d! o1 M0 W& M" v& E( L2 r
  74. char *dmabufsrc2 = NULL;
    ) V9 F) x5 Z! I5 A2 s
  75. char *dmabufdest1 = NULL;0 _+ o6 y3 M% s3 n
  76. char *dmabufdest2 = NULL;
      k, m% g' y0 i& \4 o

  77. " w" j2 P4 B$ ]3 ]- \
  78. static int acnt = 512;
    ( q1 G; z& k$ D$ U+ [! }" w
  79. static int bcnt = 8;( {7 J& S  ]: B
  80. static int ccnt = 8;
    ; U5 F9 @7 b5 L! t+ S2 w/ j6 ]0 [1 j
  81. 9 c  T" z0 `3 [" T
  82. module_param(acnt, int, S_IRUGO);
    0 s7 ^0 R. d  N* }; L
  83. module_param(bcnt, int, S_IRUGO);
    1 D% r/ e, L: b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: |0 U' o0 x% R& @
! P. V, t+ S" S( t. h! X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 V1 b. X( x. M6 ^1 }( `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 J1 B7 r) v, s. u& z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 @& i& }* x: u# h) ?7 y: o( _. C8 \3 T/ M* J1 w

) r' {4 j' C& g7 d7 V7 v: w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-27 06:00 , Processed in 0.036108 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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