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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; \! e' E" Y  Y; d$ q
  1. [code]EDMA sample test application$ l7 _8 m; G# E7 E
  2. /** ~+ ~$ J7 s2 Q4 A
  3. * edma_test.c) n% ^# S/ n  I% {2 P
  4. *
    ; v, L$ f" I6 b
  5. * brief  EDMA3 Test Application
    1 E6 J3 t/ @. V0 l/ R% M0 I
  6. *
    ; O3 q/ Y9 d' I) m+ z* R
  7. *   This file contains EDMA3 Test code.
    1 e# P2 \% d- }4 s( \& b7 M) ]
  8. *
    0 Z! k) q: |6 b0 ^8 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 o  c: o& }: m5 i8 Z2 D/ ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 d  _% Y1 L. H6 T# M- I5 u
  11. *         TO CHANGE.
    % D+ X3 h/ g9 @, j* M4 c
  12. *4 _9 e" [- G1 E8 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / Y" u5 i$ k  R
  14. *2 k' m' }; P  X) `3 Z
  15. * This program is free software; you can redistribute it and/or! z; {/ N; e3 n2 _, `9 ^
  16. * modify it under the terms of the GNU General Public License as
    8 O. g# I, }2 Z: K: |3 ~: Q$ U
  17. * published by the Free Software Foundation version 2.
    / O2 }8 p% D1 w2 c2 ~! _* h3 I  H
  18. *
    9 E& m0 M. E4 e2 P4 A4 ?# n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 `% L, B! u; g; ], O
  20. * kind, whether express or implied; without even the implied warranty* u$ |9 e" h2 l' u7 H, ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ \+ J2 Z& ~- ^1 T4 L
  22. * GNU General Public License for more details.. I8 h! B& A8 L9 ^& }8 e
  23. */9 J) w7 S/ o- J

  24. 1 v$ F4 z3 F( y
  25. #include <linux/module.h>
    / R# X. n: E/ f2 Q
  26. #include <linux/init.h>
    ) ~- [! E" q" C7 o; F; a
  27. #include <linux/errno.h>, _5 G1 m& p) V
  28. #include <linux/types.h>$ c+ A, M7 {7 a! h7 }9 Z+ ?! B
  29. #include <linux/interrupt.h>2 i5 V4 Z% d% _% w$ d! C+ c
  30. #include <asm/io.h>+ S1 C6 Y5 j; q& G8 V( k1 P
  31. #include <linux/moduleparam.h>
    & i# t- H! S/ B# \0 a# u
  32. #include <linux/sysctl.h>; }3 G% c2 V, l( C
  33. #include <linux/mm.h>( m" Y' G' z9 J! V2 E
  34. #include <linux/dma-mapping.h>! F( G9 _, i; l+ ~% u+ ^9 g  F$ M

  35. % a* Q# B- A8 _3 f3 i- ?1 b6 U
  36. #include <mach/memory.h>
    . o: f6 F4 E' I0 ^
  37. #include <mach/hardware.h>
    ! F/ \7 V) }( I* x
  38. #include <mach/irqs.h>
    ; s" a7 i$ F+ r% x
  39. #include <asm/hardware/edma.h>3 P& S2 U) J7 z0 K9 l

  40. , ?: {4 I! U" }) P, ?
  41. #undef EDMA3_DEBUG
    ) J; R. ^1 i4 y8 V% Q
  42. /*#define EDMA3_DEBUG*/! m3 ]5 a7 A3 j7 A$ \* D/ d; n
  43. . r" a! D# E* K( |. N* }
  44. #ifdef EDMA3_DEBUG, R$ S- E: r3 p) z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 k" J- a7 ^  H! F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# F. N: T* G' h) q; C) ~* H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 G' `) Q! R3 R, \) H  q
  48. #else- k0 }- u( P8 p
  49. #define DMA_PRINTK( x... )
    : M8 v6 C6 k- X) T8 E
  50. #define DMA_FN_IN
    & V  _/ ]) H# M4 y0 [  C' r
  51. #define DMA_FN_OUT1 t3 e6 c! v5 H/ J
  52. #endif9 J! d0 x. W0 E& a
  53. ; y3 A0 `; R+ e5 S* O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* V8 L0 N+ G) G& @& H& P
  55. #define STATIC_SHIFT                3
    : i  ^  {  P; C4 t  z0 P
  56. #define TCINTEN_SHIFT               20
    " ~. V; |3 w$ G- Z- k' |* n
  57. #define ITCINTEN_SHIFT              21
    % K# M( R* O2 M8 h$ r, E
  58. #define TCCHEN_SHIFT                22
    + E0 V/ K" R9 U8 u$ `1 ~) l) ?, R4 Y
  59. #define ITCCHEN_SHIFT               23
    - a8 V. o7 q5 O" r
  60. 4 P4 V. D4 o( T
  61. static volatile int irqraised1 = 0;
    7 a) q' X( a4 D0 h
  62. static volatile int irqraised2 = 0;
    & v" y5 Z. G; J7 c
  63. * A8 ~6 t( k  `5 `8 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J" X) @3 p9 k3 f  i1 X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / Q! Z' a: `. r8 h1 J, \8 d& @7 B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& A) w7 s% W/ q" P# Z! Q
  67. 6 u0 Q2 q8 N  O$ h
  68. dma_addr_t dmaphyssrc1 = 0;8 E+ y' n# T) c3 D
  69. dma_addr_t dmaphyssrc2 = 0;& y5 ^9 d1 `+ T4 y; F
  70. dma_addr_t dmaphysdest1 = 0;
      [) p4 X4 s+ d4 K5 E- J/ k
  71. dma_addr_t dmaphysdest2 = 0;
    ( y" V  M6 i0 T1 q3 Y
  72. % E+ ], V+ S2 C4 b6 M
  73. char *dmabufsrc1 = NULL;
    ! `& e! J9 h5 E# m$ K% u
  74. char *dmabufsrc2 = NULL;$ b( \  V8 J- z3 z( N. H) o% |
  75. char *dmabufdest1 = NULL;  `  P" w( m- z6 E
  76. char *dmabufdest2 = NULL;0 [' m) ~6 l0 V5 K$ g) n) i, N
  77. 5 q6 Z! E. L* s! G; o- e
  78. static int acnt = 512;
    ' ?) U8 H5 y! {
  79. static int bcnt = 8;
    6 I& t% N: \  O) c( r3 r
  80. static int ccnt = 8;$ @4 m& M% l( l1 z) o

  81. 6 e% w% ?5 F9 [$ S! Y+ n# ^
  82. module_param(acnt, int, S_IRUGO);) w* a& a- c) z, }. J0 q; z5 m
  83. module_param(bcnt, int, S_IRUGO);
    1 Z0 K$ F0 v" f4 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 o/ Q8 ~" z& P( |: o& I- d- y' \. c& ~# ?6 e3 z* y% m0 K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 K1 a1 V, }4 s3 ?& [; \4 E6 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 l9 o' F2 W' Z- m6 r' ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, m2 J  X+ S, [+ j9 r9 i
0 ^7 Y2 U" s& P6 i, t% U0 m! v
! c% [8 L3 O, x& p2 l% G& X- q5 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 05:26 , Processed in 0.037975 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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