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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : K7 u% U% \; z+ ^
  1. [code]EDMA sample test application, F8 n1 }! h: \2 N: g$ S/ I- E
  2. /*
    9 a& r6 F& y# m2 z4 A# n
  3. * edma_test.c
    : L3 {% R8 }5 R1 @# L: f
  4. *
    # X$ _3 h9 l: T% @- X5 n5 M% a
  5. * brief  EDMA3 Test Application
    / h# e% B7 b8 s3 |, X$ U4 R
  6. *
    9 ^' M1 Q3 n* }8 [) L2 m
  7. *   This file contains EDMA3 Test code.- }3 X( T% i+ [& J* W6 V1 U
  8. *1 O* H+ H/ s: S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, C, K/ e! z8 F- R. N: t
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # I$ N. k5 j) O+ N( H$ i! L
  11. *         TO CHANGE.
    ( s* d; w- t& e* O
  12. *, G6 [; D: @( \$ T2 _
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 `2 C+ A9 z0 H" c5 E  a; B
  14. *0 O) ]6 r$ D' x/ E6 l" e  [
  15. * This program is free software; you can redistribute it and/or
    % l, J. z' H4 q4 B, S& x
  16. * modify it under the terms of the GNU General Public License as. Q, i! S' O% S  J7 \2 [. z* Z
  17. * published by the Free Software Foundation version 2.
    ( b8 g! G, X: `% O3 V
  18. *' }4 q7 r. \$ x* X+ C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' x" M% T, e5 _( J2 ^
  20. * kind, whether express or implied; without even the implied warranty
    / Z7 O: {- D! z( g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# W% R) q2 `% ~# ~+ ~* J6 _
  22. * GNU General Public License for more details.; }. d( G0 h" G3 I0 |/ c; w4 t  q
  23. */0 N3 t" r6 O9 P5 d: `/ ~" o. e
  24. 7 h; o1 o8 Q6 K
  25. #include <linux/module.h>
    9 ?, Z/ F3 q3 n1 J  l( g
  26. #include <linux/init.h>; {6 x( F4 \- d5 v2 a
  27. #include <linux/errno.h>
    9 l3 g6 ]* z0 Y5 i& U
  28. #include <linux/types.h>" }9 D& U' i' I
  29. #include <linux/interrupt.h>
    7 N- c7 {# R* V( A! l- C
  30. #include <asm/io.h>
    $ l$ G) T5 z# q2 w
  31. #include <linux/moduleparam.h>$ m$ y4 G( H# c6 x: T7 h" ?9 u
  32. #include <linux/sysctl.h>% u* n3 l. V: D' }, |7 ?
  33. #include <linux/mm.h>
    6 o) q5 [4 t  Z  V- Y% n
  34. #include <linux/dma-mapping.h>
    0 L6 M0 c% W. b# q) m6 G& ^

  35. 3 }9 `& [$ P5 [- f( i3 h2 Y) E
  36. #include <mach/memory.h>
    ! C8 J4 d3 B! b0 [, C0 q
  37. #include <mach/hardware.h>
    / v8 y; v& b6 h
  38. #include <mach/irqs.h>) @" K( E3 R! n# ^  h% }, H+ s5 @
  39. #include <asm/hardware/edma.h>
    5 K# `& {5 Z5 ^9 M3 x7 ~* ?+ h

  40. - `4 F% l. }" m* X
  41. #undef EDMA3_DEBUG
    : j, ?5 Y% {( L8 A, S- s
  42. /*#define EDMA3_DEBUG*/6 c, L* @. A3 z" I0 }
  43. $ A& _) }: E0 r3 U" V
  44. #ifdef EDMA3_DEBUG5 B3 U$ J" N. Y$ D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ R. d# ]* z) Z$ S+ b8 C( Q2 f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 m+ _% ~* N7 Z) b' X. T% F8 c) N: L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)/ f7 V1 |. g9 G7 ~
  48. #else$ G% `5 @$ T  ^2 }' {
  49. #define DMA_PRINTK( x... )
    1 C/ `6 P$ P7 F
  50. #define DMA_FN_IN
    1 o, q9 B3 i. S: f( K7 w
  51. #define DMA_FN_OUT4 ~5 `% _3 }+ c( d& H0 j1 Z
  52. #endif0 @4 A2 f1 U: x# t* ]

  53. - b6 @3 \6 y: t* \3 S% i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): ~9 h7 {/ O7 |5 J+ a
  55. #define STATIC_SHIFT                3
      u6 J* U4 M9 \& X- y1 e5 ]6 ]2 p
  56. #define TCINTEN_SHIFT               20
    " l( o4 \$ ^/ C7 v6 R6 }
  57. #define ITCINTEN_SHIFT              21
    & ^0 f, C. p+ x# l* J/ I" ~7 P! t
  58. #define TCCHEN_SHIFT                22
    / C9 Y5 T1 `2 B% G
  59. #define ITCCHEN_SHIFT               230 ~2 ^- ~+ q0 n$ Y. r4 \* u5 l% ?7 V+ \
  60. 7 {  f( y4 V( U9 v7 {; W% S
  61. static volatile int irqraised1 = 0;8 I. w$ j# I- ^2 m4 l
  62. static volatile int irqraised2 = 0;
    ; {1 }7 z, O! Q, t: j$ s
  63. : B# O( ^* _; M& ]. ?* g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . z  B8 Z& w  K9 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 o  p9 @" K( Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. L: S- d, [9 k- O6 N

  67. " w4 \( _! S7 I& g; h. {
  68. dma_addr_t dmaphyssrc1 = 0;
    $ L& ~. F8 _9 t4 l$ i/ C" R
  69. dma_addr_t dmaphyssrc2 = 0;6 j& P2 L8 z- t  k# U
  70. dma_addr_t dmaphysdest1 = 0;
    1 q+ R  |3 }6 F4 ^, v" m# G$ X
  71. dma_addr_t dmaphysdest2 = 0;3 ~+ D) Y  E  N( ^
  72. + C( v+ ?9 I( `& w- M% D
  73. char *dmabufsrc1 = NULL;
    ! M8 \6 k  W( P
  74. char *dmabufsrc2 = NULL;
    ' Z. c2 a2 U+ p) M  e
  75. char *dmabufdest1 = NULL;
    / {2 ], o+ d/ j
  76. char *dmabufdest2 = NULL;
    ( J5 }7 n/ O! a

  77. ( b  c/ h! Z5 H! N0 v
  78. static int acnt = 512;
    ; r$ a7 S9 p2 ]7 A
  79. static int bcnt = 8;
    " D1 x5 }5 Y' I0 k9 E
  80. static int ccnt = 8;3 y. I# c+ @& j$ j! V
  81. 6 c( Z  z9 g' ]. ?: F( p
  82. module_param(acnt, int, S_IRUGO);
    " o/ e* K: a" J0 A5 `* K( Z/ K
  83. module_param(bcnt, int, S_IRUGO);
    3 Q0 g. C4 |% Z, Z7 |7 M$ K3 i/ L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 F" o$ `7 W( J6 [

% E2 k  S# o7 H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( O: {$ R$ i5 A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ J" ~/ r+ Z- T( _& X" W4 r/ C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ N- E* x  G. a& W3 K! ], z; A, d! o+ p* A; T1 Q
3 Y" s% X! N- _4 R% H0 x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 01:35 , Processed in 0.042575 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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