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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " d+ _5 \( Q3 C  r" ^. E
  1. [code]EDMA sample test application8 L# {6 c: f) A, d
  2. /*' Q5 t, U1 {9 T6 V
  3. * edma_test.c
    3 s, A/ ^# x( T6 A
  4. *& e& @4 H( O1 i$ j
  5. * brief  EDMA3 Test Application
    # G+ e/ V$ F8 i5 v0 k
  6. *9 J' n8 x* u* f2 {& K# z
  7. *   This file contains EDMA3 Test code.& a* R8 X) ~* E! T
  8. *
    ) I/ e9 {9 J6 w# a0 O* `: Q1 q- g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) d: O8 d- L6 n. [4 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 \' x+ `+ P. S9 X8 g
  11. *         TO CHANGE.
    4 S. t1 @2 f# C( Q  s
  12. *, G6 v& s% _" c8 T+ B6 p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) s2 \6 r0 R. Y  g) I
  14. *! Z$ U3 j! @3 B. h- b
  15. * This program is free software; you can redistribute it and/or
    ( s) n5 P; U0 e9 W7 t% T! r
  16. * modify it under the terms of the GNU General Public License as
    $ w& ^$ a' Y! N8 P5 M
  17. * published by the Free Software Foundation version 2.' r: s1 [" X/ t+ c- H! ?
  18. *
    " x! |1 D# I% C* `, B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 |! y/ J$ @2 f+ j% `5 }  o
  20. * kind, whether express or implied; without even the implied warranty
    3 o: K/ ~7 c, Q0 @8 [8 L) c4 a3 K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - Z" @' |- ^3 r+ L, l) w
  22. * GNU General Public License for more details.
    4 @/ W- j- r- Q) ^, q
  23. */2 l5 U, P' F/ ~9 `+ z

  24. 8 Q# g* C, v, v3 h; G
  25. #include <linux/module.h>% ~, D7 [+ l: T' {5 J' `1 M+ W: r
  26. #include <linux/init.h>, ~: \- e% {8 r% B# m
  27. #include <linux/errno.h>% m5 F6 p8 g1 C& p% Q
  28. #include <linux/types.h># _/ c2 W  V( j3 @1 G1 P& a
  29. #include <linux/interrupt.h>5 g9 y- n+ [' o0 Q2 }
  30. #include <asm/io.h>( d8 q$ c) |& y  L, W! _# \7 `
  31. #include <linux/moduleparam.h>
    5 ]4 C& ~1 X* v( @2 p4 m+ o9 m
  32. #include <linux/sysctl.h>
    # i& H4 H; g5 l- F7 H
  33. #include <linux/mm.h>. {4 \9 ~0 S. @- t
  34. #include <linux/dma-mapping.h>& @. B+ N7 d) K

  35. # a& n% V4 _2 X1 u& V+ a( p6 ~
  36. #include <mach/memory.h>/ x  G# e8 f1 y) X! h
  37. #include <mach/hardware.h>
    ) h, r' i- I+ \/ W) }2 Z3 e
  38. #include <mach/irqs.h>" {) o/ U2 Y* ~
  39. #include <asm/hardware/edma.h>
    : I1 m' X. s- W% y1 f# }

  40. 9 m! M1 p' ~6 t7 \7 c& s
  41. #undef EDMA3_DEBUG
    , }6 o- G8 w4 E) Z, q/ W
  42. /*#define EDMA3_DEBUG*/
    ' A7 V% c7 ?4 M2 r7 a+ x

  43. & `4 _+ d8 L  T* f: {2 {4 u6 h
  44. #ifdef EDMA3_DEBUG8 U  ?& u8 }* i  ~% D( m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' r6 B& t' m1 U6 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 K, [" T. s5 [" n" [% g+ s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' K5 [6 u3 e# D: }& [; M6 d
  48. #else
    1 \( l% B9 O6 f: z/ v
  49. #define DMA_PRINTK( x... )1 Z" A8 o! q- m( a/ O* a, p# y  h5 V
  50. #define DMA_FN_IN
    6 x1 N) \- m" b: f' |
  51. #define DMA_FN_OUT
    , R/ G2 g, E7 _8 m; Y& n
  52. #endif0 M# N5 V  m( N4 {

  53. 1 c; G3 D, x9 j0 N% N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 @3 u5 k# y9 N5 c+ \, s
  55. #define STATIC_SHIFT                3# {7 ^! ?1 `1 a4 r+ k
  56. #define TCINTEN_SHIFT               20
    & m7 v. x) G7 Y! Z+ K" J6 ?+ M
  57. #define ITCINTEN_SHIFT              21; L+ {2 v* @' u5 V* F. L" d' Y
  58. #define TCCHEN_SHIFT                22" }8 H7 d# c. H0 D3 _5 W- Z, [; C
  59. #define ITCCHEN_SHIFT               23
    8 g/ n; E% s8 S5 o4 @8 |8 m
  60. ; y) H4 j+ l2 |8 I# g* w( y
  61. static volatile int irqraised1 = 0;5 H8 m, ?( T) v5 Q
  62. static volatile int irqraised2 = 0;$ L; H) V& V" q/ M. a' @
  63. 4 g& v6 e. L$ E) v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , S2 ?0 f* A% i; D0 ~/ c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( }7 O9 C5 m6 N9 e9 d0 R! G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 I: s1 p* _$ J* n+ E# T; E

  67. 2 f$ a% Z) ?, f" Q* ~
  68. dma_addr_t dmaphyssrc1 = 0;5 C- k: `" k# Q* a7 ^
  69. dma_addr_t dmaphyssrc2 = 0;
    - y. g, L4 I3 \. C& S) G
  70. dma_addr_t dmaphysdest1 = 0;6 E  s: ]+ W0 Q5 }" L2 n0 e7 D4 v
  71. dma_addr_t dmaphysdest2 = 0;( L5 d/ z" r. {" M

  72. ! o, |0 O/ d: E' r0 T- I
  73. char *dmabufsrc1 = NULL;
    , n) d  _% z. B$ t7 P  f. _! J2 N
  74. char *dmabufsrc2 = NULL;
    8 |) r, W3 C3 G
  75. char *dmabufdest1 = NULL;
    ! Y4 ^/ @* [9 M
  76. char *dmabufdest2 = NULL;
    8 \6 }. J5 i5 p
  77. & U& z/ k/ s7 M# _
  78. static int acnt = 512;
    % C1 i8 g/ G" V
  79. static int bcnt = 8;* N$ G) H$ a+ t( b; e( Q6 C3 X1 |2 T
  80. static int ccnt = 8;
    # S  R' [8 m3 y% j( @0 F0 n4 J( E6 ^! g

  81. ; P4 `$ C$ P% i, s
  82. module_param(acnt, int, S_IRUGO);
    $ Q  ~9 E6 S: J  b" ~* U* T
  83. module_param(bcnt, int, S_IRUGO);
    ' Q' y' b  _" j+ u$ @7 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# j' t6 }) S. C$ U5 o. }% C

" E, p! f# R7 h2 n* g7 ~# ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; s+ V+ M6 w: ^& c9 X4 P  earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) p2 M+ Z" O* }3 ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: k9 d4 C, |" g4 |4 I' h% f; Y
2 ?8 d# F; ]3 |2 P+ s  r" ~/ @4 F
$ v$ G2 k" ^6 n7 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 06:19 , Processed in 0.038950 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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