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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , i: G8 L% i5 M: ~% C- U" {8 r
  1. [code]EDMA sample test application% B, d$ e, C* j/ p
  2. /*
    $ z6 y% ]: f. X. p8 Z* Y  ~+ X% ^
  3. * edma_test.c* p7 M8 `+ m+ S/ g# |# I$ c+ |/ R% w( a
  4. *4 P/ Y( Z& y0 R( B3 `- J
  5. * brief  EDMA3 Test Application
    3 D& J3 }. _  j* {: Z
  6. *7 v" X2 B3 y; x2 b, n
  7. *   This file contains EDMA3 Test code.
    6 D0 d" R/ I- z  ~- t9 Y8 C* @& B
  8. *
    , b: G, H& t6 n: u/ ?) |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 h' e' C0 d; Z* v' \" v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ N& N$ ^' k0 @. O8 I
  11. *         TO CHANGE.
    ( u* }( J6 W5 S+ Y- O
  12. *
    5 w6 l+ {, y+ C% D3 {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. b6 T8 S& f# V+ _2 |
  14. *
    # s0 `( o) s; _! B! m
  15. * This program is free software; you can redistribute it and/or+ C2 F; b  b6 B$ f1 u
  16. * modify it under the terms of the GNU General Public License as
    & B; g3 G5 X$ n3 |: K; h0 o: D
  17. * published by the Free Software Foundation version 2.' k& j8 R. m  u2 d. M( s7 H
  18. *) X6 v8 y4 k- m/ C! V2 r. p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; H; K. a7 ]6 h# U0 \5 _3 I/ t, L' X
  20. * kind, whether express or implied; without even the implied warranty0 M, j; C5 T( F+ g% z1 O: x* |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 c' Y7 x5 q8 b7 v9 D) O5 p
  22. * GNU General Public License for more details.
    2 t+ f+ j# j. u9 x2 q
  23. */
    ! o$ S7 Q7 x1 n" h9 r! H! l. q
  24. 2 `! D7 ]- Y2 _5 J
  25. #include <linux/module.h>
    % N/ v; c$ I* r  P8 r, n' U
  26. #include <linux/init.h>
    / w. }2 z; O5 V% S9 Z  h
  27. #include <linux/errno.h>
    / y  |9 L7 K0 q* b. q- p  [
  28. #include <linux/types.h>
    0 m* m+ m+ @4 B* H7 z
  29. #include <linux/interrupt.h>
    % `- h& \0 p4 O& u: R
  30. #include <asm/io.h>! a+ I$ t1 w: G! ]- s/ M5 \2 h/ `
  31. #include <linux/moduleparam.h>  `2 D3 |% \# I- _
  32. #include <linux/sysctl.h>8 l) v4 }# Z9 K/ B, R8 I; `
  33. #include <linux/mm.h>4 a1 Q& H6 A! i9 _
  34. #include <linux/dma-mapping.h>
    + h7 E7 C' {1 U. U
  35. 2 p4 Y# k2 R, H/ c" Z
  36. #include <mach/memory.h>; J5 t) k* q3 z- T' i: m
  37. #include <mach/hardware.h>
    # N  v5 K; l/ X" O
  38. #include <mach/irqs.h>0 y! O0 p. i* a0 ?: `
  39. #include <asm/hardware/edma.h>/ H0 C6 K* W; f# J) F# _
  40. # k8 I. G8 q/ X; G
  41. #undef EDMA3_DEBUG! D; X; P" S' R! @  \. e% p! _
  42. /*#define EDMA3_DEBUG*/! v- f3 s/ w# O9 l+ i
  43. % K+ o4 ?* c0 s+ k5 V: a
  44. #ifdef EDMA3_DEBUG8 y- S1 k0 @2 ]7 y/ ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): j7 e% N% u7 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & O* P# r: m; ?6 g9 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 _6 i4 |* Z+ P3 E9 w
  48. #else
    & I, z( K- X# K/ T$ s. a
  49. #define DMA_PRINTK( x... )1 e  m* V" i+ f6 D* A2 y/ G) A
  50. #define DMA_FN_IN1 `0 c" b& Q% Z9 m) K6 b
  51. #define DMA_FN_OUT
    * w- O/ \  g. J4 ^7 _
  52. #endif
    " t2 a% S, Q5 q% ~
  53. + n+ V% z( y7 X: m" `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 p" Z+ f. Q; a- r
  55. #define STATIC_SHIFT                3
    # F' X2 @  \) f
  56. #define TCINTEN_SHIFT               20. D  q$ K3 L; g: q8 d% J3 ?7 M
  57. #define ITCINTEN_SHIFT              21) g* B. l5 H$ N: X& P5 Y4 g
  58. #define TCCHEN_SHIFT                226 R2 i1 G( D' Z: Y* q
  59. #define ITCCHEN_SHIFT               23
    1 u$ O) y) ]( k! n

  60. / V8 e: o, s: L& z5 B8 F
  61. static volatile int irqraised1 = 0;. |+ i9 S) {4 o: T, E. q- l
  62. static volatile int irqraised2 = 0;
    : a5 x# e7 K  z% o# H& K0 U3 }$ c
  63. 5 J* w! Z3 ?& |, z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & }& s" h, [+ o/ N  n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 r* ]9 `, L' l) Y  {& }" q3 V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 U# l/ Y% p: D( R5 o. C/ s
  67. ! h1 x6 M/ E# r; F3 `! P% k, C
  68. dma_addr_t dmaphyssrc1 = 0;
    9 k9 G# v: K  q/ Z$ b& ], F3 h
  69. dma_addr_t dmaphyssrc2 = 0;/ \! ]: {# ?8 v4 d
  70. dma_addr_t dmaphysdest1 = 0;
    5 z1 t. z$ e! o8 J( y/ [
  71. dma_addr_t dmaphysdest2 = 0;* [  E1 P# t4 Z  {( w0 v# j

  72. 1 X9 G( S4 C4 F; w, V2 x
  73. char *dmabufsrc1 = NULL;
    0 a+ p( A0 R3 P
  74. char *dmabufsrc2 = NULL;  y! U7 }1 ?. J
  75. char *dmabufdest1 = NULL;
      I( H& C4 ?6 h8 |, i* o
  76. char *dmabufdest2 = NULL;
    , K( V* l* L7 d' _/ n  P) k

  77. " p3 I( z; D: {' m5 o5 D
  78. static int acnt = 512;
    ) @- q1 d0 i/ H& s7 D' b2 L. G
  79. static int bcnt = 8;# ?2 C0 l) E# n0 @7 w1 O
  80. static int ccnt = 8;
    . j$ O! e: U# `9 _
  81. / H. J' J6 x9 ~7 K' m: F7 r, O$ d
  82. module_param(acnt, int, S_IRUGO);  C; @" O2 S* q( w+ B1 W
  83. module_param(bcnt, int, S_IRUGO);
    2 Y1 n4 ]" {0 l+ V$ n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( G, ?' y1 w0 f  s: V/ i

$ k6 c  ~, ^* n5 ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 p% B9 z, T. X5 W) y8 D' `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" z( t' t1 ~" ?/ F' [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! Y5 k' h5 U" ]# v; _3 \0 s
2 D$ f5 {; q6 ^, L
& T' c4 a) j& C" `( X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 23:18 , Processed in 0.041743 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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