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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   D0 q. d; P% r) _5 r
  1. [code]EDMA sample test application
    0 J9 X$ D5 i4 I
  2. /*( X4 O" R1 b, d1 D0 B
  3. * edma_test.c
    * P. P' [, ~  `9 z& }& C/ Z
  4. *- N; x( m: R& ^/ V2 Y0 z8 t: q* r6 r
  5. * brief  EDMA3 Test Application
    2 `) \# {# a  \* ?
  6. *
    4 x' H7 @6 R% x# c" _" l
  7. *   This file contains EDMA3 Test code.* U: G# o& E% p& O" b; s* N- F
  8. *- @+ v: t4 e7 D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / B( C/ }, O% _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 |8 M! u( q( a& Z' g. j
  11. *         TO CHANGE.1 _5 S0 [, N, j, W# Q
  12. *6 @2 w( Y/ k# [/ B) r  b" A$ k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " K" X, p; x+ D2 ^3 ~& n2 }' X2 n
  14. *! I* W4 k* e3 j1 l6 T: D
  15. * This program is free software; you can redistribute it and/or5 J- Y* I/ T$ g& B4 H3 _
  16. * modify it under the terms of the GNU General Public License as$ R- D: j* y7 [
  17. * published by the Free Software Foundation version 2.
    , s/ @3 ~3 p6 o* w8 J  P* X7 z
  18. *3 F" j" g1 Q) k" a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# e% G; r- O4 N: e' M6 V( ]/ J; L
  20. * kind, whether express or implied; without even the implied warranty
    6 {+ I9 G! b" A1 J5 E: A8 T+ {, H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 w( z* k9 |2 P
  22. * GNU General Public License for more details.
    ( T& `8 c& U- F7 r5 L/ u/ H9 |
  23. */7 s8 {2 C. E# G6 Y+ @! `
  24. 4 ~6 b! W% _4 [0 `  Q+ L
  25. #include <linux/module.h>
    : ^6 W' l! K7 S' c1 W' U  x
  26. #include <linux/init.h>
    3 ?# K2 {: Q/ J' |: M
  27. #include <linux/errno.h>
    * y8 X% S) `( f% g( b& U* `
  28. #include <linux/types.h>
    0 Y1 x2 i  F5 C, W; h
  29. #include <linux/interrupt.h>2 y8 t) v9 \' r% K
  30. #include <asm/io.h>
    ; v& E3 U1 _9 H1 {- a. t
  31. #include <linux/moduleparam.h>+ L" ^& G7 h8 O" ~
  32. #include <linux/sysctl.h>7 h( p2 v6 w7 r, E6 g# w9 ]& a' w
  33. #include <linux/mm.h>
      L5 l7 b; Z- v+ ]: D
  34. #include <linux/dma-mapping.h>" U0 a7 }! L) R3 }  N3 e0 e, L

  35. 0 ]' F8 F" k7 [/ c, Y: g) h
  36. #include <mach/memory.h>
    % m: i2 b9 y5 H3 t0 p
  37. #include <mach/hardware.h>
    6 Z5 P! L9 ]& {; Y0 n  |
  38. #include <mach/irqs.h>% _! Y  b0 j. f1 B, r8 \. v
  39. #include <asm/hardware/edma.h>; j7 c& W9 Z6 g1 f

  40. & K1 N6 ^5 u/ i* F) p. k
  41. #undef EDMA3_DEBUG/ V) B; L, h' j6 Y$ R& T4 l
  42. /*#define EDMA3_DEBUG*/
    % [* a2 l% ]% X) i
  43. - j  P! Y8 {6 }0 H. A
  44. #ifdef EDMA3_DEBUG( M! O+ }% {! [) t6 A* d3 P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ v  B* a) i' U$ e& Y$ N+ i5 S2 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # d% s* B2 [4 N0 M0 A2 {& Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), e* m) a- o* e5 u) P8 z8 U
  48. #else
    * T1 ?$ o& l+ V8 ]2 h' z5 k0 [
  49. #define DMA_PRINTK( x... )
    , S/ x) o& S8 q. s9 ^# b5 R' t
  50. #define DMA_FN_IN4 C0 U/ j! x& w& q
  51. #define DMA_FN_OUT
    * v* D  n2 u. Z0 {8 Z3 T/ n2 h0 b; l# f
  52. #endif3 a2 h2 p7 B! ^9 _3 W" D8 D

  53. . @7 [4 I6 T" ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* G5 N# \; m& Y' p7 E6 K: J) x& m5 i
  55. #define STATIC_SHIFT                3
    9 g- w& Y' b* Q0 e5 z
  56. #define TCINTEN_SHIFT               20
    2 x% ~' y4 X# z7 U% i: t) u1 D5 ]
  57. #define ITCINTEN_SHIFT              21! z% u- @8 k2 K. _, X* M) V$ O6 \1 ?
  58. #define TCCHEN_SHIFT                22
    " ~* u6 X' l) U% E% w3 Y
  59. #define ITCCHEN_SHIFT               23
      u1 S8 b, v5 Z' @+ M; X& `
  60. % G, b% E+ \) h5 E3 l. s
  61. static volatile int irqraised1 = 0;9 ]% K# U% P2 |5 d7 n
  62. static volatile int irqraised2 = 0;! ?8 \: q5 U7 V) n1 ?
  63. , H1 V% C. `$ T4 x! n+ t4 \/ c6 u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; o+ J. [+ O! v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 \9 r6 @5 c) ?5 @
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : t6 E  J1 B; x! E9 m$ v

  67. # P  e9 v0 V9 t" G& N' |6 F+ x
  68. dma_addr_t dmaphyssrc1 = 0;' j/ {# {, l% ?7 ^& C& [6 }& P
  69. dma_addr_t dmaphyssrc2 = 0;
    - j$ s! A3 X0 c. s
  70. dma_addr_t dmaphysdest1 = 0;
    * a8 x; a6 f3 m/ `+ i; u5 G
  71. dma_addr_t dmaphysdest2 = 0;# I! h' }- E0 c# t
  72. 5 X# X& U. ?5 D# W9 a
  73. char *dmabufsrc1 = NULL;6 F$ L4 h- G! N8 Y8 _
  74. char *dmabufsrc2 = NULL;
    : A! ~/ X9 _7 _* s8 Y
  75. char *dmabufdest1 = NULL;
    + E" n$ l, F$ `; t5 p0 Y" f% q- Z9 X
  76. char *dmabufdest2 = NULL;6 E/ ?3 j! B* y& U1 }
  77. , s) X7 e! M" B7 Z, \9 }
  78. static int acnt = 512;9 }+ |; k) Y: n$ P: j9 z
  79. static int bcnt = 8;6 o" R' V+ d- B4 g$ U
  80. static int ccnt = 8;6 J/ v5 @  N3 `* E9 B
  81. ; w+ O/ q; f% T
  82. module_param(acnt, int, S_IRUGO);, O+ p) \6 a3 ?; ?2 m
  83. module_param(bcnt, int, S_IRUGO);; y! b& Z  k: ~& @: m0 O9 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 ?' i. L7 r  I+ t; Z1 C3 v
5 K- ~# Y6 x% Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 n8 a2 R' F0 ~  t" {0 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% m3 r6 S  A' [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" f' Y5 Q1 W% f* Z

4 R5 h$ Y% ~  w* P1 T0 ~* {
( k6 a4 z; A! i- W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 02:21 , Processed in 0.038792 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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