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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) C7 |* n/ A1 E
  1. [code]EDMA sample test application  I8 m! s$ D; h/ `2 a) [5 [6 M
  2. /*
    9 u+ ?8 P3 x* }8 C7 v2 J5 ^
  3. * edma_test.c. W2 q$ d2 B0 Y, n
  4. *6 a: c7 u  H8 l' q1 e% S* |
  5. * brief  EDMA3 Test Application
    # p9 s1 k  d; U) o2 }4 f
  6. *
    ( m- a! u/ T& B9 G4 E- X
  7. *   This file contains EDMA3 Test code.
    ; U* ?. M# j# P% X- W* L- i; E
  8. *
    1 t3 q( k5 r$ F. U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* a" _3 H" V) X3 W+ g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 G5 J& H5 f. V* S2 U/ h7 J$ x
  11. *         TO CHANGE.
    ! Y; E2 r. t- N$ T: |% I
  12. *; g4 ~3 |, l5 T7 M0 w2 s! }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % [6 v$ J& {  k* v
  14. *' z1 P" o7 l  K) h  L& i4 x
  15. * This program is free software; you can redistribute it and/or
    9 V6 h- u7 M8 N
  16. * modify it under the terms of the GNU General Public License as
    / n8 p6 L* U: K+ V
  17. * published by the Free Software Foundation version 2.( d8 ?/ B, T: }! ]
  18. *
    & N3 Q8 A: p1 t, w$ i% t# c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 A0 n) k( b" A: G
  20. * kind, whether express or implied; without even the implied warranty& M' ]' k; E) G6 i9 c% g( ?
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. {1 Y; p: E9 M: `
  22. * GNU General Public License for more details.
    : U6 x2 J8 P7 {+ C  \& }! Q/ H, ^3 \
  23. */
    7 c% K" Q8 z5 ]/ ~, h% Q4 a

  24. % L* e6 I% T  {7 U" k# w1 N
  25. #include <linux/module.h>% g+ m4 ]  ?) @/ K
  26. #include <linux/init.h>$ Q: J. N- g1 O) }2 c- b, c. [; W) g
  27. #include <linux/errno.h>, A& Y) s8 b$ q# l  E+ c' G4 i, f  \
  28. #include <linux/types.h>7 l* N) g+ U+ k* ^! C
  29. #include <linux/interrupt.h>
    ' I1 p/ L4 z0 ?" `1 k
  30. #include <asm/io.h>
    - U" F, s5 g$ F# ^' b$ Y
  31. #include <linux/moduleparam.h>7 P& c3 r% x  E  u, s$ B; K
  32. #include <linux/sysctl.h>, {" Z+ L! ^% V
  33. #include <linux/mm.h>
    / R7 |/ U# O0 ?5 K3 [0 W
  34. #include <linux/dma-mapping.h>
    ( C, t4 L8 i5 a# z' d$ D, I
  35. % J! i# r8 _; M  n: d6 d
  36. #include <mach/memory.h>/ ]& W( U# c& B7 q5 E
  37. #include <mach/hardware.h>
    - f! [1 a) o" @% o4 L- U
  38. #include <mach/irqs.h>/ q, Y; d. n+ u% M3 z/ B# A
  39. #include <asm/hardware/edma.h>
    3 d; @% s+ Y% v( j

  40. 1 h$ l$ I: F$ u* Y) C4 e' \- e
  41. #undef EDMA3_DEBUG9 k* [, V! V5 r& G# S- C- Q1 k+ g
  42. /*#define EDMA3_DEBUG*/6 N' B$ y5 {  X$ X0 {2 k+ n8 I% ]
  43. % S) Z' V2 s; Q4 u6 d2 ?$ B
  44. #ifdef EDMA3_DEBUG* d, I! A4 `! [( v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 G7 w9 \* r$ H* Q% Y. A+ c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" u4 r, X* X1 Q- m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " R0 R% y+ g) {& {1 ~% I
  48. #else% L1 ?: @0 D' p+ v- C& _6 R
  49. #define DMA_PRINTK( x... )- Q- n6 \( {; O( l. O2 t# x
  50. #define DMA_FN_IN8 W- W; Y  g$ _' c- E0 V
  51. #define DMA_FN_OUT
    : `( N& X& `/ B- W& M& F4 ?
  52. #endif
    : o0 J9 q; d9 W; U9 y" q1 `
  53. # N/ N# c2 ^& O+ s3 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : h( p! t9 O+ r( u8 L: k; }2 u
  55. #define STATIC_SHIFT                3
      U1 V  B7 b) ~
  56. #define TCINTEN_SHIFT               20
    : ^; H+ C" H/ I1 Y! u. I7 R
  57. #define ITCINTEN_SHIFT              21
    ! L1 W( `( m+ o- P/ j
  58. #define TCCHEN_SHIFT                22& u, i  Y% E1 c% Z; A5 M
  59. #define ITCCHEN_SHIFT               23
    . I3 r8 C# ?8 Q1 Y8 b% Z2 E
  60. + I5 m" k8 s' Q5 N8 {. X
  61. static volatile int irqraised1 = 0;5 a! }" {& h; x7 ~
  62. static volatile int irqraised2 = 0;6 q5 o7 ?* Z/ r3 r( d2 d

  63. 6 q6 g7 t: w  O  `& M% y3 H) [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  |$ `' c( [4 ~0 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" p2 h* [2 g1 N( R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 U" j. W' U* f; y

  67. 3 N4 f4 N; X6 W
  68. dma_addr_t dmaphyssrc1 = 0;
    7 _4 L* n4 K1 t5 m! G6 R' ^3 h
  69. dma_addr_t dmaphyssrc2 = 0;
    ( o' _- C- P* a
  70. dma_addr_t dmaphysdest1 = 0;7 }) q. I1 r# l- J
  71. dma_addr_t dmaphysdest2 = 0;. F0 S0 {( E6 q! F% L4 n! J  f1 R  g
  72.   Q& ]$ D, h9 |
  73. char *dmabufsrc1 = NULL;7 J. D7 D" f9 _: K# A  J
  74. char *dmabufsrc2 = NULL;8 a  p. @2 h9 M# `
  75. char *dmabufdest1 = NULL;
    8 t. f- X9 f. I3 j* E
  76. char *dmabufdest2 = NULL;/ x, W' r( F) g
  77. / ]7 t4 {. e6 R: `
  78. static int acnt = 512;8 Q# U" a6 ?. j* J
  79. static int bcnt = 8;% I. g- H0 S3 D- C7 s
  80. static int ccnt = 8;+ f9 [8 t- t. v4 L2 m" L: a
  81. ) v/ f& M* H- \+ R5 R
  82. module_param(acnt, int, S_IRUGO);* w2 Y1 L) _8 U& w
  83. module_param(bcnt, int, S_IRUGO);0 N! m# w" g6 Z% [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- v) q6 S7 [; X4 j/ b- [$ ]+ _0 @3 E! {' H+ b1 ?7 V( `+ ~$ R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 Q( d9 D+ f% d& @* T5 s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( d, ^" }$ _2 l3 \+ o8 T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ h2 S' Y- W5 }5 T, q% k7 h# D$ c

1 h! W2 E3 R) S: W
8 a" f0 u1 [( Y7 |$ ~) k% Y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 16:53 , Processed in 0.038825 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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