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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # s) `) I- N$ \/ V- ?* ~
  1. [code]EDMA sample test application5 v/ `2 }( G7 I( N5 W
  2. /*
    2 F* c" [+ O2 z' G, L& P, w
  3. * edma_test.c# L  u2 g* \* f: }4 p
  4. *
    3 _# A" y, Y5 |* _
  5. * brief  EDMA3 Test Application" I1 G3 V- q" Y( ~% @; {  D+ f
  6. *
    * y9 r- x( n9 R; d
  7. *   This file contains EDMA3 Test code.( D. u7 ~$ H; _1 l' P6 W
  8. *7 i, l# J/ \" K4 G1 u7 X+ }' K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 Z3 i2 V/ H* ?6 e0 c' f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 h: M; U2 `+ [2 v9 b
  11. *         TO CHANGE." p- x7 F5 T1 i, e1 g& B
  12. *
    , m) B& T" r5 l& p9 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * D5 F6 U1 d6 w7 t8 B& k
  14. *
    3 P% i3 h! m6 ^% w3 L4 \) m
  15. * This program is free software; you can redistribute it and/or
    4 L1 j9 `+ S6 r/ U) R0 R
  16. * modify it under the terms of the GNU General Public License as' b+ \; s( X" l3 O; a0 _0 f
  17. * published by the Free Software Foundation version 2.! ]1 W( u# O% A. Q/ @5 k
  18. *; r  [1 @0 J, I* W7 c, y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    : f. B* P1 [- n" U" R* Z
  20. * kind, whether express or implied; without even the implied warranty
    ; ~- J% [$ F0 }: c# w: H4 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ |0 `+ p% B, ?% F
  22. * GNU General Public License for more details.
    3 L( D) F; q2 p' t- h
  23. */; d; \/ _' K) n& A

  24. ) c/ q" Z" l! A0 ?
  25. #include <linux/module.h>9 K0 W# g4 C1 N5 D7 H
  26. #include <linux/init.h>. N& A" M7 \% p+ c" c) n/ P
  27. #include <linux/errno.h>$ a. i* y# {9 Q3 i! t! b8 k6 o
  28. #include <linux/types.h>
    7 f, b! [* g  c) t, Y
  29. #include <linux/interrupt.h>9 O3 E$ \$ U$ R: P& L# O. n; t; l" t
  30. #include <asm/io.h>! x! `+ g$ B! y' A
  31. #include <linux/moduleparam.h>' m' N- m! m, b
  32. #include <linux/sysctl.h>2 R4 x; d+ C0 H
  33. #include <linux/mm.h>
    ( H' W; j2 b' ~/ t2 C
  34. #include <linux/dma-mapping.h>4 ]  y1 u" J8 i5 s! _

  35. + g) B- F2 E3 S+ ?
  36. #include <mach/memory.h>
    : H- N* Q% [& J& s
  37. #include <mach/hardware.h>
    3 P3 o7 l- C1 C: D% t
  38. #include <mach/irqs.h>0 B1 S* o9 s- |$ L! i# b
  39. #include <asm/hardware/edma.h>" ~' s, {) F$ N  m+ O7 y
  40. - G4 ~" G! q1 c  Q2 i  Z4 [
  41. #undef EDMA3_DEBUG0 Q6 Y2 [) J7 ?2 y2 N' `' f$ I! q) q
  42. /*#define EDMA3_DEBUG*/
    " T8 ]2 V: X! e- H6 W3 }3 _

  43. 4 a0 K2 s0 ^3 E) B' g
  44. #ifdef EDMA3_DEBUG
    4 \% u0 ~+ I$ r4 j! X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 [6 j! }1 a& a2 P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ m8 Y7 ~/ ^9 X) L7 K8 p6 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , ~$ a, I' y5 M. `: k
  48. #else) H. f. s& r* y2 q
  49. #define DMA_PRINTK( x... )2 S( j/ i9 N" o' P8 R
  50. #define DMA_FN_IN
    + E1 y3 i7 T' t3 a  n
  51. #define DMA_FN_OUT0 i8 Z, e( D1 U' z, i% c
  52. #endif
    ; \- Y9 f) g, i$ J
  53. " |- {( I+ u. `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" d& j: A2 j& B  k
  55. #define STATIC_SHIFT                3- D9 B. A2 X1 Q5 a" I5 s4 Y! i
  56. #define TCINTEN_SHIFT               20
    5 p! b; j7 ?# g
  57. #define ITCINTEN_SHIFT              21. s7 B# [, r8 [* k  j
  58. #define TCCHEN_SHIFT                22
    $ a, m! A7 U. L
  59. #define ITCCHEN_SHIFT               23
    / O6 d4 m  G: z2 P& {. S
  60. 7 I1 \4 P, }1 {/ a* Q
  61. static volatile int irqraised1 = 0;4 w1 k0 B, q' f
  62. static volatile int irqraised2 = 0;4 _. D  z3 F, Q, R, n: ]' ^
  63. 2 @% |1 n  ?. r. a5 x1 R* {! N7 I& j* E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% Y, O0 `4 h# [1 T/ Z* q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* B+ t) P  d7 q) @% \$ Z# U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * l+ l0 t8 u5 m9 q* V

  67. 5 q, I; {! N0 g9 _( K" I. q
  68. dma_addr_t dmaphyssrc1 = 0;6 Z* f  s2 c* d* }
  69. dma_addr_t dmaphyssrc2 = 0;3 s0 K5 m) j/ a  C0 ^
  70. dma_addr_t dmaphysdest1 = 0;% N- L* C. J- K# p! t, r
  71. dma_addr_t dmaphysdest2 = 0;/ ]+ Z+ R( s2 ]
  72. . m4 X8 O& {8 F/ a
  73. char *dmabufsrc1 = NULL;( K- u9 z/ T9 K: `" e
  74. char *dmabufsrc2 = NULL;& A/ C3 g# _' q! d6 O/ O
  75. char *dmabufdest1 = NULL;: [6 Y+ ^. o0 o; R* I4 ~
  76. char *dmabufdest2 = NULL;
    ) G0 w( m' z4 ~7 |2 W# e
  77. - }. U5 C3 n5 T0 @' z  O+ X
  78. static int acnt = 512;) J' s8 m  N8 ?) ?* G$ n  X
  79. static int bcnt = 8;) l8 f( ^+ u$ q7 |
  80. static int ccnt = 8;% R- s& m' @* c6 G9 ~
  81. * j# R& r3 W4 l5 W7 m+ I9 A
  82. module_param(acnt, int, S_IRUGO);9 R' \9 U7 [# v  u6 c& X
  83. module_param(bcnt, int, S_IRUGO);
    - o4 E+ Q* w# j5 n5 @/ V# }* h: M& [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: W7 Z, I. K# @- e7 P, S5 K5 o3 Z* t  O5 K0 p" Q' U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% j* |: {  `+ ~5 H4 S6 darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% V) t5 V) L" T3 O5 R( W6 e' ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ d# T" r' K; t# \
; s. `6 L, m- Q* b$ @

. v+ c- z+ H1 x* \3 i" N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-30 09:25 , Processed in 0.039282 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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