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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   q6 ^% E9 C) j8 r3 X. K' ]2 \/ i
  1. [code]EDMA sample test application  U0 W! L& ?% v- f8 O7 m
  2. /*3 F- h! M! t/ m# t# E. _
  3. * edma_test.c
    4 U* Z  O; G+ \$ X+ Y) a* H' j; ?
  4. *2 t. ]2 V" e- e
  5. * brief  EDMA3 Test Application7 D1 d, _* }3 X. L0 C) y/ k& M
  6. *% ~% T8 O7 z5 s% P. |
  7. *   This file contains EDMA3 Test code.
    2 L) d- G7 O7 F! ]: @, G1 `" s2 R
  8. *$ }7 i& d2 w/ {( z4 g6 s# T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) D# W" t6 B2 Y/ h: l& R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT( }& j+ }& C* b% C% u3 R% b
  11. *         TO CHANGE.  Z/ v, t+ d, O2 X# Y
  12. *1 V! r/ q0 ~0 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ ^+ K1 y/ {: A+ [+ w% f1 h3 l
  14. *& J8 e& H# j0 {, U% d' u
  15. * This program is free software; you can redistribute it and/or
    9 `! i  p0 m* ^7 r
  16. * modify it under the terms of the GNU General Public License as# q2 O; d' Q) O" M; a/ z6 e
  17. * published by the Free Software Foundation version 2., W- v6 H+ n' ]
  18. *
      |# i) }# p, A6 k1 {3 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% }: J- S. i) B9 \
  20. * kind, whether express or implied; without even the implied warranty
    . S1 X5 M' x/ c2 R& W  k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1 ]3 e& Y" F: }8 {6 ~. u9 L4 q5 \. @
  22. * GNU General Public License for more details.
    5 L3 c- w' h5 b6 o, u
  23. */& n% f* S" {; N% R5 w

  24. : K, ]) g2 s3 e( g3 U# E, X
  25. #include <linux/module.h>
    2 n  I) |5 t" z- o6 v" E
  26. #include <linux/init.h>
    # {4 `# i. X- n" r! w0 K1 K1 `* @
  27. #include <linux/errno.h>/ [6 h5 c0 T5 {9 ?
  28. #include <linux/types.h>
    ( F7 j" F1 z8 ?2 O4 A
  29. #include <linux/interrupt.h>- _6 \3 C& z- m+ @) B
  30. #include <asm/io.h>
    * e1 G& L1 \7 L1 \5 c! b
  31. #include <linux/moduleparam.h>/ b( h& F! O5 l' N
  32. #include <linux/sysctl.h>
    8 ?9 ]) ^( P3 m
  33. #include <linux/mm.h>
    6 p( t% k; N: n9 e( Z7 x: V
  34. #include <linux/dma-mapping.h>  y$ p/ ?0 Y$ M1 E

  35. 6 u2 C4 a- a# k( A; R
  36. #include <mach/memory.h>
    3 H: p7 r$ y- l5 L1 v- P
  37. #include <mach/hardware.h>6 N* O! y7 K  {
  38. #include <mach/irqs.h>1 U; ]- R0 E' V7 R
  39. #include <asm/hardware/edma.h># h# L1 B6 Y* i$ w- Z; z/ Q
  40. 7 q8 |5 ?+ a3 ~5 J' b7 w
  41. #undef EDMA3_DEBUG. S: _/ ^; M8 [# n
  42. /*#define EDMA3_DEBUG*/
    ( U4 w" E5 K; S0 y+ n( E  X
  43. 3 N5 Y8 e0 O; z1 a  Q
  44. #ifdef EDMA3_DEBUG! p/ v! [6 q  X0 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( N* I) P9 k& K5 r4 R; i& u2 X) L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! I1 I, f( Z# N9 L. O* }3 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); e) @/ [( p8 V2 z; {6 j  k
  48. #else6 P3 P$ m  }8 k, Q. Q+ g# D
  49. #define DMA_PRINTK( x... )8 q0 ^  c; O5 {4 O
  50. #define DMA_FN_IN
    ) b; O! f) q: ]& R3 d  B0 }
  51. #define DMA_FN_OUT
    - A! C9 A9 }7 `2 a  x9 K6 ?! O. U
  52. #endif) F2 A) _7 E6 J. j* |% u* c
  53. 2 u4 [% v+ D$ h  Y* s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / e' W/ `' G4 z! h
  55. #define STATIC_SHIFT                3
    7 @7 X0 h- G# Z3 f
  56. #define TCINTEN_SHIFT               200 B4 @0 m4 W7 p# l) c. i0 Y+ o
  57. #define ITCINTEN_SHIFT              21: s- _! {% K! n
  58. #define TCCHEN_SHIFT                22
    1 L% o- O3 N) R0 l
  59. #define ITCCHEN_SHIFT               23
    4 P- c. U8 T1 M5 j; B+ q, v

  60. ' \) L/ s& q6 B; m
  61. static volatile int irqraised1 = 0;
    0 m3 s" N& Z! e5 m
  62. static volatile int irqraised2 = 0;
    2 z; @% h6 d) \
  63. ( @/ L" _& Y+ Z2 [. q: a7 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 w, u- t' {9 F3 b1 d& |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) t3 D: ]1 b6 c$ F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ^* J) Q6 X9 J
  67. 7 F+ C3 v$ d. {2 O( `
  68. dma_addr_t dmaphyssrc1 = 0;
    # i- g& L; [4 w
  69. dma_addr_t dmaphyssrc2 = 0;; ?4 k0 j$ u" P( q5 q9 L3 R
  70. dma_addr_t dmaphysdest1 = 0;
    1 T* [% @, ]4 I9 c( r& y3 V) ]
  71. dma_addr_t dmaphysdest2 = 0;
    ' G& y1 [  z2 a: }6 P2 }  L/ U+ D

  72. . _# f4 h; ]" Y% N) |
  73. char *dmabufsrc1 = NULL;* m. a/ G  r$ I9 K& a
  74. char *dmabufsrc2 = NULL;
    ; {; e4 K0 j# q4 B' s8 X' P- b
  75. char *dmabufdest1 = NULL;7 P2 [# b6 |* ?% j/ `$ }
  76. char *dmabufdest2 = NULL;
    0 [4 E# A( u: @5 r- }* M
  77. : h+ `, I$ M3 X1 F6 o/ M7 u
  78. static int acnt = 512;; j$ j8 i/ `( a
  79. static int bcnt = 8;
    " d* r, V# a9 ?1 M
  80. static int ccnt = 8;+ V6 n5 p+ \; f0 o1 f& s# ^+ ]
  81. 1 `9 n2 U0 [& K' p
  82. module_param(acnt, int, S_IRUGO);
    / o) l8 t: T+ ]6 n' y; s
  83. module_param(bcnt, int, S_IRUGO);# n- W' `( f. J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& F8 R% o) T. M& \: l; E
% \; b. N, @' y, I) `5 D+ g2 ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: O' }9 t0 |1 l6 a1 Q0 S+ a& 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: c. h, N: G# j; ~4 i9 N
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* ^& \, o9 F/ o+ X: ], ^

& G/ g0 S( r* G
, e3 q! f) c! R' m: a0 ~1 Y' t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-26 05:29 , Processed in 0.041923 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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