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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' i, D, R3 L) x4 J- K; a
  1. [code]EDMA sample test application8 R* Z& B2 g/ ~' m7 p: B
  2. /** ^/ V/ [/ ~& o) v. e0 a
  3. * edma_test.c: L- ^1 N, D- u
  4. *" `; W* }' W+ }) b. l% B
  5. * brief  EDMA3 Test Application9 u8 @2 I- Y9 @3 s
  6. *
    8 L2 X; \# @; w( o5 W
  7. *   This file contains EDMA3 Test code.
    & {/ \! q: d7 T. J2 U( h$ ^
  8. *! p& Y3 R- U( m  r+ j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , q  Y0 v' I/ U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ j' C. F9 ^2 i9 k  ?* D
  11. *         TO CHANGE.
    ; g+ ]7 K% Y& Y9 j
  12. *# f: l5 `2 j; B6 ]' F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 v9 W- x# A) j: y/ \* n
  14. *
    3 L( u5 F0 k+ t1 N% c$ _
  15. * This program is free software; you can redistribute it and/or
    5 L' b' |0 U# d0 M( y
  16. * modify it under the terms of the GNU General Public License as
    + p, Q' _: _8 f0 `
  17. * published by the Free Software Foundation version 2.
    : {$ L+ b$ x; Q
  18. */ z5 n* e1 m8 ?$ r& z6 k( v3 G1 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  k& ?: F/ O. @) I' t! x
  20. * kind, whether express or implied; without even the implied warranty" i+ V0 d) {& M! [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ N9 o3 R9 P" ]* p4 Z, l1 i
  22. * GNU General Public License for more details.
    ; j, H  F! p, {( @
  23. */6 `, P5 y/ u9 H/ a& E- L6 U
  24. ) s7 k3 g8 I, j5 ]8 I9 \5 L
  25. #include <linux/module.h>. H7 \$ @3 l0 o$ N4 F# i# ?
  26. #include <linux/init.h>+ L: g# c6 l/ y5 ]: o6 o& N& L8 b
  27. #include <linux/errno.h>/ ^6 x/ e& W9 e3 r
  28. #include <linux/types.h>
    0 F) ?$ z6 E$ I* i! L4 l! ?$ h$ p. h
  29. #include <linux/interrupt.h>
    ( d% x! w% ]8 N0 [# o2 r
  30. #include <asm/io.h>
    0 w9 m1 j8 K: T- {
  31. #include <linux/moduleparam.h>9 m0 ]. t8 t/ D* `  p8 d) X: e+ }  j
  32. #include <linux/sysctl.h>' g7 y0 |: u& W7 \
  33. #include <linux/mm.h>, x' g! N* s& s7 {
  34. #include <linux/dma-mapping.h>. C; M8 D  v( X5 a: I9 j- L0 w- J
  35. 6 Y" K4 A) A: B- F- h4 e
  36. #include <mach/memory.h>9 m  q1 N* ]8 F1 j( Q# U
  37. #include <mach/hardware.h>
    ) m% j0 K2 t% _8 p! `4 {
  38. #include <mach/irqs.h>- @' r4 g1 V% j8 m. U; m
  39. #include <asm/hardware/edma.h>
    8 {7 r; a- R6 D! Q: }" E

  40. 2 \7 a; `, u' U; G( n* H
  41. #undef EDMA3_DEBUG
    + ?  w7 w0 s. W/ n, C% k8 B
  42. /*#define EDMA3_DEBUG*/
    ' f$ f4 ~4 W3 W2 h: u+ z$ S  F

  43. 4 {6 j+ J- G+ m" }2 X/ q: }+ W3 C
  44. #ifdef EDMA3_DEBUG
    % v% V+ R& G. Z: V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) _- |) e# N, `% o+ n4 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 E4 j" u1 z2 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): l  e# {, R) s; w
  48. #else
    2 j8 \$ k1 v& Y) h5 L: Z0 @
  49. #define DMA_PRINTK( x... )- `! L8 N+ I0 t' i9 v5 r
  50. #define DMA_FN_IN4 t8 r# R9 R( ~0 Z$ e
  51. #define DMA_FN_OUT
    / v6 g/ x8 T$ |
  52. #endif) r# M# S7 j5 p8 o1 z! y2 y

  53. * Z* V8 i9 c0 C# x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 i3 z1 L( B2 R9 S5 E
  55. #define STATIC_SHIFT                36 _9 z' ~; ^1 u$ s0 d5 V
  56. #define TCINTEN_SHIFT               20, z) s8 r6 H8 U( ?
  57. #define ITCINTEN_SHIFT              21
    & z1 D. l; e# ^
  58. #define TCCHEN_SHIFT                22
    ) u0 f* r# Q  r3 Q. _' m/ g0 S- {( P
  59. #define ITCCHEN_SHIFT               23, y! U3 B6 q$ I; {: P( D3 F; s  m( V- V
  60. 7 O2 f: M& G% I9 `8 f
  61. static volatile int irqraised1 = 0;0 m7 a2 M* ?# k; f& F
  62. static volatile int irqraised2 = 0;
    $ u# d3 E0 c+ D
  63. 7 ~/ C+ e+ g- u: b+ ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 ]8 c* Z! [8 e6 S5 z  r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # f8 @% T* i% A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ E4 i8 c9 j! j$ q

  67. $ E# p7 [- D% A8 V+ l  R6 A2 w. m
  68. dma_addr_t dmaphyssrc1 = 0;# e- W+ \& r' N6 E
  69. dma_addr_t dmaphyssrc2 = 0;8 L: {6 K9 k6 E
  70. dma_addr_t dmaphysdest1 = 0;. f" {( E- V5 N/ T) E: y
  71. dma_addr_t dmaphysdest2 = 0;; a9 U2 e  Y8 n5 `
  72. # `  U+ j, A7 X9 M4 H5 w
  73. char *dmabufsrc1 = NULL;
    " y7 |: A; v# D* Z% N/ u& [& i
  74. char *dmabufsrc2 = NULL;2 \$ N  s  }% C- a' N
  75. char *dmabufdest1 = NULL;
    " p* ^0 o3 P( ^8 V6 I
  76. char *dmabufdest2 = NULL;1 U& L% ?* F7 L% |! P8 B) ^
  77. ) u' l- y. T5 R( g) F" i
  78. static int acnt = 512;7 p/ ~2 D8 f1 }+ \- h$ |
  79. static int bcnt = 8;1 c# E/ ?2 @) g! M9 e7 r5 R9 r
  80. static int ccnt = 8;
      P) T2 _% d* w1 c8 A

  81.   J# ]" S# h& J( c6 ]; n
  82. module_param(acnt, int, S_IRUGO);$ H, X2 i  g: r
  83. module_param(bcnt, int, S_IRUGO);
    $ s: q# t2 O: ]( x0 j) c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: _/ z0 A, G' @' s: p6 L

6 n0 [0 I, t$ i- ^- M! ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 R1 q5 Z8 Q- T7 O' C: q/ l' Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# A% ], n) E/ E4 w/ X& E9 D( S* K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ f, e) z- S8 u

1 ?( z5 l- G  s; n1 l7 _4 u/ [2 o9 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-27 22:22 , Processed in 0.040748 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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