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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# O6 Z3 g1 t  E4 ~3 G
  1. [code]EDMA sample test application
    $ F: J: @3 @/ J# K
  2. /*" J' X* S8 D* D# o, T
  3. * edma_test.c
    8 k$ V5 H( I8 S
  4. *& a& v/ ~) B: u3 E1 V# K% C
  5. * brief  EDMA3 Test Application
    ! U; c; b. L( ]; B
  6. ** w1 a  M# C& Y
  7. *   This file contains EDMA3 Test code.
    # M  f& u8 V' ^% n. U3 ?5 J
  8. *
    6 _+ j/ i( X, A; J  A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' q0 q" \; D! ?0 c* t6 ^2 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 z5 |6 T: z) ~9 \, a- k) T1 |
  11. *         TO CHANGE.( d  Y5 U! U" f0 c- Q. F
  12. *
    9 f# z6 c: h" K5 e+ K. g7 n7 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// w7 z& I. e- v
  14. *
    4 B: @0 c4 ^5 H/ u$ S. X
  15. * This program is free software; you can redistribute it and/or9 d2 O5 H, N- J7 Q
  16. * modify it under the terms of the GNU General Public License as: E9 f4 C7 \* a7 N
  17. * published by the Free Software Foundation version 2.6 e! q' O* q2 y3 V& E: Z! c, j
  18. *
    / f/ _; [% A/ b- S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 _1 X$ V& P  K6 ?, P7 M9 o
  20. * kind, whether express or implied; without even the implied warranty
    * q$ W% S8 ~* O: A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 h" s- L# ]7 }: M
  22. * GNU General Public License for more details.3 F4 b, h4 H5 t9 i& s
  23. */
    4 _+ I- y: E; V3 }, _

  24. + X" [/ k  N3 K! ?8 c, l8 K
  25. #include <linux/module.h>
    ) P: [; A* e) {5 i/ Q+ M
  26. #include <linux/init.h>5 ?/ [' f+ H0 w! U' f) Y$ U
  27. #include <linux/errno.h>
    , [% g: Z. T3 u! ]8 j4 s. J
  28. #include <linux/types.h>
    $ B4 y# V4 y5 O5 P- L
  29. #include <linux/interrupt.h>& z' N: ^2 Z# K
  30. #include <asm/io.h># [# R! j* O: U
  31. #include <linux/moduleparam.h>
    ! J/ z% ]1 g+ p! M1 c, R# n, w
  32. #include <linux/sysctl.h>
    8 G1 F. ]) I6 C8 b( S5 |, I
  33. #include <linux/mm.h>
    : o9 a8 s+ R; b( ^: X
  34. #include <linux/dma-mapping.h>
    . t5 ]5 _  t# B+ S7 S
  35. & s; v/ r. F4 Z6 P2 F7 d& a
  36. #include <mach/memory.h>: n$ ]9 ?1 v7 o5 d: a7 l/ J5 b
  37. #include <mach/hardware.h>
    5 R! ?& W2 C* B9 I/ [. h
  38. #include <mach/irqs.h>0 D' b; f3 u; H+ c; W9 t! p
  39. #include <asm/hardware/edma.h>
    % l% n1 a3 p0 v) I! `7 W( Z3 e
  40. ' A# ^8 o: l0 l7 P( V) Q# f4 K
  41. #undef EDMA3_DEBUG. H5 D) G$ `% u, K$ o5 r
  42. /*#define EDMA3_DEBUG*/! w/ }3 h& W9 J1 N" {- w
  43. 1 Y; E! m/ F& N8 F+ j5 d9 g
  44. #ifdef EDMA3_DEBUG, d; A8 C/ z) U5 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 q6 x2 n6 W% G9 B2 k+ ^. m) v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)4 O. o1 E4 u- ?6 Z6 t; E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    7 X/ \8 r) ]1 x0 K) g. X
  48. #else, k: X  t- F! B* q2 p4 c; h% v
  49. #define DMA_PRINTK( x... )
    ( j2 S# C/ A! V, t
  50. #define DMA_FN_IN1 K# O+ \( p! j- L/ Q
  51. #define DMA_FN_OUT
    2 N' q5 O: Z4 `( R
  52. #endif% A8 R9 s5 d' ^4 ~2 V4 a
  53. ; O9 W- z( {/ ~+ h+ z$ z# i7 ]! h. d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# D2 ^$ L( }+ m" c
  55. #define STATIC_SHIFT                35 S7 [; w. B( s8 [- c, i" _
  56. #define TCINTEN_SHIFT               20
    8 M4 J. x6 o1 B/ {" L* M$ o5 V
  57. #define ITCINTEN_SHIFT              21* d% J% E; T/ n8 P. x
  58. #define TCCHEN_SHIFT                22% w8 b# L( O9 V4 _" u! q! {
  59. #define ITCCHEN_SHIFT               23
    . k- J/ t2 X% ?: y- l

  60. - G8 r7 j6 g' l$ m
  61. static volatile int irqraised1 = 0;  i* e4 j) i* T
  62. static volatile int irqraised2 = 0;
    ; Q0 p. }0 E! `

  63. ) @3 Q9 c2 V. _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - Y' N( F9 P0 `: X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 [% X  |. v3 ~3 F6 z, [; h0 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * z+ J5 X2 V$ ^
  67. 9 o1 @( A4 g5 E& g) ^
  68. dma_addr_t dmaphyssrc1 = 0;- z) a5 ~" S; P% k
  69. dma_addr_t dmaphyssrc2 = 0;
    $ P9 \4 X6 |& n$ H) _1 ~
  70. dma_addr_t dmaphysdest1 = 0;7 c3 S, V1 [  r1 X
  71. dma_addr_t dmaphysdest2 = 0;
    7 Y1 V- p' ^8 @! {4 T  |

  72. $ j  {% z: n# p0 S- Y" o
  73. char *dmabufsrc1 = NULL;8 v4 K: X+ w4 A1 l$ Y: {
  74. char *dmabufsrc2 = NULL;! p% s( Q* _. ^$ L" [
  75. char *dmabufdest1 = NULL;
    5 R8 o4 U' {, c
  76. char *dmabufdest2 = NULL;
    / ]% m4 w& D1 q9 `8 F0 [) y( F. ~0 {
  77. 6 L2 r. v2 S/ G
  78. static int acnt = 512;$ ?6 _7 @1 ?% g( U8 ^
  79. static int bcnt = 8;
      w( t5 {+ F6 b  t
  80. static int ccnt = 8;
      b0 U: ^2 A9 S
  81. 9 J; l; D2 u; f9 N
  82. module_param(acnt, int, S_IRUGO);4 L8 }& ^% H9 A* E2 W( c% m
  83. module_param(bcnt, int, S_IRUGO);
    ) ]; c; q. H# w" I% j' @0 C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) i2 ]0 _7 H# v2 {$ ]) U
4 {8 T7 p& n' b/ M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# s2 G8 B/ H* A- i% x. |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* \. B& ^7 q2 ~) ?# b' p& a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 j" U& i3 L% H' }# ?( o+ Z( t- m# o/ J$ f8 P( I2 x8 l' O
( x: j9 W4 b( v6 `; a& Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 04:52 , Processed in 0.038047 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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