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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, Z: b7 g: D1 t
  1. [code]EDMA sample test application/ e9 _  v, G; F9 T% H4 l
  2. /*
    # K* c' g) E6 l. e, D( w
  3. * edma_test.c  U, E& M- c' @; R) Q. d1 y
  4. *" _8 {, n5 T( f: u3 m4 T
  5. * brief  EDMA3 Test Application5 B0 b& j% n1 q. G
  6. *+ [5 [. d/ o! ~4 y% k: S/ \( ~
  7. *   This file contains EDMA3 Test code.6 s  g1 K. k& {. [% V" s! s$ y: s
  8. *
    - t& A5 M$ B6 |# |, L% ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 m3 E; U% i1 ?" d9 ]1 T! f+ {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 O, k- b1 C- q9 i0 j# |
  11. *         TO CHANGE.) a9 H( M1 e  L& \$ q7 G$ C
  12. *' F7 }3 _  y! v* V8 d4 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # I9 F/ x6 c2 K( }
  14. *
    ! A' x$ S; \+ Q% T* `& {
  15. * This program is free software; you can redistribute it and/or8 @9 W0 s  A8 m
  16. * modify it under the terms of the GNU General Public License as
    ( R- r3 y1 @! ^4 N+ [+ Q
  17. * published by the Free Software Foundation version 2.7 ~* b1 H; W8 I& a4 S* b% @
  18. *- d+ C' K* i* G! i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 q+ ]( m# _0 D! A# g% G8 z
  20. * kind, whether express or implied; without even the implied warranty# l4 C& B/ e+ {5 f6 C$ \, b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 O7 _4 z1 x+ \
  22. * GNU General Public License for more details., `4 `: G6 E( E+ Q1 [$ u) v
  23. */" N( E: M7 n2 P0 k0 l9 c: w

  24. # J( ^: A. L" X
  25. #include <linux/module.h>" J" E" d$ w: e* O0 @( j+ D2 q
  26. #include <linux/init.h>
    7 p* \5 J: E2 ]8 D% G7 N2 m
  27. #include <linux/errno.h>
    6 A. Q* o, H# `& y* F" p' P
  28. #include <linux/types.h>6 H# ^  ^1 n8 N6 K2 B9 ?# M3 A) o
  29. #include <linux/interrupt.h>
    ( ?. I/ a, X# q' O$ m' M0 y: {
  30. #include <asm/io.h>; S8 N9 `1 R, S* A% D( O4 J
  31. #include <linux/moduleparam.h>% a% v' l: _" E: J" `5 y
  32. #include <linux/sysctl.h>
    5 x3 d( H3 X- r7 f6 y7 N3 V3 ~9 {
  33. #include <linux/mm.h>3 J: h; C, R& `! O: r: y& g. q
  34. #include <linux/dma-mapping.h># F9 E7 M1 m2 ]* K* k% i* p+ c

  35. * p. N" M  q1 U# J
  36. #include <mach/memory.h>
    8 ~1 b2 w. ~8 D! z( f# r% x5 V1 a
  37. #include <mach/hardware.h>; x6 l4 _- C( j
  38. #include <mach/irqs.h>
    ' x3 B5 B( _4 ?3 l0 j8 W
  39. #include <asm/hardware/edma.h>
    - l0 ~2 Z3 k% f( w7 l

  40. ) {- d& J" f8 J3 h" y
  41. #undef EDMA3_DEBUG9 A. ]7 q7 ^4 G$ @7 \
  42. /*#define EDMA3_DEBUG*/6 b& I) ?  {, Z3 x
  43. 4 K4 {; w, w- e& Z) M
  44. #ifdef EDMA3_DEBUG
    4 H7 T5 h/ |4 e2 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  _7 Z+ y5 S8 n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 v7 z! e) b6 m# ]8 i9 b' D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / R8 [" }3 I2 R
  48. #else  C/ x0 \6 k" J1 _7 _& R2 c
  49. #define DMA_PRINTK( x... )
      f) h3 G$ J9 x4 [& y' e
  50. #define DMA_FN_IN3 T5 v7 M% F  B; W
  51. #define DMA_FN_OUT
    , {; b6 Y& s  [, N1 U' F
  52. #endif9 V7 H, R! k5 ~' R" G/ ^: S/ C* N

  53. ) N% [4 G# W, K( `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- X' a) F6 Y' C
  55. #define STATIC_SHIFT                37 e( x0 n+ v6 _! W
  56. #define TCINTEN_SHIFT               203 C( i  W% P) b! O  r3 l4 c. d
  57. #define ITCINTEN_SHIFT              218 h8 M3 }$ h% l& F" J' f3 K; @
  58. #define TCCHEN_SHIFT                22
    ( e/ W2 p4 g- U9 @. O. ?! S5 r/ Y
  59. #define ITCCHEN_SHIFT               23+ _0 q7 }8 N$ ?( n) C
  60. 7 C$ m1 ~8 v+ \/ R. S+ p
  61. static volatile int irqraised1 = 0;
    6 k; Y, v; ~* L0 c
  62. static volatile int irqraised2 = 0;& L" {8 _/ X: ^5 d

  63. 8 F" a4 {# J) A* C$ P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - O/ G0 k, J% w1 i' Z- B1 y( Z( ]9 B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      s6 Y7 K! B0 ~" v$ B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 H; W6 j1 ?  X- ^2 E9 ]
  67. # [8 ?& V( G/ K" l( j$ t
  68. dma_addr_t dmaphyssrc1 = 0;
    % A7 P6 V  O. T0 B2 f7 x' O
  69. dma_addr_t dmaphyssrc2 = 0;) D1 r! H$ x7 g2 ~  _" T) q
  70. dma_addr_t dmaphysdest1 = 0;
    7 N1 I4 N- d2 _7 g( ^; }! u
  71. dma_addr_t dmaphysdest2 = 0;' l7 @8 r6 O) P1 |) k

  72. : G8 n, ]1 n6 m5 O' {0 I: U, x) p
  73. char *dmabufsrc1 = NULL;4 l9 \8 h5 H* ?- R( ^; X) w
  74. char *dmabufsrc2 = NULL;% ^% l9 M' j! I8 E
  75. char *dmabufdest1 = NULL;
    % `5 h' Q1 f& W4 h$ l; s
  76. char *dmabufdest2 = NULL;. u+ n9 c* B. x* {. B0 C) X
  77. 4 \3 K6 }# v+ l8 |4 O: q+ y
  78. static int acnt = 512;
    % {! }- R, s3 k# |9 q
  79. static int bcnt = 8;9 V" l  E4 S, d: D9 C
  80. static int ccnt = 8;
    + O1 f" X; l5 U+ p

  81. ; l! X5 p- J% G+ w( _7 ?
  82. module_param(acnt, int, S_IRUGO);
    3 V! Q- X; _5 x# h1 B, a  z- W( u8 m' b
  83. module_param(bcnt, int, S_IRUGO);1 }; V+ }$ x9 }" k3 O- F* v3 t$ G
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 G6 C1 a# r2 p# V" b

* Z: A! H/ ^" `' Y. l$ N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 u, |, o& p+ @( r% w' ~
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ X  y3 H9 T7 X4 m/ k. @. W7 a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  u; L% U+ G+ R& f3 K
( L9 p- J& W/ s( j- h/ e. V. o0 ^( ]
  Y' c* D  |# D2 }8 u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 16:30 , Processed in 0.045180 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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