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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # S" |3 R3 U/ U7 z# k
  1. [code]EDMA sample test application
    . {( l" @) O0 u, {. h& K9 t
  2. /*- b' j# w" D4 l3 ]0 \" D; `' H6 `, ]0 N
  3. * edma_test.c
    $ }% Z$ x+ u$ q
  4. *
    & L7 l0 \/ a; ]8 D, w
  5. * brief  EDMA3 Test Application3 h' s' x& @' r, |; H" x
  6. *8 @  k2 }7 M  O
  7. *   This file contains EDMA3 Test code.
    ; T0 H: G" W0 r- }
  8. *
    " Y" k! w+ \  I+ ^, X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' R1 i0 k$ u% Q. q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  r7 X- E6 t, g1 u1 R, O
  11. *         TO CHANGE.) p8 y# X2 t% w9 ?  v
  12. *
    & E5 H1 X5 m$ `2 U. b6 T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / D: X8 n0 I2 z% f1 [  H# Z4 P
  14. *
    " {3 j2 z  P* a0 F
  15. * This program is free software; you can redistribute it and/or
    - ~/ Z  J$ K1 u3 K
  16. * modify it under the terms of the GNU General Public License as
    4 ~7 U) Q  S6 m# ?$ ?) ~
  17. * published by the Free Software Foundation version 2.
    5 V- `  F; m7 p3 T1 ?9 O& o( i
  18. *. B2 T8 n3 M7 W* d" V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 R0 G& T% p8 @8 P
  20. * kind, whether express or implied; without even the implied warranty
    $ o; w; _% e! v) E) H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, U5 j1 {$ B# K
  22. * GNU General Public License for more details.
    8 [8 f+ @' c4 U) Z" F* D- X4 Z9 l
  23. */2 V8 R% T$ h( @4 Q6 v; W. H' X
  24. 7 Z0 g4 Y: S3 f! V( e9 K. e' i
  25. #include <linux/module.h>
    6 N: h. K/ b  m6 I& w: d( o$ n
  26. #include <linux/init.h>
    5 r9 l' H  t' E( `$ a! L" T' v
  27. #include <linux/errno.h>
    , e4 z0 `: d9 G0 h7 G
  28. #include <linux/types.h>
    - y; L$ M) [! M- i" S
  29. #include <linux/interrupt.h>
    , c9 t1 a: Q! s2 d, A5 y
  30. #include <asm/io.h>
    6 k9 W9 d0 B7 B+ p! K. e
  31. #include <linux/moduleparam.h>
    / J. X. f& S! Y1 Z  G% C4 G- ~6 c' T: T
  32. #include <linux/sysctl.h>
    4 t. p& L: E) X  R) A
  33. #include <linux/mm.h>
    . U# ~2 `6 {$ c- x4 m
  34. #include <linux/dma-mapping.h>
    : q) P; t9 p; j% A* Z# O6 t  e
  35.   U, h) E/ x8 b/ t
  36. #include <mach/memory.h>
    5 s. r) U0 l# W# s
  37. #include <mach/hardware.h>/ c: a; ]) v6 T$ Y8 M8 w3 L- i" L
  38. #include <mach/irqs.h>, a: Z, q! i# P5 ?' T8 I% w
  39. #include <asm/hardware/edma.h>, }$ J1 V$ R' Q+ A5 i0 M

  40. 6 [* t% d, f5 @7 B/ U
  41. #undef EDMA3_DEBUG
    5 j7 J  d! O1 P  N/ s0 q
  42. /*#define EDMA3_DEBUG*/; K2 {; _9 O6 u( S8 `

  43. 4 ]$ {5 m; @. Q* b2 K1 B) @2 h1 I
  44. #ifdef EDMA3_DEBUG2 u0 h% N6 m) K( e. E! [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 u" r* V3 R2 D; O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): G) |# }! k, f; ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 R" @! Q) X! w* S
  48. #else
    # {3 k0 K0 ^: V% g+ H) w; w- \
  49. #define DMA_PRINTK( x... )+ ~0 g0 y! [" e3 l! K
  50. #define DMA_FN_IN
    # F  r1 ~2 f9 p- O1 G/ a6 D2 g
  51. #define DMA_FN_OUT; [! L3 g/ @1 j- h+ }2 p
  52. #endif6 H# x' x8 N1 I4 ^, q" X
  53. - }& h, q5 b5 S2 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 p) X& y+ t0 ]! f; ?& @5 @
  55. #define STATIC_SHIFT                3. h0 k# b' z! p& D( T- p; m
  56. #define TCINTEN_SHIFT               20
    ) G. ?& F3 i1 ^/ ?6 i' n
  57. #define ITCINTEN_SHIFT              212 J6 X- ~* G8 X  N6 Y4 |" ^3 R
  58. #define TCCHEN_SHIFT                22
    8 g$ y& D3 }9 f8 [4 l* a
  59. #define ITCCHEN_SHIFT               23: \, E  R9 B( i' e

  60. 5 W7 I9 ^$ N: z
  61. static volatile int irqraised1 = 0;
    " j2 X* N+ i( A' |/ y! O# a- J
  62. static volatile int irqraised2 = 0;
    5 U$ f9 F' Y8 s5 \; ^% D

  63. * i5 l1 }! ]3 ?8 D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' K+ v: K- @& J1 a- i# ~/ b$ {6 P6 K8 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # ~3 ~- C! P' S1 X( ~  z: P* Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 i* T  X) o) X* o0 P

  67. & k# D* O, g) U( H
  68. dma_addr_t dmaphyssrc1 = 0;) F; t$ E/ u7 x& V! m5 P
  69. dma_addr_t dmaphyssrc2 = 0;
    6 g+ ?5 `4 e7 p3 f
  70. dma_addr_t dmaphysdest1 = 0;3 ?& {. G$ p7 u, i
  71. dma_addr_t dmaphysdest2 = 0;
    % s" @7 u2 F6 r2 p& d
  72. + [, ?1 `) ?5 H* V. I; r
  73. char *dmabufsrc1 = NULL;
    " w3 @: c& s4 h0 S$ M- \- O
  74. char *dmabufsrc2 = NULL;! t; t3 C9 V2 z6 B$ m
  75. char *dmabufdest1 = NULL;) V" V$ M, I; Y! C7 Z% N3 B1 d. R5 e
  76. char *dmabufdest2 = NULL;. \% V7 J. |1 l# _6 j% Q% v
  77. $ m  m2 }; Z' t# y7 k
  78. static int acnt = 512;! q0 Y2 r7 ^8 v# B
  79. static int bcnt = 8;
    4 y: V+ T  V$ z% B" u$ m+ b2 y
  80. static int ccnt = 8;; @9 n) J# z  i! c0 O/ `* d
  81. - T' _' C4 ~2 L. a$ L* t  O0 H
  82. module_param(acnt, int, S_IRUGO);+ o; M% w' N8 r, V/ e( l$ e- @
  83. module_param(bcnt, int, S_IRUGO);
    4 m+ y& g) S9 Z$ B1 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. e; z3 t7 J& A  i# D8 J8 v# e6 H+ d0 D, d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, R  H; U1 H" p* farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* ^3 ]! l  O+ d9 @+ F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ b  z) q  H: J
, l4 K, J" B" P  u
5 o. f. `$ b" T& b2 L+ `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-12 11:23 , Processed in 0.058315 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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