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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" l8 y: {5 P& {( T  p+ [; v; A  q3 [
  1. [code]EDMA sample test application
    9 b; a3 v  z7 W8 B% H% U
  2. /*) _. f- \1 Q$ C
  3. * edma_test.c
    9 s) E( U8 r( l0 b7 j# f2 ^! s
  4. *7 |! l# k* ^3 W  I$ b4 M
  5. * brief  EDMA3 Test Application
    0 C! I' n+ h/ b6 l. G& Z0 G. T9 e
  6. *) M! o+ Y3 F/ }9 v! Z
  7. *   This file contains EDMA3 Test code.
    * t6 n' p: V; X
  8. *; C; U/ N! x) J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 A# x: U4 G& U3 \* X, p4 ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 h9 |5 `6 W! ^
  11. *         TO CHANGE.) J+ {; D# f' s* [0 z" [8 t* y3 ?
  12. *' P" @# z5 _1 Q4 h4 p4 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* y) r; a$ ]1 n' r  [8 {
  14. *
    1 B3 K7 L+ D8 B" K- `3 I6 x
  15. * This program is free software; you can redistribute it and/or
    ( a6 k, E7 L+ J  e: x
  16. * modify it under the terms of the GNU General Public License as; W" G' {: p6 o) m
  17. * published by the Free Software Foundation version 2.: t! o# z9 g+ z: J: q! i* p% ^
  18. *
    2 F) W7 _. P3 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& v% |" W) c) q4 u" p( R
  20. * kind, whether express or implied; without even the implied warranty: E- O4 Y9 p8 G8 L
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % b0 [1 e- ?7 b6 h
  22. * GNU General Public License for more details.
    # R3 O" N% g9 O5 b
  23. */" [9 H5 Z; _6 ?6 e; A% z
  24. 5 Z) T' E+ X, Y2 Y. J: N
  25. #include <linux/module.h>
      B0 r1 E* O) ?% U
  26. #include <linux/init.h>* y1 h( Z9 |2 P2 d
  27. #include <linux/errno.h>
    2 _& N) ~& H4 N: u- `0 M  a$ Q) `7 w9 b
  28. #include <linux/types.h>
    ; c5 n6 k% B. L5 h' K% ~
  29. #include <linux/interrupt.h>  ~! m$ o% g4 m) _9 Z
  30. #include <asm/io.h>
    8 ~( c( Y# ^3 m9 b( Q2 h& N
  31. #include <linux/moduleparam.h>
    7 L' o0 f/ \2 y0 e4 q! {+ D3 h
  32. #include <linux/sysctl.h>
    + i$ P* u/ ^2 I/ L* J
  33. #include <linux/mm.h>$ ]. K7 G" h' ?, i  F: l+ V
  34. #include <linux/dma-mapping.h>
    ; t! u* F/ I* ?2 _

  35. # v. v6 m/ @2 v9 ~9 e* T& N7 n
  36. #include <mach/memory.h>
    3 \7 B  }' j( K# \1 e8 Q, V
  37. #include <mach/hardware.h>
    % v0 M) f( C7 b7 V9 d% {$ o# K
  38. #include <mach/irqs.h>
    & \) [0 z$ V7 l3 m( ]/ r7 `
  39. #include <asm/hardware/edma.h>
    , _) Y! t( q5 s/ P6 V

  40. $ n, c: ~2 g4 }0 n0 d5 q
  41. #undef EDMA3_DEBUG
    : i$ V5 a" @& [6 t$ g5 J5 N
  42. /*#define EDMA3_DEBUG*// y; O' M4 L3 ?2 m, |
  43. 6 H& b' E( [) M9 y
  44. #ifdef EDMA3_DEBUG+ h: _! W4 ]% x0 `8 |- X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 N: o  H: m7 a( l6 k( l% |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 E% U# b  q% c( n* n% N" l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): T7 u/ U" k8 A* S' B2 T5 c4 I* E+ J
  48. #else7 I0 o1 d& k% J( |  t, A" n& Y
  49. #define DMA_PRINTK( x... )! E" j( B% u) b
  50. #define DMA_FN_IN
    % b; h0 U$ B$ T/ g
  51. #define DMA_FN_OUT
    5 q! B( ]9 e! O! i6 X# G
  52. #endif# c$ g; @3 ^: A* K2 }6 b; n1 d# Z2 \
  53. * R# r" Z$ U, d" y1 k* e: Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ d5 ?- x0 \  V- G, Y
  55. #define STATIC_SHIFT                3
    1 N$ J$ ~/ R& V  ~& y7 y4 ~/ T3 M
  56. #define TCINTEN_SHIFT               20
    ; c1 w  c0 v. @1 [+ |
  57. #define ITCINTEN_SHIFT              21
    ; W6 J/ H! ?3 A7 B* [: B6 q
  58. #define TCCHEN_SHIFT                22
    9 t3 h0 x( ^: v7 F+ n
  59. #define ITCCHEN_SHIFT               23* Y: Z% b" I" k7 N$ E3 q& a3 S
  60. 4 @: y, ]- V# ~- \
  61. static volatile int irqraised1 = 0;  Q4 c7 I8 s/ P+ P. a3 N
  62. static volatile int irqraised2 = 0;2 X1 j( i# r) Y' A. K; ^

  63. / s( K& z' p2 n0 x/ h; W6 }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) V' h& e+ g! y7 O" w; G2 A, {2 S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 T8 O. ]! r) z1 }$ G) s  E  W2 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - s( {0 e+ ?; m/ t8 S/ k

  67. ) |. G' `' W3 B, [7 F. M4 ~* ^
  68. dma_addr_t dmaphyssrc1 = 0;4 D: }, h: W) o) k. W
  69. dma_addr_t dmaphyssrc2 = 0;
    1 v- {( v) n( Z
  70. dma_addr_t dmaphysdest1 = 0;% Y- W9 r; ~$ l( O" X
  71. dma_addr_t dmaphysdest2 = 0;
    + `( a) h2 ?. Z: A2 A% y
  72. # U  T: t& A7 x3 i7 M
  73. char *dmabufsrc1 = NULL;% [$ l- |5 Z$ L9 Y, j
  74. char *dmabufsrc2 = NULL;  |+ n! H$ J+ u6 V5 V, n
  75. char *dmabufdest1 = NULL;
    - i0 F' O! H5 X! f: k. k. |6 c
  76. char *dmabufdest2 = NULL;
    * S) v% V8 v3 l; Q

  77. 4 o- ]. _# O# L7 W. P5 U) g
  78. static int acnt = 512;
    * \% ]0 O  B& j' A0 a. o1 x: M
  79. static int bcnt = 8;$ Y. i. w" V" O: n; }; L
  80. static int ccnt = 8;
    2 `- h+ d) A( f4 E* z
  81. 6 I6 U( N# [+ `0 r
  82. module_param(acnt, int, S_IRUGO);
    + J) X+ ~: `* R) Z1 D' E. f
  83. module_param(bcnt, int, S_IRUGO);2 `/ O# @* D3 `/ x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ u. |8 ^, Z, D" b, Z& n7 U' A: g
7 k+ O1 P; I, ?* g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ b  n9 L1 ~- b  f8 Q/ h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 \+ A& A1 Y+ N) Z) s$ [1 G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% x0 Y" a! o( O2 g& Y0 D8 z: G: L7 V% k2 M1 q! E# M$ k0 f
  v0 t$ p; v( N3 p2 t9 V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 08:59 , Processed in 0.038507 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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