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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 I7 G2 P( X# d" l# N" K( i3 E0 n" k
  1. [code]EDMA sample test application5 \( H- L7 a( F2 r) Y% T- D
  2. /*
    , A. A4 l4 T4 o9 `5 [) h
  3. * edma_test.c% Z+ C# u* ~& N/ t
  4. *" [$ p' {# b. h) [, e. h7 J
  5. * brief  EDMA3 Test Application
    6 f8 v: E7 g( l/ T* [3 Q
  6. *
    2 J+ |+ t, x/ O
  7. *   This file contains EDMA3 Test code.4 E% X8 K, k) f6 J
  8. *4 w0 B) ~7 p4 @2 o, h" X6 M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - y8 i7 L3 P+ Z5 G# h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " U/ w6 A5 R) O2 R7 U0 x5 z  k; e
  11. *         TO CHANGE.' }! O2 Z% w* O2 P7 N5 G& k
  12. *
    * R: [; _9 c1 B* ]1 {7 O# K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/+ K: V3 _% }2 x2 B' y! c! a2 G9 F: U
  14. *
    ) T; h& j7 z5 ~( b
  15. * This program is free software; you can redistribute it and/or, r3 F5 P: E- t5 g8 A+ L# X
  16. * modify it under the terms of the GNU General Public License as
    1 x* C& H9 Z3 q1 o: p0 T4 {
  17. * published by the Free Software Foundation version 2.
    ' s2 T4 i3 b- S: q) e2 `6 g
  18. *
    & L" f" [' D& e' z7 F* ^0 q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / a* e5 D  G+ J8 p# J& I8 l9 H5 x
  20. * kind, whether express or implied; without even the implied warranty
    1 ]: I2 m+ N: y& m4 B5 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! ~6 t7 n& G; F7 R% w
  22. * GNU General Public License for more details.
    9 x: K" p: h' v8 p
  23. */
    1 J: q! ~) P% Q1 n; _" ^: L. Y
  24. . Z  m+ E$ m; D- B
  25. #include <linux/module.h>; k8 @4 m5 \4 ^; Z) P, N! v% v1 n
  26. #include <linux/init.h>
    / d6 L9 X8 R7 I0 V) v4 F$ C
  27. #include <linux/errno.h>4 f* ]4 o7 g, x
  28. #include <linux/types.h>
    - W5 n( \. t+ c3 e; m3 U3 c
  29. #include <linux/interrupt.h>( k$ X; i& w: ?% X* w/ u& y, F
  30. #include <asm/io.h>( e. C9 Z% r" U' f2 _
  31. #include <linux/moduleparam.h>
    ; }% H" g  [$ A1 I% n1 X8 f5 `2 j
  32. #include <linux/sysctl.h>1 Z$ l7 p; Y# V+ P: [
  33. #include <linux/mm.h>" c5 t  ]7 B9 F* Z: \( _5 W0 v
  34. #include <linux/dma-mapping.h>
    1 a# \. Q5 Z  M# N. O+ H8 R

  35. 2 q& k: `: n/ g) V% A1 S
  36. #include <mach/memory.h>
    ; e9 ^" ?# ~2 x+ `3 ]- `8 e! R" p# B3 r
  37. #include <mach/hardware.h>% D4 ?. u  c4 `4 }8 k1 L
  38. #include <mach/irqs.h>1 E% N7 m3 K& U8 D+ V
  39. #include <asm/hardware/edma.h>
    % F/ o& v" u4 b+ a. Y
  40. " p# {) x; H8 `2 p
  41. #undef EDMA3_DEBUG( d, B9 ^1 a% M- X; u: O
  42. /*#define EDMA3_DEBUG*/2 X; k) M9 G0 p3 F" k& e5 H1 u& l
  43. 6 K( ?: G6 c' A5 _; h
  44. #ifdef EDMA3_DEBUG
    ! R& \: O+ y! H3 {  H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ Q7 b5 O6 u2 x4 \( t$ ^9 o; C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) y, r" w5 y/ Z% T& k" H% L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # k/ d. _* }4 A+ h- y" E! y6 b' x( z
  48. #else
    1 Q  H% E" x1 B
  49. #define DMA_PRINTK( x... )8 H, {- x6 r" [
  50. #define DMA_FN_IN
    ! q( F$ c' K4 C5 z: X! N) R, i
  51. #define DMA_FN_OUT( z8 {" c! o9 ?; [% r5 {3 g" r
  52. #endif. c4 k( n, \7 P. B" y
  53. & e/ v" M6 J$ n+ v( @) v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; n4 F# a+ w- H8 _7 a. j1 H1 ^
  55. #define STATIC_SHIFT                3: {, S* ?4 i4 Z- y7 d) a
  56. #define TCINTEN_SHIFT               20$ l7 T' K+ n& T( V' f# B8 |
  57. #define ITCINTEN_SHIFT              213 e8 f6 Q9 z+ b# q. N3 v
  58. #define TCCHEN_SHIFT                227 b5 q. X6 C% F6 |
  59. #define ITCCHEN_SHIFT               239 k/ f; J3 h2 X/ t& k4 M
  60. " u# j: r/ A2 e
  61. static volatile int irqraised1 = 0;' i! R" w  f5 w7 z, U9 e  M
  62. static volatile int irqraised2 = 0;
    / L+ [, J. Z/ i3 [5 D: Y4 `' v
  63. 6 h7 `! ~8 K  R. D+ v  o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ S4 c$ {' ~1 ~7 f$ o" d" @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. e2 {3 K0 M" q' T0 W: v4 T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 l! ?' M6 P! ~& q

  67. ; N  z" _. h( Z8 Z1 V5 n7 V% q$ U
  68. dma_addr_t dmaphyssrc1 = 0;- d: N# Q; E2 Q  A
  69. dma_addr_t dmaphyssrc2 = 0;
    ( N, S& J- e: D( g. ~. s
  70. dma_addr_t dmaphysdest1 = 0;0 l+ t, _0 \( E; i& s7 q
  71. dma_addr_t dmaphysdest2 = 0;
    9 x. @2 E" A) A. c. _+ n

  72. % [4 ^3 S3 ~- V6 }4 Z* \
  73. char *dmabufsrc1 = NULL;
    : S+ H, t0 i  v1 [0 ?
  74. char *dmabufsrc2 = NULL;  H% H4 Y: f5 A) W  D
  75. char *dmabufdest1 = NULL;
    " v  }* Y( h: v' \/ S
  76. char *dmabufdest2 = NULL;+ a, n& J) Z( _4 i* [
  77. 5 o7 d! t/ B) s" Z) l9 t- e2 A
  78. static int acnt = 512;0 d& g! G6 j* j$ ~( }
  79. static int bcnt = 8;2 z$ m% h6 j# N2 l
  80. static int ccnt = 8;
    % W' z, _$ g5 j( {/ P% X

  81. 4 e2 }4 R0 j8 H* u
  82. module_param(acnt, int, S_IRUGO);
    * y; v# ?; ]% {% {3 g' C% i/ X$ i
  83. module_param(bcnt, int, S_IRUGO);2 g: X$ S! |& }5 D* t# D" v" R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: o* k  W& Z0 `: g8 \; G! Q7 F% \
: r6 P; x+ l. O# _9 x! Y; I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, n4 i3 x& v5 m; `- g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: r4 e1 j, h  s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: h& p0 N2 C3 l' h2 O
  y+ t: K+ d# [; q' Y2 Y
, G8 {: t# C$ d: K% J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-28 09:11 , Processed in 0.051334 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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