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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 {. G/ [. l: K& [
  1. [code]EDMA sample test application
    ! e, a* I; L' U! A
  2. /*
    2 ^4 o" J) }/ _% N5 \; V
  3. * edma_test.c2 h1 F3 w; \; s2 e- C" w0 d
  4. *' O8 O: [+ c% Q8 j( `* O4 M
  5. * brief  EDMA3 Test Application+ [7 u: V/ X3 o* W1 \
  6. *
    7 V) w, ~$ f' ]6 D
  7. *   This file contains EDMA3 Test code.
    0 o& f7 g+ K; u- z/ a: Q
  8. *0 l( c) n& e! q. t" a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ i# b0 |. ~. x& ?4 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 [, {) d# h; r, v. E0 \& n0 j
  11. *         TO CHANGE.
    - b2 o8 ]( L% [5 F- x$ }/ @
  12. *
    / W" j/ K: ~; U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 e. }( ^; ^8 W' C$ O6 k4 H$ H$ [. S; e
  14. *4 R* l. c3 b* T/ _& \! g/ Y  `! f
  15. * This program is free software; you can redistribute it and/or6 b: Z3 @. v1 c1 A% ~' D# P
  16. * modify it under the terms of the GNU General Public License as
    $ i, W+ {7 @" a
  17. * published by the Free Software Foundation version 2.
    1 p; Q5 I& J( ~& W
  18. *
    ( A6 f4 e. C7 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) `% x% p5 b) D. a* q8 O+ I4 S+ S
  20. * kind, whether express or implied; without even the implied warranty; L4 Y5 c( k5 @% {* Q2 J. b  ~9 D3 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 [. n6 O" O% {7 O# b% H. a
  22. * GNU General Public License for more details./ g9 r+ I. k/ n% l
  23. */
      U( F9 t) w6 ?; _3 ]4 y
  24. , K; R. L; v) Y) O; f3 ]( Y6 L$ x
  25. #include <linux/module.h>
    0 ~; c( x# |4 f0 U0 i5 w7 A# k
  26. #include <linux/init.h>
    ' ^& n6 P1 Y, p# d& N  R6 y$ c
  27. #include <linux/errno.h>: b( H2 h$ L: t; ]" e
  28. #include <linux/types.h>
    , k6 n( n% n( ?. ?  @
  29. #include <linux/interrupt.h>
    % @1 [/ ~0 |. [1 \, m
  30. #include <asm/io.h>
    ' t) g7 C, @* @- _3 v& l9 c. n
  31. #include <linux/moduleparam.h>" g2 o1 G! z& A& T
  32. #include <linux/sysctl.h>2 y  z2 o+ D+ M6 L. M
  33. #include <linux/mm.h>
    2 j4 u' w- y! X2 i
  34. #include <linux/dma-mapping.h>
    : R# A3 W9 Q8 T2 a- V" h- C
  35. 1 u* N7 }' W: v. {
  36. #include <mach/memory.h># Z! a- n9 [1 j# x; r5 Q# I
  37. #include <mach/hardware.h>) S+ Y) f6 V0 J  S2 m
  38. #include <mach/irqs.h>" l% N5 ^3 F! I& N; R* @
  39. #include <asm/hardware/edma.h>& w7 n3 I7 l6 v5 w1 _) l

  40. 6 c- g; @& K! W* |  w
  41. #undef EDMA3_DEBUG
    " }3 t5 `3 J2 M
  42. /*#define EDMA3_DEBUG*/4 n: |- J+ ]; b
  43. # d* D, U2 u3 Q
  44. #ifdef EDMA3_DEBUG
    6 l( Z# E: a& s1 e  `9 `+ [& O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + C* p( L7 g, P5 b: S/ |$ C, s0 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& M: J% K" c3 P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      q: R# L- ]* r! K8 V- F- b
  48. #else: N$ i$ D2 q! r; |+ C/ A
  49. #define DMA_PRINTK( x... )
    7 m4 d$ \+ p% q+ j9 `/ N" P
  50. #define DMA_FN_IN
    : f1 d* K% c; P& V
  51. #define DMA_FN_OUT1 Y' {$ y* F( U1 q' Y9 H, b; r
  52. #endif- Q1 X9 G9 H' u6 m( f% P
  53. " X5 e" Z! {9 h. r- ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' T) P4 {; n/ R, d5 A) _. g
  55. #define STATIC_SHIFT                3
    / R) z5 H" i3 R1 `
  56. #define TCINTEN_SHIFT               203 ~# a# |; E. y' q
  57. #define ITCINTEN_SHIFT              21
    0 y6 G/ G( S* T1 F# F5 F
  58. #define TCCHEN_SHIFT                228 l6 }3 W9 v4 A: ]- H3 k: r& W. u2 w( n
  59. #define ITCCHEN_SHIFT               23
    ( V. g* b2 h' K" P* Q0 G; h

  60. " q4 A1 n0 R: M, u; o0 a! L+ [
  61. static volatile int irqraised1 = 0;
    5 N$ t$ U; u4 \% m7 E
  62. static volatile int irqraised2 = 0;
    ' p& v; T1 E0 o: p

  63. ! @$ B6 }% X- _+ j3 x+ {, N* f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) C' S( t1 n! }# F6 Y! e' h, H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 b. a2 M9 Z$ A! @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ q; }( p$ @) r8 C2 _" o6 H
  67. 9 D3 e+ N: B7 g% e5 Y* W
  68. dma_addr_t dmaphyssrc1 = 0;" x6 @* |3 G$ d1 X. s. g
  69. dma_addr_t dmaphyssrc2 = 0;# ]1 f& \; k5 Q
  70. dma_addr_t dmaphysdest1 = 0;3 J- U: a* K( o" p
  71. dma_addr_t dmaphysdest2 = 0;
    ' v: V; I5 }9 `, ^  Y; |4 f
  72. 6 C/ H+ J9 [% p# \& A7 ]9 w
  73. char *dmabufsrc1 = NULL;. k+ g, A1 o7 @. c- ~
  74. char *dmabufsrc2 = NULL;
    3 n8 j7 |! l1 Y: f. |
  75. char *dmabufdest1 = NULL;
    * ?% m: }5 U* ^2 p/ Q
  76. char *dmabufdest2 = NULL;
    8 h# u9 ?: B6 j+ d
  77. 3 T* _, H- L* D* G8 c: ^9 B- e
  78. static int acnt = 512;. o" Y4 _; V$ o2 K6 }5 Q5 k" _
  79. static int bcnt = 8;" S" p! J  R7 F( `1 B) u! P% p. a% x
  80. static int ccnt = 8;
      C7 Z, L" b0 B- [' Y! }6 \. [1 n
  81. 3 k: m" Z3 ]2 T) ?5 x
  82. module_param(acnt, int, S_IRUGO);
    5 T& o* e/ B3 ?5 ]: }  W# l+ D
  83. module_param(bcnt, int, S_IRUGO);
    4 U' T% I. e) Q5 t# f4 o: J6 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 s* S1 O5 f$ Y4 Y: s1 B  h5 @
& p' F9 {8 L9 S7 B; r6 P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% n4 R0 g  S! ~( [5 a" c/ E: Harm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: I! d/ C8 _! c1 m* E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, O$ a* H- P4 e2 ?& Q9 p& S! ?$ }  l9 S: t4 t
8 V$ |( q. H0 C, x6 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-7 02:30 , Processed in 0.040739 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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