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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * |. u. N0 ]% e# i
  1. [code]EDMA sample test application8 D8 e: R3 {2 W9 L- m" n" b
  2. /*
    9 u/ `8 }9 c7 t1 }8 {2 `
  3. * edma_test.c$ K* a0 c! e4 }/ e6 G: c4 v; Y
  4. */ |/ K. ]6 ^8 \7 h
  5. * brief  EDMA3 Test Application+ z  h2 {2 t. r8 ~! [1 Y$ T, w
  6. *' X# e% X' C$ ?- c2 P2 M5 n
  7. *   This file contains EDMA3 Test code.
    " t# }& k2 S* G7 Q4 c/ W1 Y
  8. *  Y4 ~6 h8 n: p( ^7 M9 P9 I4 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) U# g5 @% g$ K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 X7 @4 V: V+ a% G8 b
  11. *         TO CHANGE.
    0 I4 f! z% E2 \! n# X" \7 q3 a2 L( a
  12. *
    4 i; o# }* i5 O+ L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 A+ b! v, Y7 f4 A1 R  Q
  14. *9 y) {  P% D2 e6 R- H: ?) Z6 z
  15. * This program is free software; you can redistribute it and/or
    8 I. E0 Y, B4 r( E" l
  16. * modify it under the terms of the GNU General Public License as
    # ]6 p$ R9 a$ ?5 h- Z( x2 j1 n! s
  17. * published by the Free Software Foundation version 2.3 M, O0 n, q6 g" R+ g2 K
  18. *7 j0 [2 n( c1 l! j' L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - q8 J8 q: X1 g- G# o8 R: w
  20. * kind, whether express or implied; without even the implied warranty0 }7 B+ u' Y1 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 R2 T" V% \6 J2 ?) A! H+ R
  22. * GNU General Public License for more details.
    0 ]) n8 h' W, w6 ]% m" n$ [; v( J
  23. */
    1 s' |+ T) r$ C1 V9 o" S9 d" P( _
  24. $ e" C# a- G5 P% X. V
  25. #include <linux/module.h>6 }& J; @, \  i- J7 {6 K* R- @
  26. #include <linux/init.h>
    $ s, O$ y( A$ j: x' u! ]
  27. #include <linux/errno.h>
    0 P8 z* t  O. {
  28. #include <linux/types.h>7 s" i7 v9 U7 o% B0 C. S
  29. #include <linux/interrupt.h>0 {7 C4 b8 Q" F, j4 d
  30. #include <asm/io.h>% x/ A& e$ X9 k2 p+ ^7 a8 W# K
  31. #include <linux/moduleparam.h>; \% e; Q  w' }8 f9 r5 L/ R% v
  32. #include <linux/sysctl.h>, ^& `5 O4 |: t; A8 R
  33. #include <linux/mm.h>
    ! [6 Q2 |# D& Z0 N6 O9 z7 T
  34. #include <linux/dma-mapping.h>
    - B$ O& }, t* G" i  p; d- H

  35. 3 n* R5 G6 F' z* t0 I
  36. #include <mach/memory.h>
    8 o6 Y9 k! ^2 c4 V
  37. #include <mach/hardware.h>
      @* Y" `3 ^7 J1 n3 U
  38. #include <mach/irqs.h>$ d4 z! y! y0 N6 ^! ^! _+ z, Z
  39. #include <asm/hardware/edma.h>1 ^) d% f. g2 \( ~6 N+ z

  40. & Z8 {$ I) b* V/ R8 F& e
  41. #undef EDMA3_DEBUG1 _1 a0 p7 Z  b5 _8 [6 |
  42. /*#define EDMA3_DEBUG*/
    - e: N3 Q7 o$ ]/ n
  43. 3 @9 h& q1 ~9 w4 o
  44. #ifdef EDMA3_DEBUG* E; ^5 `0 F3 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " C7 f( {2 K# p# j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 ?0 ]( E$ d2 g  l, h+ _7 s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # ]0 o0 L7 G* Z5 `
  48. #else) `7 f& K  }/ I, j+ H
  49. #define DMA_PRINTK( x... )
    ( g; |( ~, _6 M2 U
  50. #define DMA_FN_IN
    # S" E: K, |, `8 h& {
  51. #define DMA_FN_OUT, z" C9 @) V7 B( G, o" `7 E1 P
  52. #endif/ {2 T' s# X( _$ d

  53. " e9 ]" h* [0 U; l2 n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 q+ a" T9 v% Z2 G4 d
  55. #define STATIC_SHIFT                3
    7 Y( z9 Z8 _4 k& u% S
  56. #define TCINTEN_SHIFT               20
    - v3 F4 f) W, R) \) S( @
  57. #define ITCINTEN_SHIFT              21, F, `, m1 I2 [8 R. M1 }
  58. #define TCCHEN_SHIFT                224 q% x# n$ ^( ]0 i: `3 _
  59. #define ITCCHEN_SHIFT               23
    6 _! g- l6 I# r7 S3 o

  60. : M4 f. @! |# H/ n# w
  61. static volatile int irqraised1 = 0;+ N3 |8 j! l1 I, B2 z
  62. static volatile int irqraised2 = 0;2 }# {4 n: X5 j% }& k
  63. 5 F- ^4 i3 S: F) j* K5 p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. k8 w$ |$ p; U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* G$ x) L) U! k9 m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; {6 A' u' r3 u& y
  67.   o& @% X$ n, [' ^6 k
  68. dma_addr_t dmaphyssrc1 = 0;- Z& I3 H: Y6 I
  69. dma_addr_t dmaphyssrc2 = 0;& H% l+ |5 l( m4 S( T* c& b
  70. dma_addr_t dmaphysdest1 = 0;" T# B9 i0 n. B2 [
  71. dma_addr_t dmaphysdest2 = 0;
    9 @1 ]9 y0 u1 F0 O

  72. ) G4 E' i0 N6 Y2 c# E; n0 ?3 t
  73. char *dmabufsrc1 = NULL;
    $ M: b5 S# H- }" |
  74. char *dmabufsrc2 = NULL;
    5 n/ @# k8 r9 H/ I$ A1 w
  75. char *dmabufdest1 = NULL;- |% P/ ]( Y8 s. W$ R  G+ k4 P
  76. char *dmabufdest2 = NULL;/ W0 j3 I) H4 ?. M
  77. 7 k5 |* o3 b% B$ [! T8 t) A
  78. static int acnt = 512;. q- Y1 T6 C, V) z0 ?/ Q( `
  79. static int bcnt = 8;, ~# i  m/ I& ~2 R
  80. static int ccnt = 8;$ [9 g7 q1 b. l

  81. * i1 \: g8 c7 m! U' u
  82. module_param(acnt, int, S_IRUGO);# w8 h: X  m/ n4 j
  83. module_param(bcnt, int, S_IRUGO);$ U0 R8 f3 U# G" V8 i3 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 I; L4 r4 x. _: y/ d  p
  j! [/ O: R7 j8 y9 }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: s' `1 Q, L8 v4 c2 varm-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 W3 H- r  ~% v2 s7 l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( L; ]* u% B5 f9 \; O* R
0 u6 @0 W& _- @
& U, M! X& C. Z9 v$ O; S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 19:14 , Processed in 0.038898 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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