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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- j8 w$ h9 }+ m* P! ^* |( T  C- v
  1. [code]EDMA sample test application
    / y5 s7 M4 d) `4 |# ]( f& a
  2. /*% W6 ?" k7 o. f( W/ j$ C" m: D* Z. P3 w
  3. * edma_test.c5 ]% }, g- T) x  d: y/ L
  4. *+ f& a) }: f6 R1 k
  5. * brief  EDMA3 Test Application
    / H0 ~/ _  o4 z& u2 }, P
  6. *+ W5 b6 I; L2 T5 Q7 P& Y: J
  7. *   This file contains EDMA3 Test code.! d0 h8 N" [* k- W2 e; i; U
  8. *
    ; g" E# g: {1 H- }- c# K9 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " P- q) Q% {4 U, j/ q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) b* @7 Z1 X2 ?$ p, A; O
  11. *         TO CHANGE., q; X1 [. @& W9 s! s
  12. *
    + q0 v* ]6 d1 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" n5 d1 o; [( F; c8 }# A' `
  14. *& K/ _# L5 p7 {/ b! Z9 C
  15. * This program is free software; you can redistribute it and/or8 F: E  _. p8 x$ m2 u
  16. * modify it under the terms of the GNU General Public License as
    % F5 F) E, D" L% ]
  17. * published by the Free Software Foundation version 2.
    9 `7 x7 k6 j1 b" O: e  {
  18. *2 z: f- ~" @! S# l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 x' n3 L$ w" g! P
  20. * kind, whether express or implied; without even the implied warranty3 z$ ]' Y" W0 E6 p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 E! H+ n( e9 O
  22. * GNU General Public License for more details.# r, o* S2 o% @$ g
  23. */1 Z6 N4 \& [( a  _* [" `* K: j
  24. ' G1 M2 i  d! h4 x# ~0 B" _- ~6 G5 x
  25. #include <linux/module.h>
    5 z" ]  D% P: s8 Q/ {% w$ _
  26. #include <linux/init.h>9 k# ?4 X# l0 e. a8 M4 U2 \- N
  27. #include <linux/errno.h>
    9 y2 G3 G9 o% c
  28. #include <linux/types.h>
    5 ]" A, Q! j& q; x5 b$ j& x
  29. #include <linux/interrupt.h>8 c8 z8 S9 S9 F5 r
  30. #include <asm/io.h>5 K/ ]3 |& r( F+ B4 B
  31. #include <linux/moduleparam.h>
    ' k0 p: p4 @6 M, c- l
  32. #include <linux/sysctl.h>
    ) O' D% ~# M, s. w, z" n6 p( Z
  33. #include <linux/mm.h>* X0 T  m+ E9 s! x% D, q
  34. #include <linux/dma-mapping.h>$ ~& U* B$ X! |" V+ m5 I( w$ y+ b# V

  35. ) h- Q7 _3 W9 ]& g6 R& B. S: e
  36. #include <mach/memory.h>
    4 l/ D# g7 V, R" p; U
  37. #include <mach/hardware.h>
    4 B% j( g3 c& h  V7 o* @
  38. #include <mach/irqs.h>
    ( s; y# V& j: ?) [; W( I5 t
  39. #include <asm/hardware/edma.h>) K, z# ^3 ^$ o
  40. 0 H9 m9 m5 m/ E7 W1 L2 K
  41. #undef EDMA3_DEBUG' q% Z! a. f; h8 D0 r5 j7 A
  42. /*#define EDMA3_DEBUG*/
    & j% ~1 {9 z! {4 j& I* w' I
  43. & R$ y: t3 u) c1 |
  44. #ifdef EDMA3_DEBUG
    - f& _7 s$ \% c# K. B9 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % z* Z6 H: }2 R( u  r: m' r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& l. @0 f, l  k8 P7 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 }: f7 a1 Z" A- i: S- |! T% i$ j% z
  48. #else
    1 ^& @4 p8 [9 g
  49. #define DMA_PRINTK( x... )# |/ \) k5 ^* C) R
  50. #define DMA_FN_IN
    3 Z. O7 C8 F5 M! G/ s
  51. #define DMA_FN_OUT) {/ U5 H" Z# H4 I) [
  52. #endif' p; t2 h" _$ A3 x  T" Q
  53. 4 D# u  h0 s! B/ H: \$ I2 j: U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- @, y4 l. D+ \7 t2 D
  55. #define STATIC_SHIFT                3* N- l5 N( w$ S3 L0 u4 E6 T
  56. #define TCINTEN_SHIFT               20/ y$ c; r2 V3 n0 e6 M2 w5 k! e. q
  57. #define ITCINTEN_SHIFT              21
    " u, p# U6 r0 R& q
  58. #define TCCHEN_SHIFT                22
    & z) I" T6 |8 A& m* {( w+ {
  59. #define ITCCHEN_SHIFT               23
    7 B  A4 x! T7 [+ m

  60.   q6 I/ _) q' x4 [6 O  y& m# o
  61. static volatile int irqraised1 = 0;" X: {* `* j  a+ Z0 T( d7 P& W4 R
  62. static volatile int irqraised2 = 0;
    ' n5 Y+ A- C0 n% ~/ H1 V
  63. . v2 @1 D1 [, k; p% F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - g+ b& Y7 `5 D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 h' Y$ W; X  w5 E, ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # i' h5 t" D) L* p1 d  ~8 X
  67. ; l% ~4 m* y% ~. F) j
  68. dma_addr_t dmaphyssrc1 = 0;6 ^; |: @: \  T: G  }
  69. dma_addr_t dmaphyssrc2 = 0;
    5 P9 v, U+ W7 p" C; m
  70. dma_addr_t dmaphysdest1 = 0;
    : x( E* ~% U- R/ a9 K6 A/ v* d
  71. dma_addr_t dmaphysdest2 = 0;
    7 e, l) y, K5 H/ T/ V
  72. ( H. v4 U/ G) J: j/ q5 j7 U' D
  73. char *dmabufsrc1 = NULL;
    1 }5 z+ J* I0 i; O4 M! `
  74. char *dmabufsrc2 = NULL;. t2 ^. t+ w; ~% Z* x4 u% [
  75. char *dmabufdest1 = NULL;
    / l, z8 m; G0 u
  76. char *dmabufdest2 = NULL;
    % l7 R. ?+ t9 q
  77. , b' w: P( S/ q5 u: P
  78. static int acnt = 512;
    ) g4 |' W1 ^# `' k! K, l1 N; f0 T
  79. static int bcnt = 8;
    , ~+ o2 C  @1 k; G/ y
  80. static int ccnt = 8;  ~) ^- s4 t6 n: H$ k2 L7 {( h4 t
  81.   e# M. F- L( w8 {# c8 i
  82. module_param(acnt, int, S_IRUGO);3 U! a% K6 J; a5 K
  83. module_param(bcnt, int, S_IRUGO);
    3 ^0 N5 t" J# D+ |( U/ g7 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 b  v% x$ o9 \8 i  o; e1 A' s+ L" o. R3 v* V& j, S5 L7 {3 ?9 @# K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 |. l; d! L5 `! M( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 v: ^) B$ I! O3 _$ }5 M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 U+ ]( {  r: N$ S* k, c* v2 O
) d7 f" e7 D1 ]& ]$ ]" z5 B' {% L
8 ], U9 {5 G) w1 N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-13 13:03 , Processed in 0.039170 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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