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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* L- Z0 }' u# R. Y# g
  1. [code]EDMA sample test application
    + {. Z8 ^1 D: ~7 |
  2. /*: }! d  G( z8 n7 {) E6 _) V
  3. * edma_test.c
    0 e3 k4 ~/ V1 T
  4. *
    ' U: v) p' X# [& {) {: ^
  5. * brief  EDMA3 Test Application
    ) J- k( x+ x3 E0 O0 b
  6. *
    ) b' P1 P! s3 o2 J( r7 P2 G* L+ q
  7. *   This file contains EDMA3 Test code./ ^% r  @9 y7 c2 ]
  8. *
      d3 m8 \3 F2 h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' R$ ?  V% w- q6 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 T# `1 U; P8 U7 P2 Q
  11. *         TO CHANGE./ U' R5 z( b, z1 j3 t+ s, _- a
  12. *
      s* V- u' S% J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 g+ p% G% c$ B. T- k
  14. *
    + R) @; A3 F, i- B
  15. * This program is free software; you can redistribute it and/or
    $ H0 c2 G' J: w6 p7 w$ [8 X1 W- |
  16. * modify it under the terms of the GNU General Public License as
    ! L3 k1 \; K- J3 B
  17. * published by the Free Software Foundation version 2.# ~! ~( W* {) n& _, d- U
  18. *# \; b  y- {  M1 x: n1 @: N/ o4 \7 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. f' ~9 ], N# d# w* ^' h
  20. * kind, whether express or implied; without even the implied warranty
    # t: X$ ^$ A6 N0 y3 c1 F( I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" T0 P5 n, u' t* K
  22. * GNU General Public License for more details.7 P2 `' \, ?- q7 S" N
  23. */% d3 e: o/ a. `% r% C+ {) N! j+ v; U0 N

  24. 4 X5 `" {/ n+ ^$ Q" V4 O8 B% {* V
  25. #include <linux/module.h>. C  S' B9 s$ b% u) O/ T+ Z
  26. #include <linux/init.h>* a8 U& ^( K% H+ O; k8 Z: J* H
  27. #include <linux/errno.h>& q% h1 J2 h8 V; }$ V, Y4 i
  28. #include <linux/types.h>
    ! _: C$ H8 D5 F% [9 q: W" n
  29. #include <linux/interrupt.h>, J) [$ |% F) I
  30. #include <asm/io.h>
    $ _& F* t: I7 K" {/ \4 Y0 \
  31. #include <linux/moduleparam.h>
    % `# @; s7 L* c  ^
  32. #include <linux/sysctl.h>. J; C5 k6 K6 V$ H& c  r: b
  33. #include <linux/mm.h>
    : s! ^2 S+ u( [+ j, k1 D+ O
  34. #include <linux/dma-mapping.h>4 B! R( S, x( T3 i( x2 \  c! M
  35. 0 M8 [) t$ i1 L# ^" o
  36. #include <mach/memory.h>3 r; A( M, F5 }2 p& u
  37. #include <mach/hardware.h>3 E# Y; n- x7 O
  38. #include <mach/irqs.h>0 m2 M8 J" s2 F! I4 _1 }
  39. #include <asm/hardware/edma.h>" w+ m! D5 R. C( f9 k4 T* I2 N4 T
  40. & S' L5 s9 x, T! l1 T
  41. #undef EDMA3_DEBUG
    : f& q& w% S& J
  42. /*#define EDMA3_DEBUG*/
    ) ]3 i) M$ j6 s$ C' \' }, c  ^
  43. 6 p' a5 v9 V. m4 I! n/ e, R
  44. #ifdef EDMA3_DEBUG7 [( M. H  @/ o9 D2 t0 b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 n' D) n( H/ f4 b  K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / a6 p* \! I  t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + T, F4 k. P- t, ^5 h
  48. #else; f$ c  J5 w) e5 u8 H8 R# ?
  49. #define DMA_PRINTK( x... )# E" v8 h6 K6 g8 Q: q
  50. #define DMA_FN_IN
    8 q+ O  Q) Z. X
  51. #define DMA_FN_OUT
    # c" T4 `& O. r: I/ T
  52. #endif: n8 F- _- X2 s
  53. ( p; H9 S7 X1 `& D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; _# c; f3 D1 @' B2 U7 ^% D7 q, T
  55. #define STATIC_SHIFT                3
    0 x8 `3 B: f; }  ~/ m
  56. #define TCINTEN_SHIFT               20
    ' k7 ^: G3 o4 G* e4 l$ E) L
  57. #define ITCINTEN_SHIFT              21
    . |, T5 C; X8 K7 |$ D* G
  58. #define TCCHEN_SHIFT                22
      r0 [6 p1 [% E8 q
  59. #define ITCCHEN_SHIFT               23
    ; u: x4 A' V) J+ @  h! U

  60. 9 V7 I( Z( X# B9 l5 Y
  61. static volatile int irqraised1 = 0;
    3 E3 h, s- T' I
  62. static volatile int irqraised2 = 0;, X! M% Z7 S5 r4 O
  63. : D  j" U# P0 H7 P- N; e( g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 v: D0 }4 [# y% Q+ d1 ^1 d9 c: a  K$ S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 z/ U! G6 [( K: m/ A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 y+ P/ Z! M. H

  67. 7 c$ |( k0 I, o8 \6 C9 F; {4 }  e$ L
  68. dma_addr_t dmaphyssrc1 = 0;
    ) W) ?! m# O# c, Q/ z: H3 H
  69. dma_addr_t dmaphyssrc2 = 0;
    ) ~. i. f2 ~+ F, ?3 s( p/ }) U
  70. dma_addr_t dmaphysdest1 = 0;
    / ]  e' {" h! }( j" j# l
  71. dma_addr_t dmaphysdest2 = 0;
    ! Y+ ^% r9 N6 L. i7 T1 D  y4 C, q
  72. ( {6 Z; @, r2 U- N" k
  73. char *dmabufsrc1 = NULL;, h, m1 [. i" z- J6 o+ a5 l
  74. char *dmabufsrc2 = NULL;# B1 E( c/ V# o" q
  75. char *dmabufdest1 = NULL;$ M, W; P% F: V: Z+ Q$ g( S( x
  76. char *dmabufdest2 = NULL;
    ! q; C, Q4 d5 Z* v5 r+ o
  77. - W5 c: q+ |0 g3 e& U+ `2 n
  78. static int acnt = 512;
    9 B6 b1 N% U: J$ ~5 W5 H0 H  W3 z' G
  79. static int bcnt = 8;, c( {. j( c/ v
  80. static int ccnt = 8;0 \2 _+ l+ b8 ]  j! u3 G6 T: y
  81. + ]; f4 C5 d/ P3 ?
  82. module_param(acnt, int, S_IRUGO);8 }, p- v" y' g3 x& [* R
  83. module_param(bcnt, int, S_IRUGO);1 |7 I% d% e7 |7 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' X8 ~- m1 d' C2 X, K0 q: M
% m. n* E, q: S+ k5 E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 W; `1 p9 F. Z  g! e4 q$ ~: s4 k1 Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ F$ l8 \' b" e& o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 A0 C$ ?, ?+ Q" w* j

2 _# x) e! d" s6 U- M" h
( {! ]( r: H; F1 l- m# o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-18 23:37 , Processed in 0.043233 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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