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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : o# E, t- V) ]4 U
  1. [code]EDMA sample test application+ K: O: Z2 d% b
  2. /*/ i3 w+ d) d  a, s) z  d
  3. * edma_test.c
    1 R5 m9 j0 _7 @2 V7 w
  4. *
    ) N, Q# x  G! k, u
  5. * brief  EDMA3 Test Application5 f( Y* t- Q" `1 M
  6. *) k2 b) X0 B# z0 ?% w: X
  7. *   This file contains EDMA3 Test code.
    2 {/ J4 z9 r6 H6 i2 U7 L
  8. *5 a: J5 q( A8 J4 I" ]3 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- c5 u% g: B/ {' S2 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# R9 O  l8 [! ~, J9 G. Z% j
  11. *         TO CHANGE.1 d8 E' I/ Y5 W8 i  Y2 I/ x. q4 N, \
  12. *
    # k- P' n& O, Z3 V; Y8 S$ E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; Q: r7 i- E, Q8 t4 M$ {$ X
  14. *" ^9 W+ x& N4 }  T
  15. * This program is free software; you can redistribute it and/or2 X6 t( |  T! r9 Z
  16. * modify it under the terms of the GNU General Public License as7 s7 z7 Z' e( O% n4 w% Z: f
  17. * published by the Free Software Foundation version 2.; ]# Z" c4 S- }8 \
  18. *6 ~" x4 q9 @* e3 w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / Q1 ~  ]+ S: Y/ w" r# a- }" V
  20. * kind, whether express or implied; without even the implied warranty- x! q, d" t/ h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 J$ i+ j- q2 `( ?/ k% j) S3 u
  22. * GNU General Public License for more details.2 H( {/ k9 o2 r
  23. */1 u6 P' R- v# j% ?6 e6 ~2 ?% D
  24. . e# b/ p/ d% a
  25. #include <linux/module.h>
    - f" _4 Q  Z  Z. [( g) w
  26. #include <linux/init.h>7 v2 r, d0 F  ]' F& V& O" O: i( B
  27. #include <linux/errno.h>& v0 Q) ?+ j& Z  S6 p+ B6 f
  28. #include <linux/types.h>' e4 e6 R+ r* G+ [
  29. #include <linux/interrupt.h>
    ' E2 N/ R2 X1 E
  30. #include <asm/io.h>
    8 m& D7 A8 C/ _! Z% `' M, p
  31. #include <linux/moduleparam.h>
    ( h* _$ [& N, h% H' p* @+ m
  32. #include <linux/sysctl.h>
    % L# h8 T  U6 F1 e. M4 B
  33. #include <linux/mm.h>
    * e4 ]( [2 f1 O( ^  M- L; \+ B; F0 g
  34. #include <linux/dma-mapping.h>
    " H+ M0 D  l1 v# {" s4 h# I- \" z
  35. 3 z9 P  j( X( {4 D. x( o/ w% g! g
  36. #include <mach/memory.h># j; T$ R" G+ H. q) ~* V
  37. #include <mach/hardware.h>  p6 {0 Z) c1 S" H  F( Q* [
  38. #include <mach/irqs.h>
    3 r- ^& V2 D) F7 w
  39. #include <asm/hardware/edma.h>
    - C1 T5 o+ Q& V: z5 ^' s) X. g

  40. $ ?  J$ Z# l; l$ {
  41. #undef EDMA3_DEBUG
    & B2 F# C: p) f1 ^6 C3 i4 ?2 Z& t
  42. /*#define EDMA3_DEBUG*/# r) u$ w7 @3 ?! e0 O7 e0 {

  43. ' Y- g9 d* P; i6 {- `
  44. #ifdef EDMA3_DEBUG# r( V1 K2 F% J" V2 K5 N) b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    $ J. }0 f) B5 U3 R! h* ~3 a( I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 K2 U4 S, R* {0 [, R2 G1 h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 k% v! x) w+ g  B
  48. #else1 w1 J: o: P4 A! L* X
  49. #define DMA_PRINTK( x... )
    " {/ `& F8 L* |; e
  50. #define DMA_FN_IN
    9 W; ]5 p" }, a7 L( v5 c
  51. #define DMA_FN_OUT5 a" g# w+ G5 T2 ]0 c
  52. #endif
    ) ~5 _) B( U9 v& K" D+ ?7 \

  53. ' w$ B) z. S6 n* t/ v. G1 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' K) V+ s/ S/ Q/ B! R* m0 |
  55. #define STATIC_SHIFT                3( s& r' g8 s5 e  W! ^0 a# M: e
  56. #define TCINTEN_SHIFT               202 k6 ^0 U0 v8 c+ C
  57. #define ITCINTEN_SHIFT              21* e+ k1 w- m6 ]3 i  c! C
  58. #define TCCHEN_SHIFT                22  {: ^' ~& t. k
  59. #define ITCCHEN_SHIFT               23$ S$ `) p6 F$ h8 g

  60. + `9 Z; n% |# U) T( d8 u
  61. static volatile int irqraised1 = 0;" U( x# B% L, F
  62. static volatile int irqraised2 = 0;' z% y2 }/ d1 M) ~  }4 [/ _& x

  63. ) ?* k+ o! S6 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) @1 T  ^, u9 V8 ^: x  g, {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 n; k% |" i- U0 ]4 D- K1 A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 |' ~6 [6 O! W3 k% Y5 H' L# Z
  67. : }) V2 X- }# `- r3 L9 ~
  68. dma_addr_t dmaphyssrc1 = 0;
    ) S! B' s5 W8 ?1 \+ E5 _* U7 U& t
  69. dma_addr_t dmaphyssrc2 = 0;
    2 E) ^; H5 @& m* I. M# \
  70. dma_addr_t dmaphysdest1 = 0;- ~9 `- @2 Z* o% e
  71. dma_addr_t dmaphysdest2 = 0;
    + A( R& _2 O+ T: o

  72.   m  [3 e) l, `& w# h, c
  73. char *dmabufsrc1 = NULL;% f7 z0 u& W4 m0 I
  74. char *dmabufsrc2 = NULL;
    & S% E: P: h" a' n# a" T
  75. char *dmabufdest1 = NULL;5 Q6 V+ c- l$ {  C  F/ x8 N
  76. char *dmabufdest2 = NULL;) h2 Q+ \, j% z/ z* j  V6 {
  77. / Z1 m+ h3 G6 J- p& X4 P
  78. static int acnt = 512;. O2 b1 t" b. _6 _& ?) F4 l
  79. static int bcnt = 8;
    ' e9 o  e! A0 J8 f5 H1 Z  n, S
  80. static int ccnt = 8;2 ]1 p5 _! w, L" |2 e) _
  81. ! n  C2 B- ^, }. O6 y+ @/ K
  82. module_param(acnt, int, S_IRUGO);
    / K7 F& P) \& O' o* g+ W. j
  83. module_param(bcnt, int, S_IRUGO);
    ; K+ d) y2 V1 F' B+ `  U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 b9 k2 x& ^2 E
, Z; W# M. G3 ?6 ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 A' f& P. f' w5 {# r. marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。9 l0 T( j1 V9 `0 z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! C( b2 n5 |5 G. z7 `
9 W. f9 c. [# c7 m% r
1 x- }1 H* W" o2 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-5 01:05 , Processed in 0.038165 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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