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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% X5 z9 {* j: g/ s4 f
  1. [code]EDMA sample test application
    7 G( l7 s, U) p
  2. /*3 `- o0 R! n6 g/ ?# e# n
  3. * edma_test.c3 R( V' `! b4 e8 k4 |0 e: M( i
  4. *- u  t: M% i# v& a* e+ {0 l/ E6 [
  5. * brief  EDMA3 Test Application! I6 C6 R0 ~9 t- D5 m+ _: i1 m4 E/ {9 p
  6. *6 L) Z% Y5 q* L
  7. *   This file contains EDMA3 Test code.
    4 c7 v( L/ c) ]
  8. *
    , {/ `* E- F% |( L8 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . v% m* j4 i  p5 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - B1 q4 l) f  I* l! e, g
  11. *         TO CHANGE.
    1 T9 k0 X* `7 S( _, [
  12. *
    $ h! c: y$ y9 }- a) g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 T1 B6 k( N# g/ `3 C/ ]
  14. *. V4 Z8 O$ U6 C
  15. * This program is free software; you can redistribute it and/or
    1 r1 D! b" k/ O, I  g
  16. * modify it under the terms of the GNU General Public License as  P, g4 {* S7 J+ a5 v" `
  17. * published by the Free Software Foundation version 2.
    * Y/ K+ C/ `5 K% d6 v5 {. c8 z4 k
  18. *9 |9 _4 f- D4 m2 L. b7 b- J6 y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: u! w" p) S; R
  20. * kind, whether express or implied; without even the implied warranty5 d* @8 o: W+ ^( c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' e* v, q7 [4 X  y4 z9 g
  22. * GNU General Public License for more details.- S4 o! y% e: j4 S* X
  23. */
    ( X  ], z; X4 J9 Q. m2 x( K
  24. ) `. B  c: E3 G/ g1 v6 d# d# W
  25. #include <linux/module.h>
    + V7 a- {' S: ]
  26. #include <linux/init.h>
      m9 r: D# p9 T
  27. #include <linux/errno.h>
    4 n6 D5 G+ q( B; f6 o, m
  28. #include <linux/types.h>  j& v1 p! ~. c9 V4 m5 E4 X
  29. #include <linux/interrupt.h>9 _% P4 ~' h5 G: I: T# s
  30. #include <asm/io.h>
    $ H8 |/ D7 _" W8 i1 u& B) N
  31. #include <linux/moduleparam.h>
    1 X1 A) W8 d; V" ?
  32. #include <linux/sysctl.h>7 d. r, ?+ V! ~: R0 p0 ^
  33. #include <linux/mm.h>
    0 d& ~' p6 M( [
  34. #include <linux/dma-mapping.h>
    % x+ _) _* n' ]% I$ Q0 h

  35. 8 j1 T- C* n4 ^  B
  36. #include <mach/memory.h>
    4 ^% a: N5 J, l
  37. #include <mach/hardware.h>
    ) t0 I% F( g8 l& {' ~1 X
  38. #include <mach/irqs.h>7 f% _7 g; h) j# S7 K
  39. #include <asm/hardware/edma.h>
    ' a# Q" x3 c. @" l0 F

  40.   x% E, i# ?5 T! u1 M
  41. #undef EDMA3_DEBUG, W. t& C6 X5 d* i3 u
  42. /*#define EDMA3_DEBUG*/; a' i$ j0 M! O9 n- X
  43. % V/ b/ W8 o) g- Q
  44. #ifdef EDMA3_DEBUG
    + I+ g/ ?: O7 e- U+ M9 i2 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ _6 l. s7 L% c$ J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 P  r! s& a6 @; U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ B- A: W" o. R* e$ |% Y3 z
  48. #else
    $ E" O3 G+ c( o' P9 [1 x
  49. #define DMA_PRINTK( x... )/ E+ `! |5 ]4 J! Z' [' G/ [5 K
  50. #define DMA_FN_IN3 b7 V3 x$ d4 F) q, P! I
  51. #define DMA_FN_OUT
    ; t- \; }1 a6 z( \* D
  52. #endif
    % V: w5 V: W3 J1 G$ B7 R% Y1 ?
  53. ! t% p, p- u7 _1 q6 U- W' O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . j2 @0 n* y  N
  55. #define STATIC_SHIFT                3
    0 q0 x9 Y  h' d$ E
  56. #define TCINTEN_SHIFT               20
    4 m2 c: t  s/ V: U8 R) A
  57. #define ITCINTEN_SHIFT              21# E- G" K) i0 l" d
  58. #define TCCHEN_SHIFT                220 D9 o% F5 y8 A7 O
  59. #define ITCCHEN_SHIFT               23( g% s+ ~' J% x5 n+ x" r( H
  60. 1 n) X, Q" [7 q; u) q& D/ w4 v
  61. static volatile int irqraised1 = 0;) a! L5 _. C2 ?- i
  62. static volatile int irqraised2 = 0;
    2 ^8 K! b  k; s! h9 J( t
  63. ; Q1 \0 {* k! Q5 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 r0 B; o. k  n8 {; @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 q0 t% t; q! f  A, g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % X. b) e- G; _$ r  L" m0 t0 W
  67. ; ~2 e2 T. g# |8 a
  68. dma_addr_t dmaphyssrc1 = 0;
    ) w) U$ ~; s0 `* S4 i, @8 A
  69. dma_addr_t dmaphyssrc2 = 0;& n* Y* z! U2 M: |2 m" Q# u" L
  70. dma_addr_t dmaphysdest1 = 0;
    ( d- h! r5 E% G' c( {/ P
  71. dma_addr_t dmaphysdest2 = 0;
    6 S4 L9 Z8 b( C  R& g' z5 q: B& D
  72. + C: m% t( K: t5 a9 s  w
  73. char *dmabufsrc1 = NULL;" ]$ q* T* g/ y( y
  74. char *dmabufsrc2 = NULL;
    ( m: V( w' Q. b" N
  75. char *dmabufdest1 = NULL;
    1 j' f! A: [% m$ J
  76. char *dmabufdest2 = NULL;
    ' O" i# z" d+ w5 n$ u

  77. # Y& n: P  l# ]& n  h5 L- g
  78. static int acnt = 512;, O  u+ J& u. b: r$ q9 d; K
  79. static int bcnt = 8;
    & ^% r7 m/ q+ n; y2 G
  80. static int ccnt = 8;
    6 p. i+ J. t6 v( p  E
  81. # v8 x4 `1 l7 ]3 C; w& U
  82. module_param(acnt, int, S_IRUGO);% R# a# R" X6 K& w
  83. module_param(bcnt, int, S_IRUGO);
    + w2 [1 S3 y% l. i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' r' _; \6 b5 `7 u4 Q

4 q5 |3 B9 ?2 X      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* e' p8 F+ B0 U& u) `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' J4 j/ O! ~7 f7 s  a8 g: f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ f( l# s' E3 E0 o
5 o, t) c# G. J# }

; S& n! d5 m  ?' V9 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 15:30 , Processed in 0.039067 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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