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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! {& c. M0 a! S, ]$ {5 w- f
  1. [code]EDMA sample test application
    1 [' E, J3 H1 \3 s
  2. /*
    * d7 \( \! T# U7 E
  3. * edma_test.c
    . @0 g0 r& i9 D- D
  4. *0 s# f1 M+ O# z2 u4 n# v/ B
  5. * brief  EDMA3 Test Application5 _3 A* ~# U- ^
  6. *
    5 m$ l- l8 `  e5 V" C
  7. *   This file contains EDMA3 Test code.
    # v% n( U5 G, z5 R( m# b6 b
  8. *
    4 t/ |' n9 R& m7 [# |" N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% h8 x( h9 c3 x6 T; n1 @& l& G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 e( Y) \  c$ d" A9 s
  11. *         TO CHANGE.$ f: C1 |* C: Q1 p) ?7 r  l0 z% i
  12. *% {/ `& V% x9 F# L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) b! J4 U6 S( K4 F, `6 J5 J
  14. *1 m# j* b6 [+ G. ]4 c6 X
  15. * This program is free software; you can redistribute it and/or
    4 {% l5 G0 K, q$ l. Y
  16. * modify it under the terms of the GNU General Public License as9 R: f9 e6 T- P5 M# y; x
  17. * published by the Free Software Foundation version 2.; R; @& _' v; M$ s! u  g
  18. *
    1 ]6 ~$ n" ?3 ]/ n# t; O: J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; B* `( j, t' |( t/ B6 n
  20. * kind, whether express or implied; without even the implied warranty
    ( ~$ |! f9 K9 q1 z% D' r/ ~) c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! d- @( J! P# o
  22. * GNU General Public License for more details.' a) W8 t  {8 f! w: e
  23. */! G5 m+ d& B2 ^/ {
  24. + L5 F8 U9 f, I6 h
  25. #include <linux/module.h>) X; ?" c" k8 ?0 Q
  26. #include <linux/init.h>
    ; L( ~8 m- X) }% g7 J" n
  27. #include <linux/errno.h>
    " n$ @6 d! s5 F1 a, o1 i
  28. #include <linux/types.h>/ P+ \; U: @2 T* N8 [
  29. #include <linux/interrupt.h>
    3 W6 \. V2 Q) j% k% O; H* t  f- K$ D
  30. #include <asm/io.h>
    8 B' {) S0 S' i( S  u5 r) {
  31. #include <linux/moduleparam.h>  ^6 C' M( y. V  z2 N5 t7 e
  32. #include <linux/sysctl.h>
    # z" I, s5 u  T9 J# U! r  |1 W9 f( ~* d
  33. #include <linux/mm.h>
    # y, N7 o) X' u( }1 L
  34. #include <linux/dma-mapping.h>. f3 c( L5 ~9 S! A( `
  35. ! b  w  i9 ?' I5 ^  N7 s
  36. #include <mach/memory.h>6 w( v; [& k; j) R
  37. #include <mach/hardware.h>. n9 n5 w" P, K0 K) `
  38. #include <mach/irqs.h>! p7 S' s& ^! E5 I
  39. #include <asm/hardware/edma.h>6 h: _) }* S* a! d" Z
  40. : o* a4 @* k" M& @; V
  41. #undef EDMA3_DEBUG! v3 F/ F! P, L$ U! j1 r8 y
  42. /*#define EDMA3_DEBUG*/; n6 q+ P3 p0 l+ ]  O- L* A

  43. ) a/ x7 \% X7 I* k1 Y1 w3 x
  44. #ifdef EDMA3_DEBUG
    ! Y, c* @9 ~6 j+ b- l  b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' l& S. a; P* ^- J: f; t% `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 a, z# W1 |  g: c( h! m3 M; L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  ^2 f! c  \. U% R2 R
  48. #else
    1 n# q/ v" n( n2 H, [" i1 w
  49. #define DMA_PRINTK( x... )
    : v3 U8 L( j3 r3 v; a
  50. #define DMA_FN_IN, A( p. y# V/ V; V# @1 ~
  51. #define DMA_FN_OUT
    / V4 f9 P4 b2 k, m& F4 p+ _" a
  52. #endif
    6 T. Z6 L/ z  d- i1 m
  53. " U% Y- f. Q; J
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# w( [) {# O, H0 Z
  55. #define STATIC_SHIFT                3
    9 N7 t" l; ~0 j
  56. #define TCINTEN_SHIFT               20
    0 l) e' Z; v, ^/ Z! v! T
  57. #define ITCINTEN_SHIFT              216 Y& Q& U+ S+ b+ o, ^) {
  58. #define TCCHEN_SHIFT                22
    5 H& \! ]% t) V# t7 A* k/ V
  59. #define ITCCHEN_SHIFT               23
    " S. q6 W5 z- I7 x4 o( y* ^
  60. 2 W8 `: J$ |2 `7 o) X9 x
  61. static volatile int irqraised1 = 0;
    * M& ]9 {: F6 L5 z0 r
  62. static volatile int irqraised2 = 0;
    ) v9 `+ J( S1 f, X+ q0 c% @

  63. ; f- g4 z0 M4 p  N. A4 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! e) {( x1 [1 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 `- R7 w, w( [* f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 j# ^5 f/ N; [; w8 P

  67. 4 ^. `, |( X3 i4 c. X4 Z
  68. dma_addr_t dmaphyssrc1 = 0;+ W6 n) J5 a! t5 J* Z4 s, l8 }2 q
  69. dma_addr_t dmaphyssrc2 = 0;
    7 b* y% J# s5 e8 r) ?0 \4 g! M
  70. dma_addr_t dmaphysdest1 = 0;6 U9 D* Z, f% ], D) Q( F& r
  71. dma_addr_t dmaphysdest2 = 0;) a8 }  G% P! M7 t

  72. ; @2 ^- t1 K+ S, d
  73. char *dmabufsrc1 = NULL;
    ; x. i) \! g7 m+ _( R
  74. char *dmabufsrc2 = NULL;1 E6 p" ], O" s9 k9 `. f3 F
  75. char *dmabufdest1 = NULL;
    4 j7 N+ G  M! j' v1 I4 R
  76. char *dmabufdest2 = NULL;$ ]4 B6 m8 j! [8 r
  77. 1 H. M/ O" g7 G) J( O& l
  78. static int acnt = 512;
    * K/ r( O7 ~- y) U" \) O
  79. static int bcnt = 8;$ C' a" s3 J, h( J9 c
  80. static int ccnt = 8;
    $ e/ F4 A% Z* N* q+ P& u1 k7 y
  81. # l0 l9 `+ E$ |. ~
  82. module_param(acnt, int, S_IRUGO);6 n; i0 N1 a5 N: N" T6 t
  83. module_param(bcnt, int, S_IRUGO);2 `+ [5 C! ?1 C  X2 }1 E. M( J
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 e6 N4 g4 t" Y' a; m
# @' z* O. _; t4 W- |9 g      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 z, h: Y: Q6 `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ s: Y6 ?% e" h& ]) X* |; U/ ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 u, u3 L3 V; I# y8 @% h2 p9 k
# u' @5 T' C! P# @7 F6 Z- Q  Y& T& D7 q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 00:49 , Processed in 0.039241 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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