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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ C" c3 a) [3 `9 u4 k1 o! }0 s; w
  1. [code]EDMA sample test application+ G" \7 [) [& H3 Y# {# t& @5 D! J6 ?5 O
  2. /*: V% M7 B# y4 s6 S2 G: O
  3. * edma_test.c
    $ h8 O) H: ^0 w( ~) X
  4. *! J3 T+ e( C2 \. c; C7 l& k. G4 u
  5. * brief  EDMA3 Test Application
    ( g3 Y2 {# E( r6 c2 J; l
  6. *
    # b5 t4 z) l" k0 s, \9 {
  7. *   This file contains EDMA3 Test code.- I) s7 J8 H. o. o' ^2 ^
  8. *
    % z0 a% I6 @$ r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# p' d' w) @0 N4 w! ~; F& c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + t) M: z" I& a) ~  r1 Q9 X& x+ d
  11. *         TO CHANGE.
    * Q% ~$ d  h: J8 [
  12. *
    ! B. O# T/ X$ v1 _$ ]) B* |% g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - E5 M, f8 _4 E. K. P: @( W
  14. *0 M- |+ p% u) N% e2 C- r5 k
  15. * This program is free software; you can redistribute it and/or6 d3 r6 j1 H1 j* s# r. t
  16. * modify it under the terms of the GNU General Public License as* N6 ~2 O- \$ l/ K" m  K# X; j
  17. * published by the Free Software Foundation version 2.
    & U2 b$ F! ?( h0 v; k% S  x
  18. */ N4 i5 G# j6 f0 {  D% |2 \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : T% R5 }" ~  a6 Z
  20. * kind, whether express or implied; without even the implied warranty# U' I( p8 A4 D8 G' x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 X9 t# p$ {/ r4 e4 N# S# N
  22. * GNU General Public License for more details.
    , |0 q/ a0 t2 q% p5 ]8 w, ~
  23. */# r& T* `* \5 c

  24. 4 h0 s% ^% `& s& v
  25. #include <linux/module.h>/ x* T+ i* w$ I
  26. #include <linux/init.h>
    9 v$ Z2 B* t& b* J3 c$ i( l
  27. #include <linux/errno.h>
    ( {- S+ G3 y% ?% s! ^
  28. #include <linux/types.h>
    . r  t- Q8 @: V% |  g
  29. #include <linux/interrupt.h>+ f' H3 i5 H% s0 E
  30. #include <asm/io.h>
      O) A$ L( p" e2 k9 v* [& Q4 N" y
  31. #include <linux/moduleparam.h>+ t7 T: E" h3 H- R2 I
  32. #include <linux/sysctl.h>0 @2 f3 X5 M9 u* p
  33. #include <linux/mm.h>
    & x8 G, Z# Y: `1 G# F# c1 G
  34. #include <linux/dma-mapping.h>) N" F0 m3 Y! W- r$ ^' J1 a; ]- H+ r

  35. ) n& Q" t, `. _% c0 f) r) `% i
  36. #include <mach/memory.h>
    3 q  U- _  ?- t* N
  37. #include <mach/hardware.h>7 o6 O6 ?/ ]2 Y; ^& Q  D$ A/ F
  38. #include <mach/irqs.h>( N# a, J7 p* y! a# E
  39. #include <asm/hardware/edma.h>9 ?! I  C$ R% k: B$ G

  40. ) ]& }* q4 c/ O3 _% z& U  r
  41. #undef EDMA3_DEBUG
    7 f- I# D6 I. v- ~! E
  42. /*#define EDMA3_DEBUG*/
    6 U* `# \, u6 y: a7 x- [

  43. 1 S1 r9 X5 T( ?% I4 S% M
  44. #ifdef EDMA3_DEBUG6 A2 N; _: e4 ]4 ~7 X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ s& w$ B4 \) z+ c6 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % }. J! I( _  j2 Z* b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 F# U) i, B9 s- a" L6 e; L: N7 _3 L
  48. #else
    # Z& [0 ^( |: ?, A* N! D
  49. #define DMA_PRINTK( x... )
    * S  g% ?. M; T
  50. #define DMA_FN_IN
    ' @9 [5 @5 E; K5 b, d/ O
  51. #define DMA_FN_OUT
    , D% o6 r8 X9 c' h4 h8 i$ J1 e
  52. #endif
    3 O( d4 e; r% {% z# F  u" T
  53. 2 T/ c2 z* ~8 D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 ]/ O" G( s3 @, J! N7 F) z$ F
  55. #define STATIC_SHIFT                3% b! ]0 H. f' U0 g: |" ^+ x
  56. #define TCINTEN_SHIFT               20
    2 Q; o, j1 B- d; \+ b7 k
  57. #define ITCINTEN_SHIFT              21
    " i" l9 g3 J8 a4 F, L
  58. #define TCCHEN_SHIFT                227 \/ d0 I1 Z9 b) R
  59. #define ITCCHEN_SHIFT               23( ]6 Y+ v7 W9 \8 E/ |. ~9 c

  60. + J8 `! }; m1 R  I" S% ]
  61. static volatile int irqraised1 = 0;7 x; K3 F6 j; I+ T+ b+ X/ E6 U
  62. static volatile int irqraised2 = 0;  v, m) o; _0 q5 _7 C0 h! K
  63. ; O* x9 G0 l: U3 D2 I. o3 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 y+ Z* W3 s  F& G
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * v+ K+ {+ A6 a7 x" B) c# R8 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , I* n  k; Q4 v* A! @
  67. 9 b. a: q& o) V
  68. dma_addr_t dmaphyssrc1 = 0;
    ( z  K( M  Z, E1 k8 N9 _/ H
  69. dma_addr_t dmaphyssrc2 = 0;
    8 a9 u) H4 P( v
  70. dma_addr_t dmaphysdest1 = 0;
      x" [. \! H* T& t6 W" \$ Z; P/ f
  71. dma_addr_t dmaphysdest2 = 0;' c  F# T% q' I+ [/ }! f; K- A

  72. - @3 T/ D9 N( X$ J6 ?
  73. char *dmabufsrc1 = NULL;( f  U, Y& g1 @, ?5 p8 }) h
  74. char *dmabufsrc2 = NULL;' A9 G1 @  E( R6 F! n
  75. char *dmabufdest1 = NULL;, x9 K, M! K8 ?0 V' L4 h
  76. char *dmabufdest2 = NULL;& O: U  x2 v* V+ g, D. h7 P

  77. ! f( C9 j5 G/ O* m
  78. static int acnt = 512;. T4 R$ U: d+ r8 Q! O* v: Q6 o
  79. static int bcnt = 8;( K! o" L" b# l5 P6 a
  80. static int ccnt = 8;: \+ C4 P* _+ x+ {2 f% _5 @
  81. ! e6 g; }: y" ~! W
  82. module_param(acnt, int, S_IRUGO);+ A% y: s( S, x
  83. module_param(bcnt, int, S_IRUGO);$ `1 C' V6 D& r  |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ e" \# X8 n! C$ b9 c
1 o- g' l) Q( K* M7 U8 b# d7 c4 A
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 \1 q# @& V9 }6 @4 a! I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( p0 b: W- g  M+ p. N0 m* s1 ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- g, A" r" F" J7 n/ U/ t9 k8 E3 _4 U  K9 l3 z4 P
# j- Z8 ]& w4 M1 H* |( m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-28 08:52 , Processed in 0.037443 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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