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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ B" y+ E0 i7 \% n  O% r8 R, s) O. j
  1. [code]EDMA sample test application8 ?* J1 ?. v% C5 F3 E+ ?0 E. W
  2. /*
    7 ?4 M+ s; C  V* F
  3. * edma_test.c
    , _  u% O1 p! [" ^. Y
  4. *
    & |- q) s2 H7 ?8 ?; {( ]9 W2 g
  5. * brief  EDMA3 Test Application
    5 ~- s' l. c$ L) U. p
  6. *: p9 E' j! _4 N. r1 o" O
  7. *   This file contains EDMA3 Test code.
    7 i- i. ]  ?9 A) q" r, F* m
  8. *; F: \& J' k  u6 C0 H6 A5 b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 {: `6 t1 z9 h; a$ z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 ^, h% O3 Q0 G; g( R$ _% B) b$ o
  11. *         TO CHANGE.4 n' R! s, d( s
  12. *
    0 u- V, T5 J$ C& p9 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      U1 p/ v, ]2 P$ I6 n# B9 g
  14. *( K1 B1 @& v. @, Y6 ~
  15. * This program is free software; you can redistribute it and/or4 d1 X4 w: l# [
  16. * modify it under the terms of the GNU General Public License as
    0 l' S1 r3 d# s3 I+ m; O* P7 c
  17. * published by the Free Software Foundation version 2.4 X3 `- ?5 g8 ~% M. y& Z# e
  18. *
    7 M2 K( k$ ~* N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' k* H. w- B; m# @
  20. * kind, whether express or implied; without even the implied warranty
    9 F3 Q  w  Y! ^7 L/ J% A& v$ G  Z6 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * S7 h+ O+ G5 M0 W% c/ i: \  I
  22. * GNU General Public License for more details.1 V( r3 K3 v  t: l4 Z
  23. */) A0 h5 ]$ ?9 C5 D5 P0 j9 s

  24. 7 H/ A9 i  S/ X9 W$ g7 _% K9 S
  25. #include <linux/module.h>* j# J* U$ S9 ^1 \4 M6 o
  26. #include <linux/init.h>; w7 ^6 J. @; G
  27. #include <linux/errno.h>& Y* V, R1 Q# E$ m1 ~
  28. #include <linux/types.h>
    4 u" R8 S& u, Y2 B5 r
  29. #include <linux/interrupt.h>* ?/ J( P) E8 o. B8 Z. o; [
  30. #include <asm/io.h>
    + a5 d* I) @" ?1 x9 D$ S
  31. #include <linux/moduleparam.h>9 {4 z3 V6 t7 @( l5 h) r
  32. #include <linux/sysctl.h>( T) w2 s! ~* m$ Z
  33. #include <linux/mm.h>
    , S0 Z! E7 U1 m& D. B
  34. #include <linux/dma-mapping.h>
    1 B( Q- T: `0 J  \% L5 A8 A9 e  `

  35. 4 ?; y* q1 k! S/ B1 C' `0 l
  36. #include <mach/memory.h>& s! L9 s! F& D% I' {# k* @
  37. #include <mach/hardware.h>0 w. a1 P% K" U: R, X$ ?
  38. #include <mach/irqs.h>& J, \7 ]1 C5 B% C# V, P6 F8 n
  39. #include <asm/hardware/edma.h>: [# a! p4 _  b; t" z

  40. * Q. ~# Q$ b1 p7 i3 B
  41. #undef EDMA3_DEBUG
    ' `3 b8 y' z, N
  42. /*#define EDMA3_DEBUG*/
    4 K# w3 B8 Q6 c3 r! r- k- P7 x
  43. 0 z; ]% a5 }5 F( j" B8 O) w
  44. #ifdef EDMA3_DEBUG
    - ]5 S: [9 Q! j' I- ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 |( x+ b: t% E0 C( U8 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& {5 I& v3 g0 b8 n. a- m2 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 C) C/ M% e6 g  |) i1 @' E9 u
  48. #else
    . u8 C$ s* C+ i
  49. #define DMA_PRINTK( x... )
    0 }  z# |. r/ P9 ^& G7 _
  50. #define DMA_FN_IN
    9 |* r, T; x* {; C/ G. G
  51. #define DMA_FN_OUT
    - G, `- W; Y: w, @0 U# W1 z
  52. #endif/ {6 m+ f. M' v7 j; f

  53. . c7 d0 N, k+ Y3 n* L! x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 v. ?( A# b/ \  K
  55. #define STATIC_SHIFT                33 a" J3 J' c8 Q3 y, B4 w, u
  56. #define TCINTEN_SHIFT               20; A; G' c9 }1 g! L; |/ g3 `
  57. #define ITCINTEN_SHIFT              21
    ! e, M, f" Z5 g
  58. #define TCCHEN_SHIFT                22
    4 t! F8 Z+ E6 H2 _0 e  H
  59. #define ITCCHEN_SHIFT               23
    4 W* r# v# x& N; }' ~* k  j0 p
  60. 3 k! ~5 ~) o5 F1 ?7 M
  61. static volatile int irqraised1 = 0;
    1 k9 T$ m+ s* |
  62. static volatile int irqraised2 = 0;
    6 H. ~) e& c1 @! c) s
  63. $ Y# ~. x" D) k* |+ L% w; W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 @7 v) u3 `. ~% B: `; H8 U( k2 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. t# d& k) k/ e- v! @1 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) ^7 B: y" I4 n4 z

  67. % p0 G8 r* B$ b; b
  68. dma_addr_t dmaphyssrc1 = 0;* E3 L, \( `9 U/ T5 v" j# p! x$ z
  69. dma_addr_t dmaphyssrc2 = 0;8 y/ q; O: C# \, O
  70. dma_addr_t dmaphysdest1 = 0;
    : m: V6 q: F# ^3 ~; w& [: s
  71. dma_addr_t dmaphysdest2 = 0;2 V7 W( U4 U" w/ U7 k4 E

  72. 0 D  ~! K7 c3 _6 p
  73. char *dmabufsrc1 = NULL;, [% M% Z" ?( x6 D6 n
  74. char *dmabufsrc2 = NULL;
    1 X4 d$ b. a$ X, _) ^0 _" K0 k
  75. char *dmabufdest1 = NULL;
    , u& X, }0 @/ K
  76. char *dmabufdest2 = NULL;( o/ _9 @$ s; [9 r- l2 k, ^, t

  77. ( _, E& U( V1 ^# E' t" D$ p& m
  78. static int acnt = 512;$ v, {) v: n: M2 N7 S
  79. static int bcnt = 8;/ m; e# N( k0 B
  80. static int ccnt = 8;- ^: o5 S% \( p, P% r2 N* D. n

  81. / E& h9 K% c/ u3 F6 k9 W( i3 f- C
  82. module_param(acnt, int, S_IRUGO);% \9 I# o& ~! V) l: r) d! R% L: s
  83. module_param(bcnt, int, S_IRUGO);/ L1 H6 u: |. j! E9 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 n' \( V( e" P# A. c4 P: }2 }/ L4 D! H4 f- ?5 P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 v8 `2 k" X4 I2 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 `0 I* f8 w; `3 a& b1 @( @) m, o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 w- H) t8 W0 n; |" K9 S9 F$ o" L3 q& I8 F9 N

+ L- h6 r9 z+ N0 P) N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 03:36 , Processed in 0.041488 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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