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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ x! V3 a+ [1 j3 J$ A% W/ |5 o
  1. [code]EDMA sample test application
    9 u7 s, J: l$ T4 a, N/ y
  2. /*/ ~2 C# H+ c+ ^- v" p
  3. * edma_test.c
    5 o$ _% f% f( Y9 H7 _) y
  4. *
    " A7 {; Q4 n6 B3 k+ l
  5. * brief  EDMA3 Test Application9 N( T3 V" E2 F; z# t
  6. *
    , X% k# ^! T3 c' u- P
  7. *   This file contains EDMA3 Test code.: r: f+ T  c  s# g; F2 a
  8. *
    ' Z% x/ s( h* X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 F- u* |3 G' \0 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 F7 U4 I" L! f
  11. *         TO CHANGE.+ V, D- x9 R% Z! z' H" S
  12. ** a  a& o5 m1 F% }# k! _) d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) A3 l2 X) c3 V5 S3 E1 n3 l
  14. ** T; z1 p) v9 {- z1 s2 d4 g
  15. * This program is free software; you can redistribute it and/or/ N  O: G, U. T
  16. * modify it under the terms of the GNU General Public License as
    5 P8 k$ R7 \  H! \: B
  17. * published by the Free Software Foundation version 2.
    * T4 }. J6 ^; e, X# i5 O
  18. *" ?7 R& x9 d5 {. h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* K5 }/ i& x- b$ a6 F6 z
  20. * kind, whether express or implied; without even the implied warranty
    ; [& A6 o' [1 _6 z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 V% u; {. G' g7 A: F+ T% S  r
  22. * GNU General Public License for more details.2 _& u) o2 e9 q! k( c
  23. */
      n0 l3 f. u. l- w" c9 S7 i& `$ e
  24. & \( r1 a2 a; R
  25. #include <linux/module.h>6 ]% z- P! c0 q4 `
  26. #include <linux/init.h>0 z0 V& k3 o/ `, Q' t6 ^% c
  27. #include <linux/errno.h>( K5 \; F; j1 W# c& `5 B
  28. #include <linux/types.h>- u0 ?- C3 x1 G  b2 X
  29. #include <linux/interrupt.h>
    " c$ Q- g$ X3 K! p% ^$ |
  30. #include <asm/io.h>
    ) e4 |! i0 h  L3 L) |' r1 Z
  31. #include <linux/moduleparam.h>$ Q1 U- R3 g' S; z+ y
  32. #include <linux/sysctl.h>
    5 b6 u. q) p* c6 g- Y+ m
  33. #include <linux/mm.h>
    & E1 e. D! U1 o9 w3 g" I( Y/ W
  34. #include <linux/dma-mapping.h>' Q' ~5 X6 W! N, S- n
  35. 2 ~9 ^/ r0 n  b& V" p8 A, ^
  36. #include <mach/memory.h>
    $ h+ K6 V/ H4 b9 f/ k4 H
  37. #include <mach/hardware.h>; n; Z- t; W" t3 `  s7 u
  38. #include <mach/irqs.h>
    4 [% l2 Q% g+ n* ]% b& U& t
  39. #include <asm/hardware/edma.h>  S. l+ b* }2 c, q% U
  40. $ \, t& |8 I/ z. T5 B
  41. #undef EDMA3_DEBUG
    1 ^) l/ P: {0 U% [0 R
  42. /*#define EDMA3_DEBUG*/
    * B# j1 U" u6 S, }5 c' ^- V

  43. / a( p2 \- I  T  S# j" k8 O
  44. #ifdef EDMA3_DEBUG
    9 Y4 x+ Q/ n( |$ B( h: [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 |! n9 Q% \- J, j6 z: w: {) ^7 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 K9 n1 A6 ~7 H' q: Z# @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 E: ^4 e% ^; |5 M. r
  48. #else
    6 w- W$ I. w+ ?& Z0 J
  49. #define DMA_PRINTK( x... )+ @; m1 ?0 r* T' v& j; m
  50. #define DMA_FN_IN
    5 `1 u7 t0 g8 T* O% J% J* H
  51. #define DMA_FN_OUT
    0 s1 f0 G9 L# z
  52. #endif! l0 q" v* l% p' o
  53. 0 T1 L8 ^% o) k; ^& g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)3 s' o% y2 \4 h  D- K' s
  55. #define STATIC_SHIFT                3
    9 A' [9 d8 w! v! D2 ^6 Y
  56. #define TCINTEN_SHIFT               204 O8 Z1 _: F( k. d, f
  57. #define ITCINTEN_SHIFT              21( P- K! f+ ~7 k/ `9 U5 F# |
  58. #define TCCHEN_SHIFT                22
    - S0 N* y( Q6 ^' d: _0 |
  59. #define ITCCHEN_SHIFT               23, @( o' b8 }. H/ J. V6 {) ^, Z
  60.   L+ K  [- m- S5 i
  61. static volatile int irqraised1 = 0;
    ) ?" w5 K$ k% @- I! m
  62. static volatile int irqraised2 = 0;8 a% S" O0 f1 d9 E) h
  63. 8 S6 @4 [6 U" k1 O3 }9 ]) h' R# X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      L7 X2 R/ O: T0 L' r$ Q  I  Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 J+ [' ~: U: n7 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 x/ f# \5 n! l; `8 N* l, n) C5 z; q
  67. 1 G3 {0 o7 \, m, {6 e! a
  68. dma_addr_t dmaphyssrc1 = 0;
      O7 _  x1 ?9 E5 G5 c0 u4 K
  69. dma_addr_t dmaphyssrc2 = 0;
      t$ k7 M7 F6 N5 W8 D: r
  70. dma_addr_t dmaphysdest1 = 0;8 d  |6 R1 H; E% u& C; V
  71. dma_addr_t dmaphysdest2 = 0;8 F" E4 |  z6 K/ ?7 R- q$ x+ {
  72. 8 V" V* v9 A  V" @7 Y- v2 G
  73. char *dmabufsrc1 = NULL;
    / X  _2 r0 O% U) {, h+ B! R5 v$ N
  74. char *dmabufsrc2 = NULL;
    % `( Y" ]! P6 i
  75. char *dmabufdest1 = NULL;. K) _9 c8 Z/ I8 @
  76. char *dmabufdest2 = NULL;
    - e$ Z" J" `$ G  J/ \6 H0 H, ~

  77. 2 p" T3 y+ v& {9 P: C
  78. static int acnt = 512;0 v7 U! m& A0 T) I3 p) e
  79. static int bcnt = 8;
    ; v) j, u2 U8 j6 a7 W( \% k
  80. static int ccnt = 8;
    . c+ \: K/ ?: Q. V

  81. $ p' n  ~" Q3 Z0 l3 R
  82. module_param(acnt, int, S_IRUGO);$ |& P" m2 x% d$ B
  83. module_param(bcnt, int, S_IRUGO);
    % S* S  |' q4 g  @8 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 B/ y+ q: s! K) J9 {$ j& d
5 C" l, f5 T% }8 i9 e! b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! R" v9 A% R6 e, P+ D* n
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  B9 R- i  M, {7 y     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; Z; {0 R% U; u8 N0 H" s' M0 O$ z
8 X% ?2 H  l( D7 N2 G; b, L, r8 q' G' e: [" h  l* K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 23:00 , Processed in 0.039026 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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