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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + f3 b; ^5 E' ~3 h8 _* `7 r
  1. [code]EDMA sample test application6 @  a1 `' }7 |% @/ N4 T
  2. /*
    1 g2 P: S( @  m7 S0 |# k5 F
  3. * edma_test.c1 z" ~$ v0 Y/ o2 `* N
  4. *! I1 x* n' \" q0 c' J
  5. * brief  EDMA3 Test Application
    7 h$ B. g/ c2 v$ P8 \' z; u
  6. *" ~; |( |4 W8 z" G0 N& `, u
  7. *   This file contains EDMA3 Test code.
    # ^7 I8 V2 G5 z: z8 V& ^; D- h
  8. *$ t5 s4 t/ |. K/ J$ C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * S7 Z) H( {* R& O7 a: G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ {2 R5 \/ d9 @
  11. *         TO CHANGE.( J4 I$ W6 m1 V1 Y2 S6 M; S
  12. *$ i7 L% q3 m4 u% `# G6 y, S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. V: s1 B0 L2 S' Z/ V
  14. *
    & a* ]' s8 h/ t7 q
  15. * This program is free software; you can redistribute it and/or! [7 N; t5 r: j, L. N' \
  16. * modify it under the terms of the GNU General Public License as+ H. B0 O  l+ ?: e, Q, p0 T  ]7 K
  17. * published by the Free Software Foundation version 2.  F* c0 ?; L) e
  18. *: K* V9 I6 d3 N. X! ?. o$ x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* ~) s) [1 N" F; e8 Q% c
  20. * kind, whether express or implied; without even the implied warranty
    % g- t1 i1 i7 q8 {. U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! G# M: k; V% l, G1 h
  22. * GNU General Public License for more details.
    & ?8 F/ C1 I$ z) s" T' K+ n7 R
  23. */0 G0 G0 U+ |1 J  h- H

  24. 3 p9 O+ a, E5 l: [& e7 I
  25. #include <linux/module.h>
    ( v3 r% K2 q6 X2 {# Q
  26. #include <linux/init.h># e2 \3 J/ W  `& O3 @
  27. #include <linux/errno.h>
    ' A1 W' w7 M% y0 F
  28. #include <linux/types.h>+ r. _& w. d. _6 F) k" ?
  29. #include <linux/interrupt.h>( L+ ^2 K# P, q
  30. #include <asm/io.h>
    2 _. l! o6 `( K: |4 K* ?$ l
  31. #include <linux/moduleparam.h>4 W  m" ]# s8 `
  32. #include <linux/sysctl.h>
    7 @/ C6 @, ?  }" f2 h
  33. #include <linux/mm.h>$ ]# }0 F9 t9 U( K4 P$ I
  34. #include <linux/dma-mapping.h>
    % L5 w! b( q* P+ v& g- a

  35. 0 B- e  M  @- U4 y4 C
  36. #include <mach/memory.h>5 O) O8 o( j$ v4 Q
  37. #include <mach/hardware.h>
    5 G9 N9 L. b% l
  38. #include <mach/irqs.h>& p  E0 ^- h( }# X
  39. #include <asm/hardware/edma.h>" Q) @8 A2 |4 Y* u% v3 x8 `
  40. 5 V7 w/ X6 u9 p/ P0 z, K
  41. #undef EDMA3_DEBUG6 N( G3 _# Y1 E1 [( Z8 j# i( {
  42. /*#define EDMA3_DEBUG*/% w6 V! U! F' c& {9 m- j! _
  43. ; W2 }6 A) n8 x
  44. #ifdef EDMA3_DEBUG/ @* f% V' B3 s. T- D: ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " A% K7 [  T  W2 a4 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      E; e1 e4 H8 E! n+ ~$ a* i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 A, s5 h' K: {9 _
  48. #else
    8 p2 C7 {. S5 ^0 }
  49. #define DMA_PRINTK( x... )  g: z3 d& c6 d8 d$ C! W
  50. #define DMA_FN_IN- S% l7 B% |0 e* C( Z3 t
  51. #define DMA_FN_OUT
    ) u: w, }: J' p- ^4 S
  52. #endif/ R0 Z/ C9 ]1 _! Q% t3 V' W
  53. : n% y2 D. Y. X4 P, r( l5 i/ y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& \4 s) D1 [0 s5 f) Y
  55. #define STATIC_SHIFT                3
    & C- D( }3 ?  E% [# Z' |  t5 }4 }
  56. #define TCINTEN_SHIFT               20
    ; z2 k' M/ l6 P! P+ C4 J! R" [* n+ c$ e
  57. #define ITCINTEN_SHIFT              21% w' ^# E/ `" V0 c
  58. #define TCCHEN_SHIFT                22: E1 N: U, S4 G
  59. #define ITCCHEN_SHIFT               23
    & y, i1 P: F) S

  60. / \' x- I9 y. n# R4 p1 N5 e
  61. static volatile int irqraised1 = 0;
    ) {+ s7 q  b, J% i* r4 E# c
  62. static volatile int irqraised2 = 0;6 l  [6 X7 \$ s3 G3 N
  63. & N; p3 `+ V3 k  K! r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 v, g9 c3 `3 i. m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " _/ v( {& b9 [, v5 f2 l% A- J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) [5 O: n& ?" O& E% w" R
  67. + o( E  Q& }' [) Q
  68. dma_addr_t dmaphyssrc1 = 0;! ?, e% e6 j3 N" Q7 a
  69. dma_addr_t dmaphyssrc2 = 0;
    ) R# m+ d# ]) B3 u8 }# d6 C7 l
  70. dma_addr_t dmaphysdest1 = 0;
    % l+ `" z' B# S& `( F
  71. dma_addr_t dmaphysdest2 = 0;
    6 z* Q6 a6 a  m5 U1 A: ^
  72. , m( G' w0 G. {
  73. char *dmabufsrc1 = NULL;; F1 }. q- ?4 z: M4 K5 O& ]
  74. char *dmabufsrc2 = NULL;9 m" A, t8 s5 ?6 R2 ]( f) U' i
  75. char *dmabufdest1 = NULL;# M, g4 l3 _9 j/ L8 c
  76. char *dmabufdest2 = NULL;; X) V  z& S5 {; W

  77. ) q$ ]7 o4 y% T  b$ T  t" ~7 ?" h
  78. static int acnt = 512;( U9 b+ U$ L5 a
  79. static int bcnt = 8;+ ]7 I7 P2 x/ b' V3 c4 V6 f/ \1 \
  80. static int ccnt = 8;
    ) S8 R: H; w3 d( a
  81. 7 E4 ], ]; `) C5 m: J4 M: E
  82. module_param(acnt, int, S_IRUGO);: @# Y, L2 D! A3 z5 M2 X' j
  83. module_param(bcnt, int, S_IRUGO);
    2 u: N, R  C: W4 D2 j: ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% q* w$ c& }" y) d7 K
2 _3 ]4 B  y, {$ p$ U9 p0 V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 J/ L( B. s6 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 O# g2 |+ D) x& a* {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 D( Y' Y8 i" w- G5 I7 {
- B; `" s: |/ }% I# g6 s( N1 d, p2 p8 f( {& w0 y# c" `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-24 18:38 , Processed in 0.036863 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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