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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! ~& C9 E# T; _
  1. [code]EDMA sample test application
    6 b. P* I; b' [, k" _9 Q: {
  2. /*5 ~  Y) }' V' o1 u5 e7 }- x! f
  3. * edma_test.c; z& K: P) d6 Z- \
  4. *
    5 X! ^2 Q" r3 H. i* M3 X- A8 |
  5. * brief  EDMA3 Test Application
    3 [, n' E  H5 Y2 }* R0 h- z' m
  6. *
    / B; l: E# e( e: o
  7. *   This file contains EDMA3 Test code., B0 k8 n7 ]. n) T) Q& C
  8. */ @! m3 G  G, `7 ~  v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 Y1 m: U3 N# N7 L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 W  Q& `: Q/ ^4 ~. }5 f  O
  11. *         TO CHANGE.
    5 c2 d* o" U; z% I! a6 p
  12. *' j! q+ p1 w. V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 c  ]+ Y& U2 T
  14. *: N$ G" O8 ^0 o2 V2 f2 U
  15. * This program is free software; you can redistribute it and/or8 }" J! E: d( F; V& T
  16. * modify it under the terms of the GNU General Public License as
    : V$ G7 ]6 j7 v* {8 \
  17. * published by the Free Software Foundation version 2.
    8 ]3 w6 D; Y9 x5 |- e
  18. *5 N# b/ A$ C" P3 \, p1 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 G* [) ^# G8 |4 u
  20. * kind, whether express or implied; without even the implied warranty
    : `1 B/ C. v. i: A: k# H9 @; R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - q& K& r' Q" \2 f4 [4 M
  22. * GNU General Public License for more details.
      W, {1 l# h1 a& b5 w% e7 B( h
  23. */# E& Z3 ~) l  K; R( l0 i$ p6 m

  24. ; x. f/ p8 w, A2 f
  25. #include <linux/module.h>0 e9 F! y5 [; k; M4 t
  26. #include <linux/init.h>0 ?* @. J; p$ e( y% b& T3 \2 }
  27. #include <linux/errno.h>$ k$ z4 o( [1 m  y' I6 J
  28. #include <linux/types.h>
    / g/ z5 i; j# @
  29. #include <linux/interrupt.h>
    6 c3 H  ]2 n+ h4 C
  30. #include <asm/io.h>. f8 G% N  {! f! T" {1 s0 `
  31. #include <linux/moduleparam.h>
    0 ?% c2 K# m& ^& D& J
  32. #include <linux/sysctl.h>
    * F2 H& D+ ]- H9 f' S4 w. k
  33. #include <linux/mm.h>" ?) M5 B7 W! D
  34. #include <linux/dma-mapping.h>! J# b% z) W) M8 c) c4 s7 k& M
  35. 4 s+ B3 |7 v$ \& e; {
  36. #include <mach/memory.h>5 A' _7 D( j3 @; ?( h% Z# j2 M
  37. #include <mach/hardware.h>
    8 P; t" m: l5 Y
  38. #include <mach/irqs.h>
    - k( n* g, A% X# I' R9 |
  39. #include <asm/hardware/edma.h>
    " t5 R! s  l' y
  40. . _9 C  Y. d: N
  41. #undef EDMA3_DEBUG" x( E( b  H7 H" Q
  42. /*#define EDMA3_DEBUG*/
    . ?6 N' i% T! C- Z9 \

  43. 7 J$ p! i7 e5 D6 _! i2 N
  44. #ifdef EDMA3_DEBUG1 M  q. h- r! c/ p8 J: a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)# v+ c. ]: G' T$ Q4 x* p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ q& D. X$ f3 R# H5 m# n: j( ]: a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( `2 I% w+ q# w& v" u% O2 E$ f& A" e$ l
  48. #else
      i3 @, |7 X) K6 s* @" Z
  49. #define DMA_PRINTK( x... )
    3 l! M- I' v" D9 @
  50. #define DMA_FN_IN
      g$ g, f! ~- G
  51. #define DMA_FN_OUT# V' G& Y" z! T  D! W: D5 H) e
  52. #endif8 t$ j4 I) @: c) x/ Q5 K3 l
  53. ! r- X2 l* S1 B$ c8 @% ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 p/ [9 w% Q6 d5 Q- S4 R
  55. #define STATIC_SHIFT                3+ }/ b5 m: _3 j
  56. #define TCINTEN_SHIFT               200 {8 `: Z4 J6 e+ b$ e
  57. #define ITCINTEN_SHIFT              21
    ' ]. Q$ n+ L# C  F7 ~/ }
  58. #define TCCHEN_SHIFT                22* v; q, W3 D3 `0 u3 }) O* p
  59. #define ITCCHEN_SHIFT               23. \5 k. A; `9 j8 c. m- `
  60. 4 f3 S: p$ v( g8 t% c
  61. static volatile int irqraised1 = 0;
    : Y3 O6 Y, k) D2 R
  62. static volatile int irqraised2 = 0;  I5 F& H$ d  ^7 S2 n6 }4 ^3 J

  63. ) s* P) M1 L: j8 ?3 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / B% ~+ z3 A! ~3 \0 {1 C5 |3 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; m- A- ~6 P$ X; Q4 u5 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ A: `; e4 C+ y; u
  67. 1 y* d2 d- X# e4 t* [6 K, h
  68. dma_addr_t dmaphyssrc1 = 0;( {* D& x7 k4 d* _2 m; C
  69. dma_addr_t dmaphyssrc2 = 0;
    + q4 F" C. ^9 ~. i! W) C
  70. dma_addr_t dmaphysdest1 = 0;
    $ W% m( x" D; U
  71. dma_addr_t dmaphysdest2 = 0;
    - c) p- L' R+ ^' S! C9 s
  72. 9 ?4 k1 u. E1 D
  73. char *dmabufsrc1 = NULL;
    9 s* |: _1 }8 \. \
  74. char *dmabufsrc2 = NULL;
    0 ~: |0 |" W9 ?4 B2 j' [' a$ Q) B
  75. char *dmabufdest1 = NULL;
    ' x9 C4 G. l8 i
  76. char *dmabufdest2 = NULL;
    ( \# |/ ]1 A0 Y8 B/ N% @6 V

  77. 1 O$ p) l5 e* r5 J2 c% e, L! r. v5 t
  78. static int acnt = 512;
    - L9 `% a# s3 h. y8 H
  79. static int bcnt = 8;
    / k. x& s/ q' L6 z# v) E% W
  80. static int ccnt = 8;, E# r; W5 e% z# Z

  81. 8 [/ s4 F8 F! D* J
  82. module_param(acnt, int, S_IRUGO);
    0 b; t4 r& C$ k$ u9 H" Y# u7 I
  83. module_param(bcnt, int, S_IRUGO);
      _7 F  T- t5 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ h5 o; s8 q  N% q9 C
+ |0 K; I" ~; |+ z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 ]3 L7 w' s2 }+ i& uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。/ S; B9 h) f! _8 h  i; u5 s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ N3 o" C5 f. q, {/ o

" e7 V0 T8 O% ^/ \
) z, j+ ~; e* z% S+ d+ N* ~; L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-6 00:02 , Processed in 0.042380 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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