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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) k( R0 e% ?& V2 K- m
  1. [code]EDMA sample test application
    2 n3 k& Z  ^# n1 u) g! |# {
  2. /*
    $ t! j+ p6 ^  Z3 v4 F4 U
  3. * edma_test.c
    0 T1 h' p( C, ~% q
  4. *, p1 @# u5 o( e+ z1 U
  5. * brief  EDMA3 Test Application7 H! b! `( y# i
  6. *& j& K" l$ n+ I
  7. *   This file contains EDMA3 Test code.
    , h4 V/ u) p  F6 v/ A& Z* A2 Y
  8. *
    1 L9 O  t  \( g3 x. j" |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 Z3 w: V$ W% c9 N0 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  p& d4 l$ l' h- m; f: K! B
  11. *         TO CHANGE.7 e3 t8 O; t6 i  ^$ R/ m: N4 B4 }
  12. *
    5 T2 j5 J6 |8 o3 z+ o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; N  @; y* ]6 ]8 ^3 _& j
  14. *- D% w6 j5 w8 D
  15. * This program is free software; you can redistribute it and/or
    7 ]6 o+ G0 J  |: I& G/ k" p7 o3 k
  16. * modify it under the terms of the GNU General Public License as* T3 h7 H3 _& E/ B
  17. * published by the Free Software Foundation version 2./ C2 z( t% A( ~, s. E1 j
  18. *! N, F  c# ?& x. L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 o, b. k8 q  I3 D
  20. * kind, whether express or implied; without even the implied warranty
    % y: q, h' i3 O: G0 `/ D+ n2 W( T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ R) k+ I5 N" O7 {
  22. * GNU General Public License for more details.
    / a! Y+ G2 T; ~6 z2 Z' g: M
  23. */
    / `, B5 L. }4 N  g( z6 q( `
  24. - `  V4 J" S+ e
  25. #include <linux/module.h>1 r  P3 i- P* S' J
  26. #include <linux/init.h>% D0 M/ o; G) S8 \) k# q0 [0 L
  27. #include <linux/errno.h>
    4 D% a' B1 I9 p
  28. #include <linux/types.h>
    : P3 ]7 c# _8 h* V7 Y" T
  29. #include <linux/interrupt.h>3 Y7 |5 A2 [6 c3 E) J3 l6 k
  30. #include <asm/io.h>/ k$ d' Y: L1 G4 W3 z$ A, X
  31. #include <linux/moduleparam.h>/ G# a( l6 [" o) D1 [! ^4 r: ~
  32. #include <linux/sysctl.h>' t7 C1 `. v4 p; d) N4 g/ ^
  33. #include <linux/mm.h>! B4 `" n4 m/ b+ K
  34. #include <linux/dma-mapping.h>$ q5 r8 u# V1 }' ]. n( P
  35. ; |8 H" R5 r( d/ k. P
  36. #include <mach/memory.h>
    0 t8 P% ^. _5 ^& p& v/ s0 D/ K
  37. #include <mach/hardware.h>
    2 B3 ^. _  Q- g! Q" c; G# h
  38. #include <mach/irqs.h>$ J( h+ z; F" U5 @
  39. #include <asm/hardware/edma.h>& |+ b9 g/ l* X0 i5 o$ M# c
  40. 2 i) |) R( h2 P. s
  41. #undef EDMA3_DEBUG
    7 H' F$ [# c5 V) T5 I( [0 p3 L
  42. /*#define EDMA3_DEBUG*/9 \, P& r- Q3 [" q$ `

  43. * Q+ @2 m2 M/ _
  44. #ifdef EDMA3_DEBUG
    , q0 B" A. P/ h# |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' }8 [; v3 m7 Q5 Y  `8 G- t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): V: ~1 k) X9 ^2 \. k/ H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 J6 h1 T8 Y1 B9 Q8 K/ k2 s
  48. #else* L( \0 u4 `0 A( L% s% N
  49. #define DMA_PRINTK( x... )  {) l9 r/ ~/ O. }' n5 Q
  50. #define DMA_FN_IN
    3 s( B/ J9 K) Z, V6 k1 r/ c
  51. #define DMA_FN_OUT" I5 y* W0 e3 F* a5 Q4 q- J3 S
  52. #endif6 g. m' Q6 h4 l3 x
  53. " }+ f$ o) k/ C" V4 \% v/ t. j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ Q1 S4 n7 u& v8 i/ @  E
  55. #define STATIC_SHIFT                3
    + Z; ~. ~! E% G1 h* N5 h
  56. #define TCINTEN_SHIFT               20/ n; Q7 [  U) ^' I9 W- z1 f& N
  57. #define ITCINTEN_SHIFT              21  w- h0 o& A. }+ [% Z$ G
  58. #define TCCHEN_SHIFT                220 h7 ?- g" {2 T7 _3 O
  59. #define ITCCHEN_SHIFT               23# L1 T6 ~/ J$ I1 h
  60. , w' L# n/ x  O4 r/ U& ?- ~
  61. static volatile int irqraised1 = 0;
    , Z: i  X0 L3 w" r0 y
  62. static volatile int irqraised2 = 0;4 x3 o! o5 o; m4 ~8 B" C8 l& I# u! G

  63. 9 t6 _' y; l  @0 P" ?8 }6 z. p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 C2 a% b2 x6 Q4 P( a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( ?2 Z' F7 |1 |" E  J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" }" g% [+ F5 j7 V: Y5 n2 @
  67. 0 B  G2 b' U' R! i+ @
  68. dma_addr_t dmaphyssrc1 = 0;( ]) B; \7 O$ P9 q; V( n
  69. dma_addr_t dmaphyssrc2 = 0;
    - ~$ `% Q; e5 X* h: H$ f: S4 E& x
  70. dma_addr_t dmaphysdest1 = 0;
    & X- U  S% \1 X
  71. dma_addr_t dmaphysdest2 = 0;
    5 M. ^5 n( R  V& J( J: [
  72. , d6 j! @0 l- W
  73. char *dmabufsrc1 = NULL;
    * v9 q. c3 [: r! G- d9 M# ?
  74. char *dmabufsrc2 = NULL;
      |% R' P( n+ N
  75. char *dmabufdest1 = NULL;
    % L( ?. ^( X' G. `* s
  76. char *dmabufdest2 = NULL;8 S) T; H; |/ t  M9 {6 f

  77. * n% B6 n# P6 Y; H' F
  78. static int acnt = 512;' R6 s% P. s  |- s, F, l
  79. static int bcnt = 8;- k7 `) A6 `5 Q% g! q; S
  80. static int ccnt = 8;0 w) e, [2 l0 N- F+ R
  81. ; Z5 R. U6 o7 o5 H- N& B
  82. module_param(acnt, int, S_IRUGO);
    , z* F$ i3 c, q* r# V
  83. module_param(bcnt, int, S_IRUGO);
    # R0 B, a& l% u+ B- X, s  @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" J* L3 s+ ~. y0 b# T- M( b8 i

, ~3 e; c; @3 H7 j7 g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: }! Q1 z" U  W2 C7 p) |2 M4 {& g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ d4 j+ n  M, [; I3 h( G: O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 [$ G" A) D4 l1 Y( g
% E$ A) V6 r9 c; B/ T. M
$ I( A) a$ a7 N, X) G9 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 20:04 , Processed in 0.045147 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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