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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 c  [$ N' B2 p# |! F; D- D  ~
  1. [code]EDMA sample test application6 y9 ]3 ?8 ^2 b
  2. /*& h9 @# \' ^8 a1 z6 Q' E% Z
  3. * edma_test.c
    5 |; d+ O; e" F6 s6 p
  4. *" {% c) C& v; o
  5. * brief  EDMA3 Test Application2 k% D7 w: h! W& x2 o
  6. *3 t. n1 }5 S% j
  7. *   This file contains EDMA3 Test code.
    5 B5 u7 P9 M; Y% A: b
  8. *
    8 `0 g5 G6 g3 \2 n" @9 c' z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - }- t9 k  t) U, g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; w- q( R; G% ]; c1 d
  11. *         TO CHANGE.1 q. @$ I) F) Z' r' [" Z, m
  12. *
    , ^3 E4 B- M5 d4 [3 h! h( q% Z* [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// A2 ]2 d. S3 ~0 w
  14. *
    & k; p$ y; Q* K+ R( ~
  15. * This program is free software; you can redistribute it and/or" `, G% k( N! m
  16. * modify it under the terms of the GNU General Public License as
    * @" v* ^  H1 a
  17. * published by the Free Software Foundation version 2.; G# i+ U( U) f
  18. *
    6 N; {3 j" s: q- y1 i7 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  o5 i6 n, n+ e# r
  20. * kind, whether express or implied; without even the implied warranty  a! ], C6 R: ~/ a+ g1 l: d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 J+ m  q+ |' U2 U) _- @
  22. * GNU General Public License for more details.
    $ v) v% _& u  l0 p$ f
  23. */
    % y2 ~% e: f6 O7 m$ n- }/ P

  24. & A8 q# l+ ^' A" `. L; u
  25. #include <linux/module.h>/ D& d+ ~5 f$ S
  26. #include <linux/init.h>0 j, i+ M6 v  B+ R9 G* _
  27. #include <linux/errno.h>% J; E% T  H1 k1 B# x
  28. #include <linux/types.h>
    2 X# Y) X) n0 ], H% \. _1 e
  29. #include <linux/interrupt.h>9 E$ m# [& w3 o* W
  30. #include <asm/io.h>" L$ w9 h; T; c# I  K- y, R2 M
  31. #include <linux/moduleparam.h>
    ! Y; E3 T  |; _1 F$ X& x+ U
  32. #include <linux/sysctl.h>
    % ]( Z- K0 d9 R0 x9 [  X
  33. #include <linux/mm.h>
    & D( a; ~) q% ^% t# X
  34. #include <linux/dma-mapping.h>
    7 d% {) K) i' `% Y6 _' W

  35. ; B  K" f- C8 t- p  \. O- G$ ^, C
  36. #include <mach/memory.h>
    4 c' n( S$ A( K+ O3 Y2 K+ D& x* X
  37. #include <mach/hardware.h>* d9 L9 v% m0 r& n
  38. #include <mach/irqs.h>5 u& C5 e5 h% I5 V) @0 [
  39. #include <asm/hardware/edma.h>
    7 I9 I, }  l/ X1 G' R

  40. 1 \! h$ F5 h. N- D& |
  41. #undef EDMA3_DEBUG8 \% S3 @4 t% T
  42. /*#define EDMA3_DEBUG*/
    3 G0 y. Z+ u$ W3 J6 }8 M, [' v

  43. # `- e  e/ i5 y' Q* }' V8 j
  44. #ifdef EDMA3_DEBUG
    ( V8 L6 X2 V2 V; x. S: H  H$ A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 Z, h$ X; N9 Y. W8 a; f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & \- ]1 r# p& D! Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# E( h' A. Z' _( m  j
  48. #else
    1 j! |$ S1 I% l' Z- y7 E  H
  49. #define DMA_PRINTK( x... )
    7 e+ g6 m2 X' d  J! d$ J
  50. #define DMA_FN_IN- x3 x5 u6 Q4 |3 a
  51. #define DMA_FN_OUT9 t+ `( ?( A; ~* }5 b; m5 k0 U
  52. #endif1 o" g; z/ L7 V- _& S+ \* V

  53. , _0 {3 n: z' D$ e5 l+ |- `# m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) \! t$ l* B& n$ d$ x( h  y& W8 E
  55. #define STATIC_SHIFT                3
    2 A: r% N6 b) M! P! b
  56. #define TCINTEN_SHIFT               20
    2 a7 p3 h; n+ I, z
  57. #define ITCINTEN_SHIFT              21
    + J! G4 P3 x( ^" ?% X
  58. #define TCCHEN_SHIFT                225 a0 k; C' t0 b0 c0 F+ Q% V
  59. #define ITCCHEN_SHIFT               23  T# \9 K; y6 V  O. t' I9 [# c  o

  60. * j3 b: R$ ^# T8 F: U- ?/ o% Q* ^0 r
  61. static volatile int irqraised1 = 0;
    ; i7 d, Y. r8 i, }7 c+ F
  62. static volatile int irqraised2 = 0;
    1 ]" e0 ~4 E( k/ U1 C

  63. ' K8 k1 r0 Y3 ?# A* o1 E  [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! @" n2 W  N7 b9 t) x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  F3 Z4 [/ h  X& p3 h3 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : Y* ?" z  P/ E% H
  67. & T9 g& |: M4 \- Z$ o
  68. dma_addr_t dmaphyssrc1 = 0;
    9 z' w1 p! j& @+ H9 v: P
  69. dma_addr_t dmaphyssrc2 = 0;
    3 K9 L7 A6 s- m/ K+ q' V' l
  70. dma_addr_t dmaphysdest1 = 0;
    . p! q1 c6 Y% P1 R( g
  71. dma_addr_t dmaphysdest2 = 0;4 I& g) ^: O+ j& a3 ^+ \

  72. . S* D5 @3 z& z8 b- I6 E7 r4 F# n
  73. char *dmabufsrc1 = NULL;
    & G$ V7 Z, d# r0 y  t( e' Y
  74. char *dmabufsrc2 = NULL;
    7 i5 x+ F# A8 v; Z
  75. char *dmabufdest1 = NULL;) X6 q3 ^4 J  Q# W
  76. char *dmabufdest2 = NULL;
    9 L3 F; O! b! v$ Z$ ?+ l

  77. : d' `" Y8 m1 \' K" r# v  h
  78. static int acnt = 512;
    ( Q/ }  T9 r8 i& _! i
  79. static int bcnt = 8;
    : p# ^2 y: b  V% L* ]) Z! B! x
  80. static int ccnt = 8;
    1 C. m, |4 A, r- G

  81. * z2 U2 {& G' e' @
  82. module_param(acnt, int, S_IRUGO);
    ! a! I0 N0 C3 d' Q3 Z) k
  83. module_param(bcnt, int, S_IRUGO);6 \- c) {! v  W7 j% f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 Q6 n. v4 O+ T, f. M: p. H6 }7 [7 b7 D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 }8 \) @0 @, a. L
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ ~: Q$ U- H; d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: R( L1 ?' g; d; m, R# V
1 U. u% q  B& F" {
' M1 F& e8 B# z( \- `2 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-17 20:33 , Processed in 0.039658 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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