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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& ~0 Y/ T4 L4 S! J
  1. [code]EDMA sample test application: B% m9 o) \1 m/ s6 S5 P
  2. /*7 d/ R& [7 L3 \
  3. * edma_test.c
    " H2 b# F7 H8 q/ ?$ M0 H' X" E
  4. *! ]1 F" k! n, M0 j$ K
  5. * brief  EDMA3 Test Application
    % u% M6 M: ~1 A0 E' t6 t6 e) `
  6. *
    ! G) I/ |* Q$ e# ]* ^  ]. Y6 u) e
  7. *   This file contains EDMA3 Test code.! e3 h9 m0 F) S0 G
  8. *
    9 e* w4 |; u( b6 R& j0 g5 A  b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 p3 r1 t" c# Z) F: Z( Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    & Q3 W$ F" e, C6 ?0 _1 L- u8 @
  11. *         TO CHANGE.  x* l0 y) L8 j; C5 Z  l2 b$ w
  12. *
    : q. J8 u. R6 M; Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . `$ x# O- Z& [+ W& D3 ^
  14. *
    1 F$ `3 \  s2 a! i
  15. * This program is free software; you can redistribute it and/or
      z2 r% j: ]. D* p8 Y; B; h% S
  16. * modify it under the terms of the GNU General Public License as2 c# V- s& X9 A6 d
  17. * published by the Free Software Foundation version 2.
    " W. J/ n$ W! Q3 _
  18. *
    2 y6 _( _$ u! N6 _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      @/ q# Q: E7 S7 j
  20. * kind, whether express or implied; without even the implied warranty
    ( n9 _7 b# {; o* v: h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& i4 x( z# s# p1 H
  22. * GNU General Public License for more details.
    0 f8 a- s$ @1 F/ I
  23. */( U, K7 Y& I. s$ `
  24. 0 B- K3 w+ k$ T; \
  25. #include <linux/module.h>3 ^  f2 @3 }, z- I+ f0 D4 ?$ x, X
  26. #include <linux/init.h>6 P' `5 ~" _( t7 t% R1 r
  27. #include <linux/errno.h>
    1 g& B3 }, L! H4 E" A6 H1 ~
  28. #include <linux/types.h>; ~2 u- v% v( M7 _
  29. #include <linux/interrupt.h>5 W- l$ \9 ]- E$ m* B
  30. #include <asm/io.h>0 N) Z; N8 ~& C6 s' V9 h
  31. #include <linux/moduleparam.h>
    . o+ L; x2 y$ Y/ i; v% C, ~4 \3 D& W
  32. #include <linux/sysctl.h>
    $ d2 b! C% n" i! S' h3 L0 p9 G
  33. #include <linux/mm.h>9 }% O! h4 J4 P3 G: H
  34. #include <linux/dma-mapping.h>
    % Y4 H! G6 A6 F: G2 g  ~

  35. 7 v" R' V! j+ I
  36. #include <mach/memory.h>
    ; {- T8 W: H" H: L7 [4 E" t5 q
  37. #include <mach/hardware.h>
    / U( Q6 ~. b1 \6 X. _
  38. #include <mach/irqs.h># d( T% D4 T% s4 L
  39. #include <asm/hardware/edma.h>
    - c" t$ G; W9 f& @" A3 _8 E: n: E
  40. , {0 t( B+ e( i5 p2 Y" Q! }5 I
  41. #undef EDMA3_DEBUG
    4 [9 p( p& s& X
  42. /*#define EDMA3_DEBUG*/* V9 T5 ~+ {1 y; G! Y, z2 ]+ e

  43. ( u2 X, t; w) ?
  44. #ifdef EDMA3_DEBUG
    5 N2 O8 u& |+ ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 ~  z+ Y/ k  O6 g) Q. I  V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * D7 z# b4 V9 c% Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) _  @1 g" U1 ?- g
  48. #else1 d, d9 i7 `# v5 C; I' f1 m
  49. #define DMA_PRINTK( x... )' f+ W% y( Q' S) R9 d/ J  i& K1 G
  50. #define DMA_FN_IN; n! H' H. W% h" r) e; r( o
  51. #define DMA_FN_OUT3 V4 P1 J' G( R! C9 r, g
  52. #endif) \6 K) w$ Y" w6 _
  53. $ M7 S' D& O2 _" r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( r" o+ w% P( o- t0 t6 e
  55. #define STATIC_SHIFT                3  E' y! r, m: w, w! @, h# R4 n
  56. #define TCINTEN_SHIFT               20( V+ T4 W" J. z) G; ?
  57. #define ITCINTEN_SHIFT              21# Q0 V7 U2 l  m
  58. #define TCCHEN_SHIFT                22) v4 L5 \, @, b( ~% W& ^' m/ f. |& E- K
  59. #define ITCCHEN_SHIFT               23
    0 j, u' l. @# H/ l' h# x
  60. & t1 i- h( L6 a7 `& h. |5 M
  61. static volatile int irqraised1 = 0;# d2 s' n3 v  s: ^
  62. static volatile int irqraised2 = 0;0 q9 t' s5 e# A7 ~  _: ^
  63. + U# m' Y+ h: e& D  L% f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 M/ X+ W& Z9 K* I  l8 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! [7 I& }+ r- E* N% F0 R: |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  f1 f8 ^; x7 U0 [" U& p3 R

  67. 4 G% f0 ]. z  e" U7 N. H* E: @
  68. dma_addr_t dmaphyssrc1 = 0;& s2 U6 q8 u: [. }7 Q( T
  69. dma_addr_t dmaphyssrc2 = 0;  N* J! t! o7 U5 w$ s
  70. dma_addr_t dmaphysdest1 = 0;
    ; e* u1 L( v' J/ p; M9 g+ a
  71. dma_addr_t dmaphysdest2 = 0;
    , Z! \4 E) T' ?
  72. 9 G+ g7 w# W  u3 F7 ]
  73. char *dmabufsrc1 = NULL;
    2 Q- h+ k9 B% c# ]7 T) w- V4 f
  74. char *dmabufsrc2 = NULL;
    3 A# }: q3 o" d0 S& a  z7 G
  75. char *dmabufdest1 = NULL;6 X7 f( ^6 f: A) o' J: N7 A( {# Q
  76. char *dmabufdest2 = NULL;
    2 z$ R6 V4 _, L9 F/ z; ~

  77. / G* ?! j! h! `' M
  78. static int acnt = 512;
    6 N+ y1 [. N/ \: R8 m* M; {$ F, I
  79. static int bcnt = 8;- l7 v8 B+ R+ G6 C4 ]9 M2 x
  80. static int ccnt = 8;
    0 }# r1 s; J# O7 e7 \' I  b8 Q: l
  81. ( ^3 l1 H. F# w! [& E
  82. module_param(acnt, int, S_IRUGO);, ^# [5 g! U: B6 A( I1 R6 ]2 [, B
  83. module_param(bcnt, int, S_IRUGO);
    ( V3 F8 s- Q# z4 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 c- s+ N" J9 B2 p/ ^/ _

7 v2 s+ T8 R) }5 d3 _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  b  f  t9 X  Q" H5 P, l( oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 K% ]5 w: q; ]/ g5 [; {8 }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# z6 M, i4 ?* ?  o1 z
1 G7 o* [" e. Z. l/ B- _. e( H- I6 |

) b1 U# Q1 O5 R" U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-20 01:14 , Processed in 0.038319 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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