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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # \, U2 Z0 I' U# ^# T3 g4 ~- E
  1. [code]EDMA sample test application
    & r* _: y8 Y8 D4 o1 k5 R( h( q
  2. /*
    ( q4 _4 r7 i; B0 ?1 A# V
  3. * edma_test.c/ r) S4 Z* o0 K7 `9 p5 {/ D
  4. *
    0 X' R: q$ t; P3 H. b4 R; L0 L
  5. * brief  EDMA3 Test Application
    . o- t. k5 b  w7 Z% b# p, C
  6. *0 l' k' Z" \  _. G3 Z7 l
  7. *   This file contains EDMA3 Test code.
    / I% `2 j" ^& a) M0 E
  8. *: o$ l$ k2 r) X$ |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# o& K  `4 j/ T3 ~6 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ i2 ?( B) E5 F) E
  11. *         TO CHANGE.: _; F3 t# p0 a5 M% V; u% r
  12. ** r/ V$ t# }) c5 N; J, d- ^8 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// m. w3 b: W$ w  V# K5 q1 z
  14. *$ `8 H) h5 `( b
  15. * This program is free software; you can redistribute it and/or
    + }2 D6 ?# t# X9 \, [- J- [
  16. * modify it under the terms of the GNU General Public License as" \4 p! s' T1 f7 P0 ]+ X  Z: I+ D
  17. * published by the Free Software Foundation version 2.: U7 m; q4 E( w, E% H) y1 d1 F
  18. *
    ( a7 F! `% q3 J6 a- S. A7 _' T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( g6 A1 I& \' O" H$ T
  20. * kind, whether express or implied; without even the implied warranty) _1 l# h5 \  U  f$ C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 r% s. j* W$ K3 f+ ~/ {# f* C. w
  22. * GNU General Public License for more details.
    * F1 `9 ?4 i# B+ G0 P& g1 R! a
  23. */
    . e9 [3 A4 q2 P) E

  24. / j+ w' n$ k9 s
  25. #include <linux/module.h>! r5 f3 r- Z+ r( a
  26. #include <linux/init.h>$ N# [) f+ b! ]$ H
  27. #include <linux/errno.h>
    ; R  ]( R( g: _! U4 e9 f
  28. #include <linux/types.h>3 |0 Y& [  b2 T
  29. #include <linux/interrupt.h>; x( H3 ^, R; H& `/ U# G8 `( `
  30. #include <asm/io.h>
    : A4 G' ^" w) \2 R  C) W+ m
  31. #include <linux/moduleparam.h>
    ! b0 f8 \6 b- Y! ?# a6 f# W
  32. #include <linux/sysctl.h>+ z( T( }" P7 u8 A5 g# V
  33. #include <linux/mm.h>- h8 H" ?) |7 ?) p- C% h  m
  34. #include <linux/dma-mapping.h>
    : o2 M, |& e& u9 d
  35. 1 Z/ E0 k6 I# L5 t# M# l- ^( u4 ?
  36. #include <mach/memory.h>
    2 h" G2 s! p% E& J
  37. #include <mach/hardware.h>
    ! T1 \6 t. O( N
  38. #include <mach/irqs.h>, G2 h( B# s# V
  39. #include <asm/hardware/edma.h>
    / q+ {4 S6 A) K, f/ L
  40. 5 i8 N& ^2 A6 Y9 p7 I0 |4 a
  41. #undef EDMA3_DEBUG, S- s. H3 Z& N% ]$ B1 ^
  42. /*#define EDMA3_DEBUG*/
    ! ?$ K, g3 {. K5 T+ K% y) y7 ~6 l

  43. : H- N+ ~. O8 o+ p0 Y4 Z4 r( R
  44. #ifdef EDMA3_DEBUG
    & M( u3 B# y7 N: Y2 [6 K, J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 n, U0 z' v6 M) _
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" D% ~" |( u# i9 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" P' Z/ e, j. c/ n
  48. #else
    - u* b( }' M0 D  a
  49. #define DMA_PRINTK( x... )5 o, k4 I3 C- H- n4 e: z" K+ V
  50. #define DMA_FN_IN
    0 B5 m7 g% N7 T* V9 l) w
  51. #define DMA_FN_OUT
    ( I& C' b9 a& u. C) c
  52. #endif
    $ a+ ^" x5 ?( R5 ^! K" S

  53. 8 P. h1 p/ V, i: x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 j* i  {" p! a5 I" z% q. F
  55. #define STATIC_SHIFT                3
    $ O3 \' u7 s+ @) d. R1 w7 r
  56. #define TCINTEN_SHIFT               20
    # Q! U! j$ r8 y1 D3 e3 {
  57. #define ITCINTEN_SHIFT              21
    . A7 a! T5 G' h, }+ W9 ~
  58. #define TCCHEN_SHIFT                22: z9 Q! X! i  h6 L7 N- [
  59. #define ITCCHEN_SHIFT               23  A4 G$ M5 r" J) E4 w+ X& O

  60. 7 e" a' N( g0 R! |+ E
  61. static volatile int irqraised1 = 0;  s* I( l) G3 H, D$ O
  62. static volatile int irqraised2 = 0;
    7 }2 n0 K/ X5 P7 {4 F

  63. - E% [8 b( u: h5 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 T7 U* A4 ~' _! d' ]6 B5 w% t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 D4 E+ t1 c( i/ k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 W( g! x: U" L) p! n

  67. ( [6 D8 X; k+ P5 B0 Y
  68. dma_addr_t dmaphyssrc1 = 0;$ }0 N8 ~) l! W: X
  69. dma_addr_t dmaphyssrc2 = 0;
    : S# I) a6 K% X; k+ j4 `
  70. dma_addr_t dmaphysdest1 = 0;; P+ U' \, U2 O) ~
  71. dma_addr_t dmaphysdest2 = 0;
    4 _" j$ F' U7 \% _" w$ e& x$ L* W

  72.   u4 p# U6 l$ C4 v% X" X2 V$ d
  73. char *dmabufsrc1 = NULL;
      Q, O2 u& L: g: M$ @
  74. char *dmabufsrc2 = NULL;
    & B5 A1 ?& |/ k) D% W2 G
  75. char *dmabufdest1 = NULL;$ P3 J- d+ U: t! h0 S
  76. char *dmabufdest2 = NULL;
    5 `2 p2 O. t$ c

  77. 5 {3 |2 H! T9 ^# a. M
  78. static int acnt = 512;( D. [* @/ I+ Q1 r
  79. static int bcnt = 8;8 h) W! Z) H" Y/ f
  80. static int ccnt = 8;4 {% b1 Q3 J/ n  c3 n& }

  81. # U" c1 S+ y. D& V: V2 H
  82. module_param(acnt, int, S_IRUGO);
    * h4 w3 c9 o6 d% S- u
  83. module_param(bcnt, int, S_IRUGO);
    3 j# d. y! b) Z6 p5 f1 z7 G' v, o" b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% j' H  [& j6 @* V; U
! ?$ N2 P9 S7 C4 S! \
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% i6 S3 U+ O9 Z5 Y3 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 G8 E2 [4 q+ [$ V     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( p  H+ G+ J( y" y9 N) h/ T( W) T1 b# |" k9 e+ S: B% F
9 P4 j2 h7 P5 v3 w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 12:50 , Processed in 0.037893 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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