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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( s: B1 }) Y/ }. D& K! P  Y6 ]2 ]/ g
  1. [code]EDMA sample test application
    2 Q3 i$ o# U5 c! z1 V
  2. /*
    / O3 x$ X- @5 h3 o  A
  3. * edma_test.c
    5 T' l5 d+ j/ t0 ^
  4. *2 Y5 b! z- X# v- t& Y. I% A
  5. * brief  EDMA3 Test Application4 w# I; L7 X- k2 i9 ~# n
  6. *7 c2 e. B: |4 a) }. ]
  7. *   This file contains EDMA3 Test code.
    + e" s5 q8 C+ s. ?3 a9 M- M" @
  8. *
    % d" Y: V) w$ U: Q3 S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 O3 d* p+ u" @2 W! c9 n. U9 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 o( B0 t' d7 h2 L) x7 E+ H" @+ R
  11. *         TO CHANGE.
    ; C7 n3 `1 }) I+ h  L" B
  12. *% F7 ?$ H% ~$ v8 @& ]  W8 I9 p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( h& I! [; T" t. H# S6 f+ ]
  14. *& [) u6 v( i1 h1 Q* c
  15. * This program is free software; you can redistribute it and/or7 ?6 \0 J/ r! A7 G6 i7 b
  16. * modify it under the terms of the GNU General Public License as
    ! b8 o$ o- }+ b. O0 o1 q& k* f" e
  17. * published by the Free Software Foundation version 2.+ h4 j2 j8 N! E0 ~$ g' P+ v1 |
  18. *
    2 G0 c0 y3 d2 A+ ?5 a6 B# N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " x, ]" O# E7 o% e1 A+ i* U
  20. * kind, whether express or implied; without even the implied warranty) L9 a4 v+ M0 V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 C6 Q( o1 s; @
  22. * GNU General Public License for more details.
    * G# }( k: C) U% X9 L" ^
  23. */
    0 ~, K; J; E/ j! I* c6 P9 ]

  24. 2 [& i. a0 K# t
  25. #include <linux/module.h>
    3 q/ a3 J* g8 u0 \: C0 M+ D
  26. #include <linux/init.h>
    % w6 M0 t! p  Y& x$ m
  27. #include <linux/errno.h>
    # n% r% g. j. q7 O9 d
  28. #include <linux/types.h>
      T8 B1 p4 A, }( Z
  29. #include <linux/interrupt.h>
    7 G9 t, y, S3 d& H* }' J- O" f
  30. #include <asm/io.h>
    ' I' l3 [4 L0 B5 X4 J( V
  31. #include <linux/moduleparam.h>
    2 p( ?% R+ w6 P1 l0 y. ^% ~2 |
  32. #include <linux/sysctl.h>% R  j% n( c9 a
  33. #include <linux/mm.h>
    ) I/ D1 O) j9 D7 T( J  r. o
  34. #include <linux/dma-mapping.h>
    5 V& H$ p3 p" s( L
  35.   @9 [3 ^& F. ^
  36. #include <mach/memory.h>$ f4 I2 S% D8 ~$ f% n2 W
  37. #include <mach/hardware.h>
    ; }& j. R) T5 D: O) \: n; l
  38. #include <mach/irqs.h>
    6 B5 o/ @4 ^( p2 S2 f# U
  39. #include <asm/hardware/edma.h>4 S8 r! n0 D$ ]

  40. 9 q& t: E% I3 ?7 O9 n: O* ]
  41. #undef EDMA3_DEBUG7 Y9 l; Z6 \% q1 V; p4 D7 Q6 I
  42. /*#define EDMA3_DEBUG*/
    " y! ^" Y& n; N/ _

  43. " ]* T& m( t" V
  44. #ifdef EDMA3_DEBUG
      V/ t9 v% {' f  ?  f8 q7 N
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , j# U3 _+ R$ M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 b* Y% o# D& h7 O; L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & L/ Q0 t! r* `+ W5 U
  48. #else2 |4 Z& @1 ^! v; |! K
  49. #define DMA_PRINTK( x... ); B( o/ d- i( a# K# ~
  50. #define DMA_FN_IN
    6 I3 ?: |- i4 r& s& R% z( l
  51. #define DMA_FN_OUT/ e- w0 F3 Z. Z
  52. #endif
    4 R& }. N5 k/ H+ ?, \
  53. 7 e2 i" G0 C. a( H! N, H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 m) r5 R. s0 T! E7 G2 q% S
  55. #define STATIC_SHIFT                3
    # P) j7 \6 u$ K: L- G- R  s  [' s" M
  56. #define TCINTEN_SHIFT               20$ {3 f/ c. I* D, c
  57. #define ITCINTEN_SHIFT              21* {5 ~9 {6 V, i4 V" r8 m
  58. #define TCCHEN_SHIFT                22& ?; v1 {& z7 x3 K
  59. #define ITCCHEN_SHIFT               23) ?& V3 i1 E: o. `0 ^" X
  60. 5 _  I1 o0 q+ Z1 L( f
  61. static volatile int irqraised1 = 0;5 W  v7 Y& S9 w1 X* r
  62. static volatile int irqraised2 = 0;
    : r  a& r1 H5 e
  63.   O( Q9 p$ ^% X! R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: }% X5 W( T7 J- x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; E  t* x/ y7 W* P6 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 ]! [* k' D# P  ]4 R, h

  67. # @' S+ T: Q5 J1 h1 q+ T* V" f
  68. dma_addr_t dmaphyssrc1 = 0;
    ' U% R* T9 m1 o2 j' }4 Q- d
  69. dma_addr_t dmaphyssrc2 = 0;; ~  o: r. m! s  d
  70. dma_addr_t dmaphysdest1 = 0;- s& d3 w1 ~4 A/ q
  71. dma_addr_t dmaphysdest2 = 0;
    # u& x( A, C" B( K5 V1 s' J: C
  72. / z% ?4 R  n! T! W3 G6 E
  73. char *dmabufsrc1 = NULL;% p5 o6 c# d% @+ L! l* x* F7 z1 H
  74. char *dmabufsrc2 = NULL;
    6 \, {" y7 D" k2 Q; W7 T8 e
  75. char *dmabufdest1 = NULL;$ Q1 Y& {; h7 U
  76. char *dmabufdest2 = NULL;/ z- E/ x6 \' ]3 R0 k! b4 }: N
  77. 8 [' d- R' ~# \$ v# A* o
  78. static int acnt = 512;
    ) q+ T; z3 M* z7 X
  79. static int bcnt = 8;
    9 J- D6 }, S# [/ E" s2 i& T% a
  80. static int ccnt = 8;0 |+ {! x$ m1 `" N. i4 g0 z5 r- v
  81. ; s4 f( `8 f8 {: o( t
  82. module_param(acnt, int, S_IRUGO);
    1 F% p& ^6 J1 t* v  v% T& d$ S
  83. module_param(bcnt, int, S_IRUGO);
    5 Z# b" @" n* T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 J+ {5 L" E. X1 d3 m  R
& S+ |- C: l$ O$ {- I  f8 i      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) Q4 p/ o! E7 Z7 b' M+ Y& M  S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- x2 H6 \4 {0 G" m6 p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 S7 ~; L1 _' G9 R9 h0 Z! _7 U3 U/ n9 ?! h3 U# n9 S

' A  Y0 ^1 b) a' K% K& B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 18:03 , Processed in 0.037896 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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