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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 }; S3 ~- i4 S1 y/ f( ~; J. F& W
  1. [code]EDMA sample test application) C( B3 u/ C$ U# ~- q) G- F
  2. /*6 R& a( ~5 v, h  W3 `+ h  f# J1 _
  3. * edma_test.c: G9 X7 R1 _7 O7 @3 N7 X' f
  4. *# a) n0 C7 N7 ^- \5 y& w  `
  5. * brief  EDMA3 Test Application0 T$ z2 C* j. d
  6. *8 X8 L8 F% Z8 ^) t; a5 W
  7. *   This file contains EDMA3 Test code.
    . l6 n( M# e# Q; C1 G7 b
  8. *+ U$ O4 v8 a- W2 a# \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" Y- q5 ?; R& |. n& g6 @1 A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; d$ U. o. a# R: v& P
  11. *         TO CHANGE.
    1 b! M! P6 m4 {$ v( K- W- A
  12. *
    ( W& V, m5 T2 u2 r; B" ?: L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , T5 n& O7 _% z. ]2 b7 l4 f
  14. *  p$ L, ^; s; {* x7 |* r, B
  15. * This program is free software; you can redistribute it and/or
    * g6 b1 o7 O- k1 y" J% H( l
  16. * modify it under the terms of the GNU General Public License as
    ' X% E3 f5 ?8 C$ g" {% p
  17. * published by the Free Software Foundation version 2.1 y5 U. L) l( \* P
  18. *) I8 O5 h- Z! O  b9 k
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& F, A  k* W  x; m, {
  20. * kind, whether express or implied; without even the implied warranty1 h- J$ P+ v! D5 j! O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ |: S# I! f. a2 o  i0 i* r
  22. * GNU General Public License for more details.6 G" i# ~7 y! [4 O
  23. */
    - |4 Z  R8 o. W1 V1 k% u
  24. * i7 M  h) r. w5 r' |* a# W( u
  25. #include <linux/module.h>
    ' {5 T: O2 F* X1 `
  26. #include <linux/init.h>% i' t+ @; H7 S& W" ]9 M
  27. #include <linux/errno.h>: G5 ]5 f0 M! ?: w  \$ d9 S; L
  28. #include <linux/types.h>3 W: V; O$ k; g1 ]4 f5 G) J
  29. #include <linux/interrupt.h>
    / D1 e9 n5 ^" l% Z( |# f3 ?
  30. #include <asm/io.h>
    3 X" p7 k: s3 U# `+ Q
  31. #include <linux/moduleparam.h>
    4 ~( C  s7 @6 q; N6 N, M9 z
  32. #include <linux/sysctl.h>
    - J( E% ]- {9 T1 {
  33. #include <linux/mm.h>
    / [- x: k, G+ b( U# l- K
  34. #include <linux/dma-mapping.h>
    $ Q7 e8 X* N2 m( r) j5 a' C
  35. ! |% J- U  M( A7 C( c7 B) n
  36. #include <mach/memory.h>
    5 z8 s- z" ]* S$ Y. O" a9 E
  37. #include <mach/hardware.h>4 l8 V, U+ x, J7 j3 |' s- N. b
  38. #include <mach/irqs.h>' c: G* X% k9 W
  39. #include <asm/hardware/edma.h>2 s* I9 z' k8 U# h

  40. 4 l' J+ F5 S( ]. B/ s1 f" D3 k8 g
  41. #undef EDMA3_DEBUG3 P: V. J1 ^- e8 s/ h- s+ V
  42. /*#define EDMA3_DEBUG*/
    ' X' r( b+ Z; N$ @

  43. ! m( q8 i- E' T" s$ c0 B8 ^
  44. #ifdef EDMA3_DEBUG+ ^- F: S! `- a- |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)2 `2 N; S1 ]0 V# M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# k) G4 b! n6 }- b& [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & z0 }$ A) p3 C* \  m
  48. #else
    , R/ K$ s9 j( v9 ~
  49. #define DMA_PRINTK( x... )& M& z' r% l4 h/ r
  50. #define DMA_FN_IN
    $ c" o6 {9 j+ Z1 {, p( ~; P+ C! p1 \- H
  51. #define DMA_FN_OUT
    . ~% L3 k! j  g: t& ]
  52. #endif: L- B& p! O  ?, p
  53. - V: r3 V' S1 Z0 ?6 c9 c+ E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , S% h: g' A0 J  g1 d
  55. #define STATIC_SHIFT                3+ F6 \6 T9 Z/ _, t7 ?
  56. #define TCINTEN_SHIFT               206 Q/ A. i4 q0 }: P2 y  G
  57. #define ITCINTEN_SHIFT              21
    + \+ W: D2 B6 p- }) E3 L
  58. #define TCCHEN_SHIFT                22
    , }6 `, r. L9 G' A
  59. #define ITCCHEN_SHIFT               23
    ( ]- S1 A8 }1 G! d9 O3 k
  60. + B& O, x# [5 k+ S. o3 V+ {0 X
  61. static volatile int irqraised1 = 0;3 n/ t5 |3 q( w; S
  62. static volatile int irqraised2 = 0;
    - I6 {4 C4 {3 n+ |: w2 t& B
  63. 1 U' v& p3 h6 O' l; I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 A0 Q! r! q  `6 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 q% y, \% O% j, y* V3 K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 d: X; t4 O0 g# ~* x
  67. ) {% A" x2 i, `) q0 |# n9 W
  68. dma_addr_t dmaphyssrc1 = 0;
    * O+ ~) O; z' |; S! r, |$ |9 o
  69. dma_addr_t dmaphyssrc2 = 0;
    " t, W0 N2 T$ i) J" O
  70. dma_addr_t dmaphysdest1 = 0;
    ( K; L) |" Z, v/ n2 C. M. c% Y
  71. dma_addr_t dmaphysdest2 = 0;
    # ]. x9 K" [" h! C. S5 g  ~

  72. . b" O+ S. S9 v8 ]5 |0 L
  73. char *dmabufsrc1 = NULL;
    ( q! T  i" [! m3 P# f
  74. char *dmabufsrc2 = NULL;* h6 g5 R" `2 ~/ C. a, D- S
  75. char *dmabufdest1 = NULL;
    0 U3 h; t  D  ]& w4 `0 O1 R
  76. char *dmabufdest2 = NULL;
    / g6 j) H0 a+ R4 b
  77. 8 ~5 B' _# Y$ H" m
  78. static int acnt = 512;, ]' W) Z$ }, }: D0 _2 ]& ]" Q
  79. static int bcnt = 8;
    3 H9 V, C: i" w1 G9 P& o
  80. static int ccnt = 8;
    ) g7 {6 I, U1 W2 f0 K; y& t

  81. 7 ~- f6 ^/ j6 X) T4 h
  82. module_param(acnt, int, S_IRUGO);' H) ^5 v; q' G3 d- `3 `, w" V! ?+ Q7 W$ P
  83. module_param(bcnt, int, S_IRUGO);& D2 p! m: ~; h1 y+ k" x( K6 s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  t$ U/ D. p) g, t
2 @; o. O$ f( H, _5 O3 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ g' X8 b6 T: O2 _7 barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% f1 m' E% G& u1 B2 X  a. K" s& f% M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 G. L; s  n2 ?, f2 s

/ [" G# g' Z& Z- a0 E8 Z9 E; y6 J$ c+ J2 S- R3 `; P& [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 15:38 , Processed in 0.041339 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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