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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 t5 `2 X7 V% {
  1. [code]EDMA sample test application4 w: e# r/ v% u% s/ J2 t: I- A. [, a
  2. /*
    # L7 w- C7 U( {
  3. * edma_test.c- {3 _9 T2 b: b: w3 [! `
  4. *
    5 q9 ?" A! X, X! X
  5. * brief  EDMA3 Test Application
    6 \0 l+ `, M5 w* j8 s
  6. *7 g+ h$ L; P8 V3 k; Y4 B9 K! k
  7. *   This file contains EDMA3 Test code.
    + g# |$ Y* [/ a
  8. *: }' |" E1 y$ E( a) @: H) |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / o4 B3 K+ q  N( `/ Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( e6 x# Q2 A# q1 o- _& @; l
  11. *         TO CHANGE.- ?2 x3 E% e" E  ]) s
  12. *
    ' i" y/ R) _0 z# C9 Y" a; i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 \: B% B  G+ h. Z
  14. *( M2 c7 ?, l  b* X
  15. * This program is free software; you can redistribute it and/or
    7 @) h3 G: O! }/ I
  16. * modify it under the terms of the GNU General Public License as
    ( R, P8 _8 a+ D" E
  17. * published by the Free Software Foundation version 2.
    4 M0 D2 w7 @; e2 L' W
  18. *# q% }- q8 \% f  d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) `1 Y- T) Z# s$ ^" e
  20. * kind, whether express or implied; without even the implied warranty
    & |: D  G% z# J- @( z' v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' D7 S- j% j1 ?6 p: `  `
  22. * GNU General Public License for more details.$ D, v$ C* A% e
  23. */
    ) h( ~9 o* n5 l: c
  24. $ h- }+ k- x3 e& K9 T3 i1 l
  25. #include <linux/module.h>
    5 T6 @9 m) b3 M5 P
  26. #include <linux/init.h>6 S% X! b. S) u! A4 F: p
  27. #include <linux/errno.h>; C- ^( h. c% V
  28. #include <linux/types.h>
    - A% l' U* q/ E: O) O% F0 e
  29. #include <linux/interrupt.h>2 z9 t2 `! X  T7 p
  30. #include <asm/io.h>
    + d: K4 H: |8 D4 N
  31. #include <linux/moduleparam.h>
    & ?0 r$ N0 n: ?
  32. #include <linux/sysctl.h>
    8 P3 K: M( {  Q0 V: l% u
  33. #include <linux/mm.h>
    , m0 o3 P* `) K$ @; [& c
  34. #include <linux/dma-mapping.h>
    8 j2 P1 h. z: A: a& u- b

  35. 0 t6 o- T4 o/ o& w7 L6 ]+ F/ D9 }
  36. #include <mach/memory.h>
    - R0 O9 U2 C( g1 j1 L. d
  37. #include <mach/hardware.h>  h! J7 p1 ~" C6 i7 C9 a! v  a
  38. #include <mach/irqs.h>
    # z8 Q. ?# m( ]/ Q* q
  39. #include <asm/hardware/edma.h>
    6 \3 D, x1 }- Y1 Y+ W8 {1 U

  40. 2 W9 D  f5 I9 q- x
  41. #undef EDMA3_DEBUG5 O2 V, @, H! e. Q% x
  42. /*#define EDMA3_DEBUG*/! s* l) G+ B. R/ [
  43. 1 S+ s  b4 U! G3 _! t
  44. #ifdef EDMA3_DEBUG
    " I/ ^- N# }* J) \3 s. F1 |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' G/ c6 u- f  ~* F, S9 q" j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% o+ {" r" q& |7 i% y# i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & H7 A: t6 V! x! @5 o) ~
  48. #else7 o+ C3 B& J  t! X
  49. #define DMA_PRINTK( x... )3 c" e0 U+ j/ k9 o8 D% o& n" `  B
  50. #define DMA_FN_IN" d- t( a3 m2 c/ [, }
  51. #define DMA_FN_OUT
    + p4 I* D( J& W. e
  52. #endif
    # }% R: D( h( ]; n* X1 b* d" T
  53. . Z: P2 A# p& `( j9 u5 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 ^2 I+ ^) O( X
  55. #define STATIC_SHIFT                35 H1 M4 ]; s7 D5 ~
  56. #define TCINTEN_SHIFT               20/ L8 ?/ J9 y7 x* p1 C
  57. #define ITCINTEN_SHIFT              21
    4 y. B  }1 d: [  S4 Y- Z
  58. #define TCCHEN_SHIFT                228 j8 ^4 [7 }! g
  59. #define ITCCHEN_SHIFT               23( h, K0 e5 V) G1 U' K  Q
  60. & U& V  R* D% S8 E6 q
  61. static volatile int irqraised1 = 0;9 _0 \- s; ^0 \- u% g6 d
  62. static volatile int irqraised2 = 0;
    % z" G9 t8 f1 v# l. S, _( `& Q

  63. ; ^) \3 H" K- O& R- Q% F' C6 Z: V% ?  O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 i) a: W8 w# H7 X4 \  ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 o6 w% u( b2 J5 i+ V0 n+ R5 C. {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, G' t" i. P# V; h; Q
  67. 7 H7 D6 m, \5 b
  68. dma_addr_t dmaphyssrc1 = 0;' J6 b. n! S" \3 V! f
  69. dma_addr_t dmaphyssrc2 = 0;
    . n4 i6 r6 l8 z! J1 t/ U
  70. dma_addr_t dmaphysdest1 = 0;
    0 }; b# l. ]5 n
  71. dma_addr_t dmaphysdest2 = 0;; F5 h4 b( J' r( @8 C
  72. / c' {# @3 d- X4 O, C) ^6 L5 n5 t, @
  73. char *dmabufsrc1 = NULL;( x( S9 _' w; Z  d' o3 ]
  74. char *dmabufsrc2 = NULL;! E2 m: Y# i/ g; T2 ~
  75. char *dmabufdest1 = NULL;
    4 C, D4 t  ?% c: J' g0 {
  76. char *dmabufdest2 = NULL;
    / _" L5 H; w5 ^# B3 Y3 W
  77.   a$ O; N; c6 P. j8 p
  78. static int acnt = 512;& G9 }' t# W# _0 \. t
  79. static int bcnt = 8;
    ( q( j- O4 p8 q6 E
  80. static int ccnt = 8;! P5 b0 {% j  v4 h0 ]& Q4 e

  81. : {2 m' A" J: }* {. c( g- [
  82. module_param(acnt, int, S_IRUGO);
    5 u' \8 a) J. e9 X, p2 ^5 `
  83. module_param(bcnt, int, S_IRUGO);
    2 @( v3 ?/ D, k- |( @4 k! d# r1 e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% B) g9 p& {$ o1 Q+ P+ z
5 D4 W$ I0 o9 v9 s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. j0 i# A( z) q3 e# i6 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! S- ~% H+ ~! G/ w! `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 U& o0 N6 Q8 ]1 m, ~" h# g) z$ z5 M
1 e5 j( G; p% L) D0 @/ Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 20:57 , Processed in 0.038552 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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